Tutorial TSOP1738 Arduino Infrared Remote For Control LED
IR Remote TSOP1738 Arduino Tutorial
|TSOP1738 Pin Out|
A. TSOP1738 IR Receiver
- Photo Detector and preamplifier in one package.
- Internal filtering for PCM frequencies
- Increased protection against electric field interference
- TTL and CMOS compatibility
- Active output low
- Low power consumption
- High immunity to ambient light
- Continuous data transmission possible (up to 2400 bps)
- Appropriate burst length ≥10 cycles / burst
- Supply Voltage up to 6V
- Supply Current up to 5mA
- Output Voltage up to 6V
- Junction temperature 100 degrees C
- Storage temperature up to +85 degrees C
- Operating temperature up to +85 degrees C
- Power up to 50mW
- Soldering temperature up to 260 degrees C
B. Schematic of TSOP1738 Arduino
To be able to communicate between TSOP1738 and Arduino, please connect them as in the circuit below.
C. TSOP1738 Arduino Library
- Open the Arduino IDE
- Click Sketch -> Include Library -> add .ZIP library
- Navigate and select the library that you have downloaded
- Click OK
IRrecv irrecv(receivePin)Create a recipient object, using a name of your choice.
irrecv.enableIRIn()Start the admissions process. This will activate a timer interrupt which consumes a small amount of CPU every 50 µs.
irrecv.decode(&results)Attempting to receive an IR code. Returns true if codes were received, or false if none were received. When the code is received, the information is stored in the "results".results.decode_type: Will be one of the following: NEC, SONY, RC5, RC6, or UNKNOWN.results.value: Actual IR code (0 if type UNKNOWN)results.bits: The number of bits used by this coderesults.rawbuf: an array of IR pulse timingresults.rawlen: The number of items stored in the array
irrecv.resume()After receiving, it must be called to reset the receiver and prepare it to receive another code.
irrecv.blink13(true)Activate LED blinking during reception. Since you can't see infrared light, flashing the LED can be useful when troubleshooting a problem, or just to provide visual feedback.
IRsend irsend;Create a transmission object. A fixed pin number is always used, depending on which timer the library is using.
- irsend.sendNEC(IRcode, numBits);
Send code in NEC format.
- irsend.sendSony(IRcode, numBits);
Send code in SONY format.
- irsend.sendRC5(IRcode, numBits);
Send code in RC5 format.
- irsend.sendRC6(IRcode, numBits);
Send code in RC6 format.
- irsend.sendRaw(rawbuf, rawlen, frequency);
Send raw code. Usually you will get rawbuf and rawlen content by using the receiver many times and averaging the results.
Several adjustments may be required for best performance. Frequency is the expected bandpass filter frequency at the receiver, of which 38 is the most commonly used.
D. TSOP1738 Arduino Code
1. Basic Program Receiving IR Remote Data
After the upload is complete, open the Arduino IDE monitor serial. Make sure the baudrate is selected at 9600 (bottom right of the monitor serial).
Now press one of the remotes buttons. Then the serial monitor will display the address with a Hexadecimal value.
2. See the IR Remote Protocol Type
After the upload is complete, please press the button on the remote and point it to TSOP1738. You will see the type of protocol you are using on the serial monitor.
3. Turning on the RGB LED Using the Remote
After you understand the two programs above, we will try to turn on the 3 LEDs using the remote.
To turn on 3 Red Green and Blue LEDs we need three buttons. Let's say we have defined 3 hex addresses for the remote:
- 0xFF30CF hex data for red color
- 0xFF18E7 hex data for green
- 0xFF7A85 hex data for blue color
For the circuit, please connect the Red LED to pin 12, the Green LED to pin 11, and the blue LED to pin 10. Don't forget to use a 330R resistor.
Please upload the following program on your Arduino. Please press the button 1, 2, or 3 of your remote.
E. TSOP1738 Datasheet
For more information about TSOP1738, you can see the TSOP1738 datasheet below.
Apart from TSOP1738, there is a component that is now widely used, namely VS1838B. You can read How to Use the TL18838 IR Remote.
Thank you for visiting the Piko Chip website. Hope it is useful.