User avatar
Dreeass
Posts: 42
Joined: Sat Apr 06, 2013 12:05 am
Location: Ghent, Belgium

GPIO Read Infrared Input

Fri May 10, 2013 2:59 pm

So I got my Infrared receiver connected to GPIO pin 18 and would like to know how I decode the signals I'm getting. I am a noob C developer and would like to know whether this is possible.
Increase attachment and avatar size limit or use a third party system?

User avatar
joan
Posts: 13611
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Read Infrared Input

Fri May 10, 2013 3:17 pm

There are quite a few different standards. Have a look at http://www.vecoven.com/elec/ir/ir.html

You'll need to be able to time pulses down to about 50 microseconds.

User avatar
Dreeass
Posts: 42
Joined: Sat Apr 06, 2013 12:05 am
Location: Ghent, Belgium

Re: GPIO Read Infrared Input

Fri May 10, 2013 3:24 pm

joan wrote:There are quite a few different standards. Have a look at http://www.vecoven.com/elec/ir/ir.html

You'll need to be able to time pulses down to about 50 microseconds.
I'm a beginner with C and don't understand it actually. Adafruit's tutorial explains this with an Arduino, how can I do the same with a RPi?
Increase attachment and avatar size limit or use a third party system?

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: GPIO Read Infrared Input

Fri May 10, 2013 3:32 pm

Dreeass wrote:So I got my Infrared receiver connected to GPIO pin 18 and would like to know how I decode the signals I'm getting. I am a noob C developer and would like to know whether this is possible.
Stop LIRC daemon:

Code: Select all

 /etc/init.d/lirc stop
Enter mode2 command, then push some buttons on remote.
If receiver works, you will see output - something like that:

Code: Select all

space 10226593
pulse 2708
space 830
pulse 511
space 814
pulse 510
...

User avatar
Dreeass
Posts: 42
Joined: Sat Apr 06, 2013 12:05 am
Location: Ghent, Belgium

Re: GPIO Read Infrared Input

Fri May 10, 2013 3:37 pm

0xFF wrote:
Dreeass wrote:So I got my Infrared receiver connected to GPIO pin 18 and would like to know how I decode the signals I'm getting. I am a noob C developer and would like to know whether this is possible.
Stop LIRC daemon:

Code: Select all

 /etc/init.d/lirc stop
Enter mode2 command, then push some buttons on remote.
If receiver works, you will see output - something like that:

Code: Select all

space 10226593
pulse 2708
space 830
pulse 511
space 814
pulse 510
...
I have tried LIRC and get the following error when entering mode2:
mode2: could not get file information for /dev/lirc
mode2: default_init(): no such file or directory
Increase attachment and avatar size limit or use a third party system?

User avatar
0xFF
Posts: 202
Joined: Tue Nov 20, 2012 7:52 pm
Location: Poland

Re: GPIO Read Infrared Input

Sat May 11, 2013 8:43 am

You have to load LIRC modules:

Code: Select all

modprobe lirc_rpi
modprobe lirc_dev

User avatar
Dreeass
Posts: 42
Joined: Sat Apr 06, 2013 12:05 am
Location: Ghent, Belgium

Re: GPIO Read Infrared Input

Sat May 11, 2013 10:46 am

0xFF wrote:You have to load LIRC modules:

Code: Select all

modprobe lirc_rpi
modprobe lirc_dev
Doesn't change anything.
Increase attachment and avatar size limit or use a third party system?

mtnbikerjoshua
Posts: 1
Joined: Sat Feb 03, 2018 5:53 am

Re: GPIO Read Infrared Input

Sat Feb 03, 2018 5:54 am

I also had the error that read:
mode2: could not get file information for /dev/lirc
mode2: default_init(): no such file or directory
The solution in this forum worked for me: https://www.reddit.com/r/raspberry_pi/c ... ning_lirc/

Return to “C/C++”