Relay Control by IR Controller - Receiver KY-022

Today we imagine the ability to control Arduino outputs via an infrared (IR) transmitter - for example, a remote control to a TV or air conditioning. The remote control I tested in this experiment is universal from SILVERCREST, model KH 2159.
The remote control is available mostly in the LIDL chain, works on most TVs, home theaters, players.
A number of available sensors can be used to receive the IR signal, such as the KY-022 module.

Technical specifications KY-022:

  • Sensor type: IR receiver
  • Operating voltage: 2.7 - 5.5V
  • Consumption: 0.4 - 1.5mA
  • Reception angle: ± 45 °
  • Frequency: 38kHz
  • Filter: 500lux
  • Potential range: 18m
  • Receiver diode type: TL1838

Supported protocols: NEC, RC5, RC6, JVC, SONY, Panasonic, AIWA RC-T501, WHYNTER and others
The program implementation uses the most used IRremote library for this IR receiver. The library is designed only for AVR processors, ie AtMega328P used in Arduino and related. For use with other architectures such as ESP32 / ESP8266, IRremoteESP8266 must be used. Both libraries are available on Githube. Libraries can also be used to transmit an IR signal (with a suitable module). In combination with the receiver in one program it is necessary to reinitialize the load state - known "bug". In the Arduino program, I used the library functions to retrieve the protocol and subsequently the code transmitted from the remote control.

When pressing the Up button on the remote control, Arduino reads the NEC protocol and a value of 820. When pressed repeatedly, the value was 20. The same value was always transmitted while holding the button. When you press the button separately, the opposite of these two values. Programmatically I then set a simple condition that the output terminal should be written logical 0, logical 1 - opposite state as current. With a series of conditions or switches, we can assign an action to each loaded code. In my case, I controlled the relay, namely 8 on the 8-channel relay board, which is equipped with electromagnetic relays SRD-5VDC-SL-C, which can be switched up to 10A at 230V, ie a total power of 2300W per relay.



The control can be used for various actions, for example to control the Christmas lights on the house, control the RGB colors of LED strips, modes, relays, control DC / AC motor, door opening, gate. Additional control of measurements from sensors, further communication with other peripherals via Ethernet, SPI, UART, RS232, etc. Such remote control can also find a place in automation.

Program implementation: https://arduino.php5.sk/ir-rele.php
Wiring diagram:

Comments

Popular posts from this blog

Web scraper via Arduino & NodeMCU & ESP32

ESP32 control via UDP datagrams

Biking on Google Maps - Arduino Leonardo (32u4) - HID device