close
KnowledgeBase

Displaying Received Commands from an Infrared (IR) remote control on a 16×2 LCD module

no thumb

Overview:

When you were a kid, Have you ever questioned yourself on how does the remote control of your TV functions? Why do you have to point it directly at the TV? When you aim your remote at a neighbor’s house, does their TV change too?

So in this activity we are going to find on how does this work. With the use of HX1838 mounted infrared receiver and a remote control. We are going to divide this into two activities so that we can deeply understand on how this things work and dont worry because this activity is a straight forward activity which means it is a friendly activity for beginners.

Hardware Used:

  • Infrared Receiver Module (HX1838)
  • Remote Control
  • Breadboard
  • Arduino UNO
  • Wires
  • 16×2 LCD module

You can buy all this Hardware at Createlabz.

Software Used:

Arduino IDE

Library Used:

Application Description:

Infrared radiation is a type of electromagnetic radiation, as are radio waves, ultraviolet radiation, X-rays and microwaves. Infrared (IR) light is the part of the EM spectrum that people encounter most in everyday life, although much of it goes unnoticed. For example, when you hit a button on your TV remote, an IR LED repeatedly turns on and off, 38,000 time a second, to transmit information (like volume or channel control) to an IR photo sensor on your TV. It is invisible to human eyes, but people can feel it as heat. It is below the human eye of the Electromagnetic Spectrum.

Credits: Circuit Basic

Process of IR Remote

A common modulation scheme for IR communication is something called 38kHz modulation. There are very few natural sources that have the regularity of a 38kHz signal, so an IR transmitter sending data at that frequency would stand out among the ambient IR. 38kHz modulated IR data is the most common, but other frequencies can be used.

When you hit a key on your remote, the transmitting IR LED will blink very quickly for a fraction of a second, transmitting encoded data to your appliance.

Credits: Sparkfun

If you were to hook an oscilloscope up to your TV remote’s IR LED, you would see a signal similar to the one above. This modulated signal is exactly what the receiving system sees. However, the point of the receiving device is to demodulate the signal and output a binary waveform that can be read by a microcontroller. When you read the OUT pin of the HX1383 with the wave from above, you will see something like this:

Credits: Sparkfun

To summarize and to imagine how the IR remote functions:

Application

In order to perform this activity. We used a HX1383 mounted infrared receiver and a remote control. You can order this module kit in store.createlabz.com which cost 145 pesos.

The first activity that we are going to do is to determine the codes that appear in your remote control.  Just copy the codes and the schematic diagram in the”Set up the Hardware” and “Code”.

This are the codes that comes from my remote control, some of you might have other results which is okay because maybe you are using other remote control. This activity is so important because you will need this codes to perform the second activity in which we are going to display some text in the LCD(Liquid Crystal Display) using your remote control.

Problems Encountered with this module:

It is really important to do the first activity, based on my experience sometimes the remote control prints another codes. As you can see in the serial monitor, the E318261B and FFA25D both of this is the code for CH-, for CH are 511DBB and FF629D and so on. This just means that if do not perform the first activity, you’re IR remote will be faulty and it will sometimes malfunctions. Some of you might have another codes for the IR remote so you better try the activity first before going to the 2nd activity. So this will happen. Click the link: https://youtu.be/ESgZiZV8wuk

 

The second activity is to display text in the LCD using the buttons in the remote control. As you can see in the featured image, every button has a functions. When I press CH- the LCD prints “You have pressed the button CH-“, when I press + the LCD prints “You have pressed the button +” and…..

Set-up the Hardware:

Schematic Diagram for First Activity:

Schematic Diagram for 2nd Activity:

 

 

 

Code:

For Activity 1:

For Activity 2:

Code Breakdown:

Libraries we used in this activity

In this line, we assigned the pin of the IR receiver. You can choose any pins in the arduino i just chose the pin 7 because later it will not be used in the pins of the LCD.

LiquidCrystal syntax, depends on your pinouts.

LiquidCrystal(rs, enable, d4, d5, d6, d7)

For any IR communication using the IRremote library, first we need to create an object called irrecv and specify the pin number where the IR receiver is connected (line 3). This object will take care of the protocol and processing of the information from the receiver.

In the void setup() block, first we configure the serial monitor baud rate. Next we start the IR receiver by calling the IRrecv member function enableIRIn() (line 10).

This are the codes that came from your remote control. In order to find the codes you must do the activity 1 first.

This line if the output when you pressed the button EQ. You can edit the text. Just change the text inside the string “”.

If we receive 0XFFFFFFFF from the remote, it means a repetition of the previous key. So in order to handle the repeat key pattern, I am storing the hex code in a global variable key_value every time a code is received:

At the end of the void loop() section, we call irrecv.resume() to reset the receiver and prepare it to receive the next code.

Conclusion:

The main purpose of this project was to share what I learned from this module. To carry out this project, you must follow the instructions I have given and understand through research. This is so useful because this is a fundamental project and when you go to the complicated projects, you will return to the fundamental part. You can also add or improve this project, depending on what you would like.

References:

https://www.livescience.com/50260-infrared-radiation.html

https://learn.sparkfun.com/tutorials/ir-communication

circuitbasics.com/arduino-ir-remote-receiver-tutorial

https://arduino-info.wikispaces.com/IR-RemoteControl

 

Tags : 16x2 lcdarduinoarduino unoControlinfraredIRIR receiverlcdmodulePrintRemote

Leave a Response