Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


IR Remote Control with Lirc
#21
(12-15-2018, 01:24 AM)DRONE7 Wrote:
Quote: Sai schematico collegare sulla scheda Rasp pi di quattro o cinque pulsanti fisici per fare le stesse funzioni dei pulsanti del telecomando?
Questo how-to dovrebbe aiutare ....

http://moodeaudio.org/forum/showthread.php?tid=198

YOU ARE FANTASTIC !!!

I immediately install the buttons in the while wait IR receiver ...
Reply
#22
(12-13-2018, 05:57 AM)DRONE7 Wrote: the attached beginners how-to collates the steps from this thread and should work to give a running remote....

well for some odd reason I can't add the attachment so here it is in full form...(mods please fix Smile )

Hardware for Lirc..... all you need is the I/R receiver...and 3 dupont cables to connect it...

https://www.ebay.ca/itm/5PCS-38-kHz-Remo...Sw0fhXmbbB

With it held legs down and the dome facing you...the left-hand pin is input and connects to Pi Gpio=27 (physical pin=13)  centre pin is Ground (physical pin=14)  and right-hand pin is +3.3v (physical pin=1)

Of course a remote is needed and you've probably got a few about....if your chosen one is not in the Lirc database it can be a real headache making a config file so check here first for a working config... then it's just copy and paste in the appropriate file...
http://lirc-remotes.sourceforge.net/remotes-table.html

I use an xbox dvd remote...A couple of bucks at Vinnies or other charity shops..(you don't use the usb dongle)
https://www.amazon.com/Xbox-DVD-Remote-C...B000OCZU0Y

Code:
Code:
sudo apt-get update
sudo apt-get install -y lirc


Edit /boot/config.txt and add these lines ...(where 'xx' is the gpio pin you use for input... eg gpio_in_pin=27)
Code:
# Enable the lirc-rpi module
dtoverlay=lirc-rpi,gpio_in_pin=xx


Edit /etc/lirc/lirc_options.conf  and make sure that driver and devices lines are changed to:
Code:
driver          = default
device          = /dev/lirc0


Reboot...

If all went well you should now have a lirc device. Verify this by issuing the following command:
Code:
ls /dev/lirc0


This command should return a file named lirc0 . If this command doesn’t output go back and verify the configuration once again as the drivers have not been loaded.

Test the IR remote and Receiver to verify that the IR receiver is working as expected:
Code:
sudo systemctl stop lircd

mode2 -d /dev/lirc0

Point the remote control at the IR receiver and press its buttons. If the IR receiver is configured successfully you will see output similar to this:

space 3662230
pulse 2428
space 594
pulse 1201
space 596
pulse 1230
space 595
pulse 1209
space 590
pulse 1204
(CTRL+C to stop output and return to command line)

Paste your remote config file from the LIRC database into ..
Code:
sudo nano /etc/lirc/lircd.conf.d/lircd.conf


and reboot.

You can now check for the presence of the services and modules with commands...
Code:
dmesg | grep lirc
ls -l /dev/lirc0
ps aux | grep lirc

At this point you can test the configuration created by running :
Code:
irw

Point the remote control to the  IR sensor and press some of the buttons, you should get an output similar to this (if using an xbox dvd remoteSmile
0000000000559aa6 03 KEY_UP Microsoft_Xbox
000000000051cae3 00 KEY_FORWARD Microsoft_Xbox
000000000053cac3 00 KEY_INFO Microsoft_Xbox

This means that the remote is correctly mapped and all should be working fine.
All that is left to do is setup irexec as a service and create a file with the commands irexec should run upon button presses.
Set irexec up as a user service for better security rather than having it run as root.

Code:
sudo systemctl edit irexec


and add....
Code:
[Service]
User=pi
Group=pi


then set up the remote's key mapping...
Code:
sudo nano /etc/lirc/irexec.lircrc

and add for your remote....the format is quite simple as this example for the xbox dvd remote shows.
Key presses will then cause mpc to run the commands to control mpd.
I have mapped several Webstreams to the number buttons and included a shutdown and reboot....
Code:
begin
prog = irexec
button = KEY_SELECT
config = mpc toggle
end
begin
prog = irexec
button = KEY_RIGHT
config = mpc next
end
begin
prog = irexec
button = KEY_LEFT
config = mpc prev
end
begin
prog = irexec
button = KEY_PLAY
config = mpc play
end
begin
prog = irexec
button = KEY_PAUSE
config = mpc pause
end
begin
prog = irexec
button = KEY_STOP
config = mpc stop
end
begin
prog = irexec
button = KEY_1
config = mpc clear; mpc add http://5.152.208.98:8058; mpc play
end
begin
prog = irexec
button = KEY_2
config = mpc clear; mpc add http://psn1.prostreaming.net:8095/stream; mpc play
end
begin
prog = irexec
button = KEY_3
config = mpc clear; mpc add http://radionz-ice.streamguys.com:80/national.mp3; mpc play
end
begin
prog = irexec
button = KEY_4
config = mpc clear; mpc add http://178.33.232.106:8014/stream; mpc play
end
begin
prog = irexec
button = KEY_5
config = mpc clear; mpc add http://streaming.radionomy.com/acidbarrett?lang=en-US%2cen%3bq%3d0.5; mpc play
end
begin
prog = irexec
button = KEY_6
config = mpc clear; mpc add http://206.217.213.16:8430/; mpc play
end
begin
prog = irexec
button = KEY_7
config = mpc clear; mpc add http://rock70s.stream.ouifm.fr/ouifmseventies.mp3; mpc play
end
begin
prog = irexec
button = KEY_8
config = mpc clear; mpc add http://rock60s.stream.ouifm.fr/ouifmsixties.mp3; mpc play
end
begin
prog = irexec
button = KEY_8
config = mpc clear; mpc add http://rock60s.stream.ouifm.fr/ouifmsixties.mp3; mpc play
end
begin
prog = irexec
button = KEY_9
config = mpc clear; mpc add http://streaming.radionomy.com/feelingtheblues?lang=en-US%2cen%3bq%3d0.5; mpc play
end
begin
prog = irexec
button = KEY_0
config = mpc clear; mpc add http://streaming.radionomy.com/Peace-Radio?lang=en-US%2cen%3bq%3d0.5; mpc play
end
begin
prog = irexec
button = KEY_TITLE
config = sudo shutdown -h now
end
begin
prog = irex
button = KEY_INFO
config = sudo reboot
end
begin
prog = irexec
button = KEY_UP
config = mpc seek +00:00:10
end
begin
prog = irexec
button = KEY_DOWN
config = mpc seek -00:00:10
end


reboot
and your remote should be up and running

Hi DRONE7

I have followed your recipe for lirc without any reported problems however at the irw test stage I get no response from the remote button presses.

I am using a Sony A1292 remote and have verified it is outputting codes. I have also verified the IR receiver works on both GPIO 26 or 27 with the appropriate entry in /boot/config.txt. I have copied the A1292.lircd.conf file to the lircd.conf.d folder.

Strange thing is if I send

Code:
sudo systemctl stop lircd
mode2 -d /dev/lirc0

- I get space/pulse streams without having to press a remote button!

Can you advise a solution or any debug steps I can try?

Regards,
Richard.
Reply
#23
Quote: - I get space/pulse streams without having to press a remote button!

That would suggest a remote fault..... stuck button perhaps ? or if an old remote then deteriorated contacts... you could try manipulating all the buttons multiple times in the hope of freeing them up then try
sudo systemctl stop lircd

mode2 -d /dev/lirc0

until space/pulse streams work only when a button is pressed.....
A quick physical check is to use a smartphone camera and point it at the business end of the remote then press a button on the remote...a purple flash or intermittent purple dot means it's working.

other things to investigate are possibly I/R sources other than the chosen remote (eg sunlight) ?   Or find another remote to try....as I've mentioned, not every remote works with Lirc....most do but some are problematic.
----------
bob
Reply
#24
(12-16-2018, 09:22 AM)DRONE7 Wrote:
Quote: - I get space/pulse streams without having to press a remote button!

That would suggest a remote fault..... stuck button perhaps ? or if an old remote then deteriorated contacts... you could try manipulating all the buttons multiple times in the hope of freeing them up then try
sudo systemctl stop lircd

mode2 -d /dev/lirc0

until space/pulse streams work only when a button is pressed.....  
A quick physical check is to use a smartphone camera and point it at the business end of the remote then press a button on the remote...a purple flash or intermittent purple dot means it's working.

other things to investigate are possibly I/R sources other than the chosen remote (eg sunlight) ?   Or find another remote to try....as I've mentioned, not every remote works with Lirc....most do but some are problematic.

Hi,

Thanks for the suggestions.

Looks like I might have a faulty receiver. Everything else checks out ok. Will try a new receiver tomorrow.

Regards,
Richard.
Reply
#25
(10-21-2018, 03:05 PM)stosoorok Wrote: Strange thing, I have never had any problems with configuring Lirc for moode but now I can't get it to work. I did a clean install Moode r43, installed Lirc 0.9.4.c and tried with Apple remote A1294.lircd.conf and tried to teach it but it won't do anything to moode. 

All services are up and working, mode2 -d /dev/lirc0 shows pulses, lircrc is also configured.


Any thoughts?

I had exactly the same problem.

With some much appreciated assistance from DRONE7 who referred me to a later (2015) config file for the Apple A1294 -

https://github.com/osmc/osmc/blob/master...lircd.conf

Problem solved,

Hope this helps.
Reply
#26
(12-24-2018, 12:07 PM)rh2018 Wrote:
(10-21-2018, 03:05 PM)stosoorok Wrote: Strange thing, I have never had any problems with configuring Lirc for moode but now I can't get it to work. I did a clean install Moode r43, installed Lirc 0.9.4.c and tried with Apple remote A1294.lircd.conf and tried to teach it but it won't do anything to moode. 

All services are up and working, mode2 -d /dev/lirc0 shows pulses, lircrc is also configured.


Any thoughts?

I had exactly the same problem.

With some much appreciated assistance from DRONE7 who referred me to a later (2015) config file for the Apple A1294 -

https://github.com/osmc/osmc/blob/master...lircd.conf

Problem solved,

Hope this helps.

Thanks rh2018, but I a had typo in irexec.lircrc. Everything works great now.
Reply
#27
Hi,I am running an old version Moode 2.5 on Rpi 1B+ and got Lirc configured without any problem.
A few days ago I installed Moode 4.4 but didnt manage to get IR working.I have no lircO in dev directory although edited boot/config.txt and hardware.conf exactly the same as the old one.
Any advice will be greatly appreciated.
Thanks
Reply
#28
I had this happen in an Ubuntu install recently. Seems to be Lirc related  not MooDe.

I edited /etc/lirc/lirc_options.conf lines....

Code:
driver          = default
device          = /dev/lirc1

and rebooted then checked with
Code:
ls /dev/lirc1

then proceeded with the install using /dev/lirc1

ymmv

EDIT: are you using lircO or lirc0 (your post shows lircO so maybe a simple typo in your setup ?)

EDIT-2 Just occured to me that MooDe 2.5 would probably have used the Jessie Raspbian image and 4.4 uses Stretch....
Lirc has changed completely between the two... you need to use this install method now...
http://moodeaudio.org/forum/showthread.p...84#pid6184
----------
bob
Reply
#29
Thank you for your input,Drone7.
It took some time and now IR is up and working.
I followed the procedure from your edit 2 and after several attempts I was succesfull.
In my case I had to place file lircd.conf in /etc/lirc instead of /etc/lirc/lircd.conf.d.
Regards
Janko
Reply
#30
Sorry
still another (maybe stupid) question from an absolute beginner:

I have an HiFiBerry DAC as Hat on my Pi. If I include a IR-Sensor, how do I this technically - in my view all pins are occupied - is there some kind of "in-the middle-connector" ?? The number of the pins mentioned the IR is attached to are these generally not used by soundcard Hats or do I have to find that out?

Thanks for help

Andreas
Reply


Forum Jump: