Infrared converter decoder


Infrared remote controls are all around us. The majority of home appliances are controlled using infrared remote controls. In this article/video, we will learn how to build a device that can decode (almost) any IR remote and use the instructions to switch relays (loads). We will be able to use this feature in a variety of applications without buying a new infrared remote control and expensive hardware, such as turning on/off lights, opening/closing blinds, etc. I used an ATTiny85 microcontroller as the basis of the circuit. The device can register up to three IR codes in the EEPROM and switch 3 separate devices. Each relay can handle currents up to 10 amperes. The user can program the load switching mechanism (play/pause, toggle,..etc). I used Altium Designer 21.4.1 and the SamacSys component libraries (SamacSys Altium Plugin) to design the schematic and PCB. I also used a Siglent SDS2102X Plus / SDS1104X-E to analyze the IR signals. The device works stably and reacts well to transmitted infrared signals. So let’s get started and build this pup! Circuit analysis Figure 1 shows a schematic diagram of the device. Obviously, the decoding and switching tasks are only performed by the 8-pin ATTiny85 microcontroller. Figure 1: A schematic diagram of the REG1 infrared remote control/switching module is the popular 7805 thru-hole regulator. [1] A chip that sets a constant +5V for the relays. C4 and C5 were used to reduce noise. FB1 and C11 block the peaks of the input noise. IC2 is a TS2937CW-5.0 . regulator [2] which is a +5V constant source for U1 and IC1. D8 indicates good supply and C8 and C9 have been used to reduce regulator output noise. U1 is the VS1838 . infrared receiver module [3]. This unit is sensitive to noise supply, so R7 and C6 build a low-pass RC filter to further reduce U1 source noise. The output of U1 is connected to the PB3 pin of IC1 and the gate pin of Q4 Mosfet. Q1 is a MOSFET at the level of P channel logic FDN360P [4] that was used to supply the D7. D7 is a SMD LED that indicates good reception of infrared signals (blinks). R8 limits the D7 current. SW1 is an SMD tactile push button and the C10 cancels mechanical contact of the push button. IC1 is an ATTiny85 . microcontroller [5]. ATTiny85 Nice slide! Which provides 8K flash memory and can run up to 20MHz with an external crystal oscillator. In this project, I set the clock to 8MHz internal. C7 is a bypass capacitor and has been used to reduce supply noise. Q1, Q2 and Q3 are SI2303 N-Channel Mosfets [6] which are used to switch relays K1, K2 and K3. R4, R5 and R6 are pull-down resistors and D1, D2, and D3 are protective diodes. D4, D5 and D6 are the relay activate indicator LEDs and C1, C2, and C3 are used to reduce the noise of the inductors. The ISP is a 5-pin male header used for programming IC1 using an AVR-ISP programmer. P1, P2, and P3 are right-angle pinned phoenix connectors. Figure 2 shows the PCB layout of the PCB layout for the IR remote control switch. It is a 2-layer PCB board and the majority of component packages are SMD. Figure 2: PCB layout of the IR remote control switchboard as mentioned in the abstract, I used Altium Designer software [7] For schematic design and PCB. It is an elegant program that offers an easy-to-use design environment and many useful features. I didn’t have the schematic code, PCB footprint, and 3D model for many of the components in this project. So, instead of wasting my time designing the libraries from scratch and increasing the risk of errors and component mismatches, I used the free, IPC-branded ScacSys component libraries and imported them directly into an Altium PCB project using the SamacSys Altium plugin [8]. SamacSys has provided plugins for the majority of computer-aided design software, not just for the Altium Designer. Figure 3 shows the CAD software for the supported electronic design. Figure 3: Design of electronic CAD software supported by SamacSys extensions Specifically, I used the SamacSys libraries for IC1 [9], IC2 [10], REG1[11], Q1…Q3[12], and Q4 [13], which you can check the links in the references. Another option is to download the component libraries from and import them manually. It’s up to you. Figure 4 shows the components identified in the SamacSys Altium plug-in. Figure 4: Component libraries selected in the assembly and testing of the SamacSys Altium plugin Figure 5 shows an assembled PCB board. The PCBs are manufactured by PCBWay and I can say the quality is fine. I have no problem soldering the components. So I recommend you to look for quality and not choose cheap prices only to save a few dollars! Figure 5: The assembled PCB board for the IR remote control switch I used the Arduino IDE to write the code, but you don’t need to use the Arduino board for this. You can install the custom ATTiny panel manager and export the compiled binary file (HEX file). Then program your chip using an AVR-ISP programmer or similar outside of the Arduino IDE. You don’t need to program the bootloader either. #include #include keyCounter byte = 0; int data1 = -1, data2 = -1, data3 = -1; byte out2Toggle = 0; void setting() { pinMode(0, output); pinMode(1, OUTPUT); pinMode(2, output); pinMode(4, Input); IrReceiver.begin(3, DISABLE_LED_FEEDBACK), } empty loop() { data1 = (0); data2 = (1), data3 = (2), while (digitalRead (4) == 0) { if (IrReceiver.decode()) { delay (200); if (keyCounter == 0) { data1 = IrReceiver.decodedIRData.decodedRawData; digitalWrite(2, high); delay (2000); digitalWrite(2, Low); EEPROM.write (0, data 1); keyCounter++; } else if (keyCounter == 1) { data2 = IrReceiver.decodedIRData.decodedRawData; digitalWrite(1, HIGH); delay (2000); digitalWrite(1, low); EEPROM.write(1, data2); keyCounter++; } else if (keyCounter == 2) { data3 = IrReceiver.decodedIRData.decodedRawData; digitalWrite(0, HIGH); delay (2000); digitalWrite(0,low); EEPROM.write(2, data3); keyCounter = 0; } IrReceiver.resume (), }} if (IrReceiver.decode ()) { delay (200); if (data1 == IrReceiver.decodedIRData.decodedRawData) { digitalWrite(2, HIGH); delay (250); digitalWrite(2, Low); delay (250); } if (data2 == IrReceiver.decodedIRData.decodedRawData) { switch (out2Toggle) { case 0: digitalWrite(1, HIGH); out2Toggle = 1; rest time; Case 1: digital writing (1, low); out2Toggle = 0; rest time; }} if (data3 == IrReceiver.decodedIRData.decodedRawData) {digitalWrite(0, HIGH); delay (250); digitalWrite(0,low); delay (250); } IrReceiver.resume(), }} To compile the Arduino diagram of the ATTiny85 microcontroller, you need to install “ATTinyCore” by Spence Konde [14]. Microchip-like board directors are not working as expected. Also, install the “IRRemote” library V3.3 (by Armin Joachimsmeyer) [15] And include the head. For more details please check my youtube video. Test I tested the output of the VS1838 with a Siglent SDS2102X Plus oscilloscope [16] (Fig. 6). You can use other models such as SDS1104X-E [17]. The oscilloscope display says the signal is clear and noise-free. Each remote control manufacturer may use his or her own existing IR protocol and each remote key generates a different code, so the output signal of the remote control may be different. I used a SONY HDTV remote that normally uses the SONY IR protocol. Figure 6: Infrared receiver module (U1) output signal After the microcontroller has been successfully programmed, please unplug the programmer and restart the board (unplug and reconnect the power). After that you can store the required remote control keys (by pressing and holding SW1). You can change any of the stored keys at any time later. The keys are stored in the EEPROM, so resetting the power does not clear the stored memory and keys. For more details, please watch the YouTube video carefully. Figure 7 shows the bill of materials. Figure 7: Bill of Materials Article Reference:
[1]: L7805 datasheet:
[2]: TS2937CW-5.0 Data Sheet:
[3]: VS1838 IR Receiver Module Data Sheet:
[4]: FDN360P Datasheet:
[5]Datasheet: ATTiny85-20SUR:
[6]: Si2302 data sheet:
[7]: CAD software for electronic design from Altium Designer:
[8]: SamacSys Altium Plugin:
[9]: ATTiny85 schematic code, PCB fingerprint, 3D model:
[10]: TS2937-5.0 Schematic symbol, PCB trace, 3D model:
[11]: Schematic code L7805, trace PCB, 3D model:
[12]: SI2302 schematic code, PCB trace, 3D model:
[13]: FDN360P Schematic Code, PCB Trace, 3D Model:
[14]: ATTinyCore:
[15]: IRremote library:
[16]: Siglent SDS2102X Plus Oscilloscope:
[17]Siglent SDS1104X-E Oscilloscope:

Like it? Share with your friends!


What's Your Reaction?

hate hate
confused confused
fail fail
fun fun
geeky geeky
love love
lol lol
omg omg
win win


Your email address will not be published. Required fields are marked *