To control a Raspberry Pi with Infrared remote, we used to be able to use LIRC. That used to work up until Kernel 4.19.X when it became a lot more challenging to get LIRC to function properly. In this project we have a Raspberry Pi 3 B+ connected to a TV and we need to get rid of the keyboard and mouse. We will no longer need to install LIRC on RPi or any device we use this project with which will free up resources.
HardwareTSOP1836 IR sensor has three pins: Signal, GND, and Vcc. Make sure you lookup pinout for your sensor before soldering.
Solder sensor's (-) to board's GND, sensors's (+) to board's Vcc, and sensor's Signal to pin 2 of Arduino Pro Micro.
Don't forget to wrap the board to protect it, but leave the sensor exposed.
Code can be found in Github.
There is a very small chance that your code will work now and you'll be done with this project. For the vast majority of maker who are not using the same remote as mine, you will need to read your remote's codes.
Open Arduino IDE Serial Monitor and make sure the Baud Rate matches what we have in the code in line "Serial.begin(115200);".
Point your remote at IR sensor then press one button and release quickly to get at least two lines in Serial Monitor. The first line is the code for the button you pressed and the following line is the remote's way of saying just repeat the last code (button held down).
You will notice two kinds of remote codes in the sketch you downloaded from Github:
- Repeatable: used for mouse movement (e.g. hold down the button to keep mouse moving)
- Non-repeatable: used for single button press such as left mouse button click
In addition to the code you obtained from the previous step, you need to update the size of "const int ButtonCount" which is 32 in my sketch because I have 32 button codes defined in ResultsValues[ButtonCount].
Last but not least, you need to update the following line:
if (Results.value == 4294967295) for (int I = 0; I < ButtonCount; i++) AllButtons[i] = RepeatCode[i];
Replace 4294967295 with the repeat code of your remote. That code can be obtained from the previous step by holding down any remote button. The repeating code will be the code showing up multiple times.
Comments