IR Receiver & Remote support

Raspberry Pi related support

Re: IR Receiver & Remote support

Postby XploD » 11 May 2015, 15:01

Now I understand this part, but my LIRC still doesn't work, and there are no complete tutorials for this. den_hr gave me instructions how he did it but it doesn't work for me.
Music taste: xplodmusic @ Last.fm
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi: Phillips DCD-7010
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

Re: IR Receiver & Remote support

Postby yjo » 11 May 2015, 15:39

How about this page? It's the record of my trial.
http://yjo-blog.blogspot.com/2015/02/runeaudio-03.html

Sorry for incomplete English, and somewhat incomplete description.
But I can successfully use an IR remote controller with a very cheap (ca. $1) additional hardware.

yjo
yjo
 
Posts: 11
Joined: 07 Feb 2015, 14:38

Re: IR Receiver & Remote support

Postby XploD » 12 May 2015, 22:39

yjo wrote:How about this page? It's the record of my trial.
http://yjo-blog.blogspot.com/2015/02/runeaudio-03.html

Sorry for incomplete English, and somewhat incomplete description.
But I can successfully use an IR remote controller with a very cheap (ca. $1) additional hardware.

yjo


Hello, thanks for your answer! I followed your steps but still nothing, obviously I'm doing something wrong. I will try with clean RuneAudio install and I'll try to use the same port for connecting GPIO as you. Irrecord is working (I can successfully record my remote), also mode2 -d /dev/lirc0 is working (I can see output in terminal when pressing keys on remote) but after I finish with everything, irw doesn't show anything and also I created lircrc file and I wrote a script which will echo "Hello world" when I press KEY_PLAY but it doesn't work.

But at least, following your guide for shutdown button, I modified the script a little bit and made myself buttons for controlling playback (play, pause, next, previous, stop, volume down and volume up) and also a status LED (it's on while mpc is playing, or off otherwise).

Connections:
Code: Select all
BUTTON - GPIO PIN
----------------------------
Previous - 22
Next - 9
Play - 24
Stop - 25
Volume Down - 23
Volume Up - 10


Code:
Code: Select all
#!/bin/sh

echo "22" > /sys/class/gpio/export
echo "9" > /sys/class/gpio/export
echo "23" > /sys/class/gpio/export
echo "10" > /sys/class/gpio/export
echo "24" > /sys/class/gpio/export
echo "25" > /sys/class/gpio/export

prev=0
next=0
play=0
vup=0
vdn=0
stop=0

counter=0

state=0


loop(){
   while :
   do
      counter=$((counter + 1))

      if [ $counter -eq 2 ]
      then
         counter=0

              data=`cat /sys/class/gpio/gpio22/value`
         if [ "$data" -eq "1" ] ; then
            if [ $prev -eq 0 ] ; then
               mpc prev
               prev=1
               echo "Previous song"
            fi
         else
            prev=0
         fi

         data=`cat /sys/class/gpio/gpio9/value`
         if [ "$data" -eq "1" ] ; then
            if [ $next -eq 0 ] ; then
               mpc next
               next=1
               echo "Next song"
            fi
         else
            next=0
         fi

         data=`cat /sys/class/gpio/gpio24/value`
         if [ "$data" -eq "1" ] ; then
            if [ $play -eq 0 ] ; then
               play=1
               
               if [ $state -eq 1 ]
               then
                  mpc pause
                  echo "Pause"
               else
                  mpc play
                  echo "Play"
               fi
            fi
         else
            play=0
         fi

         data=`cat /sys/class/gpio/gpio25/value`
         if [ "$data" -eq "1" ] ; then
            if [ $stop -eq 0 ] ; then
               mpc stop
               stop=1
               echo "Stop"
            fi
         else
            stop=0
         fi
      
         data=`cat /sys/class/gpio/gpio10/value`
         if [ "$data" -eq "1" ] ; then
            if [ $vup -eq 0 ] ; then
               mpc volume +5
               vup=1
               echo "Volume +5"
            fi
         else
            vup=0
         fi
      
         data=`cat /sys/class/gpio/gpio23/value`
         if [ "$data" -eq "1" ] ; then
            if [ $vdn -eq 0 ] ; then
               mpc volume -5
               vdn=1
               echo "Volume -5"
            fi
         else
            vdn=0
         fi

         
         data=`mpc status`

         if [[ $data == *"[playing]"* ]]
         then
              state=1
         elif [[ $data == *"[paused]"* ]]
         then
            state=2
         else
              state=0
         fi

         if [ $state -eq 1 ]
         then
            echo "1" > /sys/class/gpio/gpio4/value
         else
            echo "0" > /sys/class/gpio/gpio4/value
         fi
      fi
   done
}

loop &
exit 0
Attachments
DSC_1316.JPG
DSC_1316.JPG (117.5 KiB) Viewed 3118 times
Music taste: xplodmusic @ Last.fm
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi: Phillips DCD-7010
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

Re: IR Receiver & Remote support

Postby yjo » 13 May 2015, 03:00

So, report the results of checks below.

1. dmesg | grep lirc
Is lircd properly loaded?

2. ps -A | grep lirc
Is lircd staying and working?

3. irsend LIST "" ""
Is the conf file for your remote properly registered?

4. irsend LIST DENON_RC-266 ""
DENON_RC-266 should be replaced as your remote controller name registered in lircd.conf.
Is your remote controller properly registered?

5. Before you run irw, confirm that irexec does not stay.


BTW, I'm glad to your successful expansion of my button script :lol:


yjo
yjo
 
Posts: 11
Joined: 07 Feb 2015, 14:38

Re: IR Receiver & Remote support

Postby XploD » 13 May 2015, 09:06

Oh, I hate this Arch Linux, my buttons are working great but I cannot make it start at boot, here is my .service file:

Code: Select all
[Unit]
Description=playback_buttons

[Service]
Type=forking
ExecStart=/usr/bin/buttons.sh
TimeoutSec=0

[Install]
WantedBy=multi-user.target


I also tried with some modifications I found on internet but it just won't work.

For LIRC:
1. dmesg | grep lirc
Code: Select all
[root@runeaudio ~]#  dmesg | grep lirc
[    4.579606] lirc_dev: IR Remote Control driver registered, major 248
[    4.597951] lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned.
[    5.567014] lirc_rpi: auto-detected active high receiver on GPIO pin 18
[    5.567417] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0
[    5.567438] lirc_rpi: driver registered!
[    5.567623] systemd-modules-load[65]: Inserted module 'lirc_rpi'


2. ps -A | grep lirc
Code: Select all
[root@runeaudio ~]# ps -A | grep lirc
  120 ?        00:00:00 lircd


3. irsend LIST "" ""
Code: Select all
[root@runeaudio ~]# irsend LIST "" ""

new_lircd.conf
new_lircd.conf


new_lircd.conf
Code: Select all
begin remote

  name  new_lircd.conf
  driver devinput
  bits           64
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  gap          569
  toggle_bit_mask 0x0

      begin codes
          KEY_VOLUMEUP             0x115200000100023D 0x00000000BEE1E9A5
          KEY_VOLUMEDOWN           0x1159000001000232 0x00000000BEE1E9A5
          KEY_PLAY                 0x116300000100022C 0x00000000BEE1E9A5
          KEY_PREVIOUS             0x114F000001000240 0x00000000BEE1E9A5
          KEY_NEXT                 0x115400000100023C 0x00000000BEE1E9A5
          KEY_MUTE                 0x115800000100027E 0x00000000BEE1E9A5
      end codes

end remote


4. I don't get this, what name? Here is my lircd.conf
Code: Select all
LIRCD_ARGS="--uinput"
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"


5. How to kill irexec?
Music taste: xplodmusic @ Last.fm
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi: Phillips DCD-7010
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

Re: IR Receiver & Remote support

Postby yjo » 13 May 2015, 16:04

XploD wrote:Oh, I hate this Arch Linux, my buttons are working great but I cannot make it start at boot, here is my .service file:

For auto start up at boot, you have to activate the registered script as:

# systemctl enable your.service

I missed the description about that in my blog, so I did add that.

XploD wrote:For LIRC:
1. dmesg | grep lirc
<snip>
2. ps -A | grep lirc
<snip>

Very good. lircd properly starts.

XploD wrote:3. irsend LIST "" ""
Code: Select all
[root@runeaudio ~]# irsend LIST "" ""

new_lircd.conf
new_lircd.conf


The conf file should be renamed and located as /etc/lirc/lircd.conf.

XploD wrote:4. I don't get this, what name? Here is my lircd.conf
Code: Select all
LIRCD_ARGS="--uinput"
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"


The above descriptions are for /etc/conf.d/lircd.conf.
Installing lirc package introduces this file, and you should *modify* the corresponding lines in it according to the above quotation.

XploD wrote:5. How to kill irexec?

irexec is controlled by systemd using irexec.service file.
To stop the running irexec,

# systemctl stop irexec.service

To start it manually,

# sytemctl start irexec.service


yjo
Last edited by yjo on 14 May 2015, 01:34, edited 2 times in total.
yjo
 
Posts: 11
Joined: 07 Feb 2015, 14:38

Re: IR Receiver & Remote support

Postby XploD » 13 May 2015, 17:37

Oh, I'm so stupid I forgot to enable that service, now it works, thanks!

I don't know what I have done but my remote doesn't work at all anymore. Mode2 and irrecord don't react on key presses. I probably messed something up while working on buttons, I'll have to do a clean install of RuneAudio and then try with all your instructions.

PS. now I noticed that I accidentally connected my IR receiver to 5V instead 3.3V. I hope that my R-Pi pin is not damaged, as well as receiver itself.
Music taste: xplodmusic @ Last.fm
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi: Phillips DCD-7010
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

Re: IR Receiver & Remote support

Postby eratical » 15 May 2015, 00:26

Hello,

I follow many instructions but i don't know why it's not working.
When i press "irw "and any key, nothing shows up :?

I have a IR receiver on a B+ rasp: GPIO 18 , 3,3V and GND

# systemctl status lircd.service
Code: Select all
[root@runeaudio ~]
* lircd.service - LIRC Infrared Signal Decoder
   Loaded: loaded (/usr/lib/systemd/system/lircd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2015-05-15 00:31:48 CEST; 16min ago
 Main PID: 1224 (lircd)
   CGroup: /system.slice/lircd.service
           `-1224 /usr/sbin/lircd --nodaemon


# vim /etc/modules-load.d/raspberrypi.conf
Code: Select all
[root@runeaudio ~]
bcm2708-rng
snd-bcm2835
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17


# vim /etc/conf.d/lircd.conf
Code: Select all
[root@runeaudio ~]
LIRCD_ARGS="--uinput"
DRIVER="mceusb"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"



# dmesg | grep lirc
Code: Select all
[root@runeaudio ~]
[    6.438771] lirc_dev: IR Remote Control driver registered, major 248
[    6.438927] systemd-modules-load[74]: Inserted module 'lirc_dev'
[    6.439396] systemd-modules-load[74]: Failed to find module 'lirc_rpi gpio_in_pin=18'
[  795.834083] lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned.
[  796.797089] lirc_rpi: auto-detected active high receiver on GPIO pin 18
[  796.797508] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0
[  796.797530] lirc_rpi: driver registered!



# ps -A | grep lirc
Code: Select all
[root@runeaudio ~]
  697 ?        00:00:00 lircd



# irsend LIST "" ""
Code: Select all
[root@runeaudio ~]
MCL_RemoteController


# irsend LIST MCL_RemoteController ""
Code: Select all
[root@runeaudio ~]
00000000000018e7 KEY_SETUP
00000000000030cf KEY_CANCEL
000000000000a857 off
00000000000038c7 KEY_POWER
0000000000008877 flash
000000000000f00f strobe
000000000000c837 fade
00000000000008f7 smooth
000000000000807f KEY_RED
00000000000040bf KEY_GREEN
000000000000c03f KEY_BLUE
0000000000009867 white
00000000000020df red1
000000000000e01f red2
00000000000050af orange
000000000000b04f KEY_YELLOW
000000000000a05f green1
00000000000010ef blue1
000000000000d02f blue2
000000000000708f blue3
000000000000609f blue4
000000000000906f purple1
000000000000e817 purple2
000000000000b847 purple3
000000000000f807 KEY_POWER
000000000000d827 KEY_POWER
0000000000007887 KEY_POWER
00000000000058a7 KEY_POWER


Thanks for helping me on that !

PS: If i do "mode2 -d /dev/lirc0" then press a key on my remote, i see many lines like this:
Code: Select all
pulse 620
space 514
pulse 619
space 520
pulse 608
space 1615
pulse 626
space 511
pulse 622
space 1611
pulse 625
space 1613
pulse 620
space 508
pulse 623
space 513
pulse 679
space 451
pulse 619
space 511
pulse 623
space 507
pulse 665
space 1573
pulse 626
space 1611
pulse 624
space 507
pulse 624
space 1617
pulse 624
space 1609
pulse 629
space 500
pulse 629
space 506
pulse 624
space 1616
pulse 627
space 39081
pulse 9044
space 2193
pulse 624
eratical
 
Posts: 7
Joined: 12 Apr 2015, 23:08

Re: IR Receiver & Remote support

Postby yjo » 15 May 2015, 01:15

eratical wrote:# vim /etc/modules-load.d/raspberrypi.conf
Code: Select all
[root@runeaudio ~]
bcm2708-rng
snd-bcm2835
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17



Delete last two lines.
Create /etc/module-load.d/lirc.conf, including the following line only.

lirc_rpi gpio_in_pin=18 gpio_out_pin=17

yjo

PS.
My blog may include some mistakes. I'll repeat the installation on next Saturday or Sunday from scratch...
yjo
 
Posts: 11
Joined: 07 Feb 2015, 14:38

Re: IR Receiver & Remote support

Postby eratical » 15 May 2015, 03:00

Thx !

Don't know if it was the issue but it's seems to work better when i configure the LIRC config file :)
BUT, i have another one : when i press one key, there is a double press :

Code: Select all
[root@runeaudio lircd.conf.d]# irw
0000000077e1d005 00 Replay Harmony
0000000077e1d005 01 Replay Harmony
0000000077e1b005 00 Skip Harmony
0000000077e1b005 01 Skip Harmony
0000000077e1c0b9 00 PwrToggle Harmony
0000000077e1c0b9 01 PwrToggle Harmony
eratical
 
Posts: 7
Joined: 12 Apr 2015, 23:08

support RuneAudio Donate with PayPal

PreviousNext

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 2 guests