Pi_Remote_IR is a python script that allows a raspberry pi to be controlled via a IR-Remote. Whenn a specific button is pressed on the Remote (like button 0) the corresponging led will turn on and the name of the pressed button will be displayed on an OLED screen.
Team members: Simon Friedrichs, Aaron Zettler
To use this python script you have to configure your raspberry pi as followes. We used a raspberry pi 3 with "2019-04-08-raspbian-stretch" but this should work for other setups as well.
-
connect to the pi via ssh, this is optional
ssh pi@<ip adress of your pi>
-
install git if not installed
sudo apt install git
-
enable I2C: open the raspberry pi config with the command below, open (Interfacing Options) -> (I2C) and press (Enter). Then reboot.
sudo raspi-config sudo reboot
-
clone this project to your raspberry pi with
git clone https://github.com/AaronZettler/Pi_Remote_IR.git
The following stepps are required to start the python script.
- cd to the git repository with
cd <your setup path>\Pi_Remote_IR
- start the python script
python Pi_Remote_IR.py
Without Owains IR-Remote-Receiver-Python-Module none of this would be possible. We almost gave up when we were using lirc but thanks to Owain we finally were able to receive the right "codes" from our IR-Remote.
https://github.com/owainm713/IR-Remote-Receiver-Python-Module https://indibit.de/raspberry-pi-oled-display-128x64-mit-python-ansteuern-i2c/ https://raspi.tv/2013/rpi-gpio-basics-5-setting-up-and-using-outputs-with-rpi-gpio
First we used lirc (lirc_tutorial_1, lirc_tutorial_2) to receve IR siginals. After hours of problem solving we droped lric and found a better method. We will not describe this process in deteil because it didn't work but below are some of the things we tried. At this point we were using a raspberry pi 4 with "2019-09-26-raspbian-buster".
- we installed lirc like described in the DIDNT_WORK.txt file of this repository.
- we were receving data but we were not abele to generate a "propper" configuration file. We used this command to generate the configuration file.
irrecord -d /dev/lirc0 ~/lircd.conf
- because our configuration file looked like this, we tried useing a raspberry pi 3 with "2019-04-08-raspbian-stretch".
- at this point we were able to capture a "working" config file but we didnt receve any data when useing the following command.
irw
- after further analysis we found out that lirc was receving different "codes" when pressing the same button on the remote. Below you can see the config file that was generated by pressing the same button for different KEYs.
# Pi_Remote_IR Controls Raspberry-Pi-GPIO(LEDs) via IR-Remote. # Please take the time to finish this file as described in # https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ # and make it available to others by sending it to # <lirc@bartelmus.de> # # This config file was automatically generated # using lirc-0.9.4c(devinput) on Wed Jan 22 21:18:09 2020 # Command line used: -d /dev/lirc0 /home/pi/lircd.conf # Kernel version (uname -r): 4.19.66-v7+ # # Remote name (as of config file): SONY # Brand of remote device, the thing you hold in your hand: # Remote device model nr: # Remote device info url: # Does remote device has a bundled capture device e. g., a # usb dongle? : # For bundled USB devices: usb vendor id, product id # and device string (use dmesg or lsusb): # Type of device controlled # (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) : # Device(s) controlled by this remote: begin remote name SONY driver devinput bits 56 eps 30 aeps 100 one 0 0 zero 0 0 pre_data_bits 72 pre_data 0x9 gap 19854 toggle_bit_mask 0x0 frequency 38000 begin codes BTN_0 0x4A010000000264 BTN_1 0x2101000000027D BTN_2 0x3301000000027D end codes end remote