Announcement

Collapse
No announcement yet.

lirc rpi gpio IR support for picoreplayer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    lirc rpi gpio IR support for picoreplayer

    This section is for squeezelite ONLY. See post #2 for Jivelite configuration.



    audible feedback only, no visuals.

    Supported "blind actions" are;

    Power
    Play
    Pause
    Next Track
    Previous Track
    Volume Up
    Volume Down

    The packages come with support for a logitech/slimdevices remote already configured and working.
    To use a different remote you need to obtain/create an lircd.conf file for said remote and an .lircrc key mapping file.
    There is a plethora of info available to do this, research it yourself, I won't do it for you.

    I will be happy to include additional remote configurations in the tcz file.

    For installation details see the README.md

    We are planning to integrate lirc support into picoreplayer when we have a working jivelite solution as well.

    I'm using these 38 kHz TSOP4838 DIP-3 IR Receiver Modules.

    Check out this video for info on creating a solderless harness to connect an IR receiver directly to the rpi.

    There's a pic of my B+ with IR connected to the IQaudIO DAC+ IR header. The cable is long enough to expose the IR diode when I finally put the rpi behind the stereo. I used a no solder solution, except to join the 2 connectors and I had to bend the pins on the diode a bit to keep them snug in the connector. The range is amazing with the IR floating like that. We'll see what it's like when I hide it.

    Click image for larger version

Name:	rpiir.jpg
Views:	1
Size:	74.2 KB
ID:	1577381
    Last edited by ralphy; 2016-02-06, 14:29. Reason: No longer just for squeezelite
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 2-UE Radio
    Squeezebox client builds donations always appreciated.

    #2
    LIRC IR Jivelite Setup

    Add the lirc-rpi module to /mnt/mmcblk0p1/config.txt

    sudo mount /mnt/mmcblk0p1

    dtoverlay=lirc-rpi,gpio_in_pin=27

    sudo umount /mnt/mmcblk0p1

    I'm using gpio 27. Change the "27" to the gpio in pin you have your IR receiver diode connected.

    Copy these files to /mnt/mmcblk0p2/tce/optional

    For For piCorePlayer < 2.04

    irda-4.1.13-piCore+.tcz
    irda-4.1.13-piCore+.tcz.md5.txt
    irda-4.1.13-piCore_v7+.tcz
    irda-4.1.13-piCore_v7+.tcz.md5.txt

    For piCorePlayer >= 2.04

    irda-4.1.20-piCore+.tcz
    irda-4.1.20-piCore+.tcz.md5.txt
    irda-4.1.20-piCore_v7+.tcz
    irda-4.1.20-piCore_v7+.tcz.md5.txt

    For all piCorePlayer versions

    lirc.tcz
    lirc.tcz.dep
    lirc.tcz.md5.txt

    If you don't have shairport-sync enabled you also need to install

    http://ralph_irving.users.sourceforg...co/libcofi.tcz
    http://ralph_irving.users.sourceforg...fi.tcz.md5.txt

    Add lirc.tcz to the end of /mnt/mmcblk0p2/tce/onboot.lst

    Copy the lircd-jivelite from git to /usr/local/etc/lirc/lircd.conf on picoreplayer or create/modify your own.

    The lircd-jivelite config file is only for a squeezebox3, classic, or touch slimdevices/logitech remote. I've also included a lircd-jivelite-RMTD116A config file which is for a Sony RMT-D116A remote.

    Add usr/local/etc/lirc/lircd.conf to the end of the file /opt/.filetool.lst

    Add to one of the User commands fields on the tweaks page in the web gui.

    /usr/local/sbin/lircd --device=/dev/lirc0 --uinput

    Save your configuration and reboot

    To create a lircd.conf for a different remote, see jivekeys.csv for the key symbols, that work with jivelite, during your irrecord session.

    lircd v0.9.0 does not support keyboard modifiers, like SHIFT, CONTROL, ALT so you cannot use any of the shifted keys. ie Upper case letters! Key symbols postfixed with (NEW) require a new jivelite.tcz build, which is not yet released. Needs more testing.
    Last edited by ralphy; 2016-03-29, 13:31. Reason: Updated for pcp 2.04 kernel modules
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 2-UE Radio
    Squeezebox client builds donations always appreciated.

    Comment


      #3
      hi ralphy,

      Thanks for doing all the work.

      I was meaning to do it months ago but after looking at what you had to do... I would not have succeeded.

      I just followed your instructions to the letter and it worked.

      One thing I did find is that I needed to restart squeezelite after a reboot. I assume this means lircd needs to be started before squeezelite?

      A word of warning to others: I had a couple of different IR Receiver Modules on hand and they have different pin outs. Check the datasheets.

      For debugging I needed to confirm that the IR Receiver was working. The mode2 command shows the IR hardware/wiring and drivers are working.

      Code:
      $sudo mode2 -d /dev/lirc0
      
      pulse 584
      space 1658
      pulse 626
      space 1607
      pulse 610
      space 1654
      pulse 590
      space 512
      pulse 608
      space 1661
      pulse 582
      space 1656
      pulse 652
      space 512
      pulse 547
      space 1668
      pulse 617
      space 505
      pulse 587
      space 527
      pulse 601
      space 547
      pulse 616
      The irw command shows the remote is recognised as a Squeezebox remote.

      Code:
      $irw
      00000000768920df 00 KEY_PAUSE Slim_Devices_Squeezebox3
      00000000768920df 01 KEY_PAUSE Slim_Devices_Squeezebox3
      00000000768920df 02 KEY_PAUSE Slim_Devices_Squeezebox3
      00000000768910ef 00 KEY_PLAY Slim_Devices_Squeezebox3
      00000000768910ef 01 KEY_PLAY Slim_Devices_Squeezebox3
      00000000768910ef 02 KEY_PLAY Slim_Devices_Squeezebox3
      000000007689a05f 00 KEY_FORWARD Slim_Devices_Squeezebox3
      000000007689a05f 01 KEY_FORWARD Slim_Devices_Squeezebox3
      000000007689a05f 02 KEY_FORWARD Slim_Devices_Squeezebox3
      000000007689c03f 00 KEY_REWIND Slim_Devices_Squeezebox3
      000000007689c03f 01 KEY_REWIND Slim_Devices_Squeezebox3
      000000007689807f 00 KEY_VOLUMEUP Slim_Devices_Squeezebox3
      000000007689807f 01 KEY_VOLUMEUP Slim_Devices_Squeezebox3
      000000007689807f 02 KEY_VOLUMEUP Slim_Devices_Squeezebox3
      00000000768900ff 00 KEY_VOLUMEDOWN Slim_Devices_Squeezebox3
      00000000768900ff 01 KEY_VOLUMEDOWN Slim_Devices_Squeezebox3
      00000000768900ff 02 KEY_VOLUMEDOWN Slim_Devices_Squeezebox3
      This is exactly what I need as most of my piCorePlayers are headless. I am looking forward to having IR included in piCorePlayer.

      regards
      Greg

      Comment


        #4
        Thanks for posting the additional setup details.

        If you are not using a slimdevices remote, you do need to restart lircd as squeezelite is started before the user commands are run and lircd needs to already be running. I just discovered this as well, when I created lircd.conf and .lircrc configuration files for an old Sony RMT-116A dvd remote I had kicking around. I've added the config files to the git repo as an example.

        I updated the lirc-squeezebox to match the name of the squeezelite binary on pcp. The prog = section for each code. Needed for non SD remotes.
        Code:
        -       prog = squeezelite
        +       prog = squeezelite-armv6hf
        I also added to the bottom of the README.md a youtube video describing how to modify the lircd.conf when the remote sends the key many times when you only press it once.

        I've updated the default lircd.conf file for watch worked for me.

        Code:
        --- a/lircd.conf
        +++ b/lircd.conf
        @@ -24,6 +24,8 @@ begin remote
           pre_data_bits   16
           pre_data       0x7689
           gap          107995
        +  min_repeat   1
        +  suppress_repeat 3
           toggle_bit      0
        The programs have not changed in lirc.tcz, only the default configuration files.

        I have managed to get lirc working with jivelite, but I can't get all the remote buttons to be recognized yet.

        Here's my pcp touch IR setup using gpio 27.
        Code:
        $ grep -i ir /mnt/mmcblk0p1/config.txt
        # Enable IR receiver
        dtoverlay=lirc-rpi,gpio_in_pin=27
        I connected velcro straps to the screw hold mounts on the screen and just popped the IR receiver above the screen.

        Click image for larger version

Name:	rpiirt.jpg
Views:	1
Size:	30.7 KB
ID:	1560061
        Click image for larger version

Name:	gpio27.jpg
Views:	1
Size:	165.5 KB
ID:	1560062
        Ralphy

        1-Touch, 5-Classics, 3-Booms, 2-UE Radio
        Squeezebox client builds donations always appreciated.

        Comment


          #5
          Hi ralphy,

          I have been trying to get the remote to work via irexec rather than squeezelite. I would like to be able to control piCorePlayer directly, rather than go thru squeezelite or jivelite.

          Anyway, I copied .lircrc to my home directory and changed POWER_DOWN to irexec and shutdown. I initially tried echo command for testing but could not work out exactly where the output would go. I unsuccessfully tried outputting to the console and the ssh terminal window.

          The funny thing is, if I use the "ircat irexec" and "ircat squeezelite" I get the right command shown on screen but the SHUTDOWN button always does then squeezelite command rather than the irexec command no matter what.

          I am guessing that the default directory for the ".lircrc" may be different depending on application or I am doing something stupid.

          regards
          Greg

          Comment


            #6
            Originally posted by Greg Erskine View Post
            Hi ralphy,

            I have been trying to get the remote to work via irexec rather than squeezelite. I would like to be able to control piCorePlayer directly, rather than go thru squeezelite or jivelite.

            Anyway, I copied .lircrc to my home directory and changed POWER_DOWN to irexec and shutdown. I initially tried echo command for testing but could not work out exactly where the output would go. I unsuccessfully tried outputting to the console and the ssh terminal window.

            The funny thing is, if I use the "ircat irexec" and "ircat squeezelite" I get the right command shown on screen but the SHUTDOWN button always does then squeezelite command rather than the irexec command no matter what.

            I am guessing that the default directory for the ".lircrc" may be different depending on application or I am doing something stupid.

            regards
            Greg
            The lirc tools use /usr/local/etc/lirc/lircrc for the default configuration file.

            Squeezelite uses $HOME/.lircrc if you don't include the file path with the -i option.
            Ralphy

            1-Touch, 5-Classics, 3-Booms, 2-UE Radio
            Squeezebox client builds donations always appreciated.

            Comment


              #7
              Does anyone know what chip / protocol is used in the SB3 remote ?

              These genuine remotes are no longer available and having searched for decent remotes to use with squeeze/jive lite thought it maybe easier to recreate one.

              Jeff
              sigpic
              Want a webapp ? Get SqueezeLite-X ! https://forums.slimdevices.com/showt...l=1#post903953

              Comment


                #8
                Originally posted by Jeff07971 View Post
                Does anyone know what chip / protocol is used in the SB3 remote ?

                These genuine remotes are no longer available and having searched for decent remotes to use with squeeze/jive lite thought it maybe easier to recreate one.

                Jeff
                Hi Jeff,

                Perhaps it might be easier to pick up a used Sony RMT-D116A or RMT-D117A. These remotes can be had on ebay for as little as 4 quid.

                I have both these remotes and have created configurations for both squeezelite and jivelite and keep them in the lirc tcz github repository.

                It's also quite easy to create a config for any remote. Youtube is great for this. It took me about an hour to create the initial config for the sony. Still tweaking it however. There are a couple of keys which use a different protocol it seems and don't work with my configs. I've put comments in the config files for the key mappings.
                Ralphy

                1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                Squeezebox client builds donations always appreciated.

                Comment


                  #9
                  @Greg

                  Did you add this to 2.02, since config.txt has some IR_ options?

                  Thanks!
                  Scott Kramer

                  Comment


                    #10
                    Originally posted by sckramer View Post
                    @Greg

                    Did you add this to 2.02, since config.txt has some IR_ options?

                    Thanks!
                    Hi sckramer,

                    No, it's not there yet. We are working on it!! Maybe pCP2.04 or pCP2.05.

                    regards
                    Greg

                    Comment


                      #11
                      Ralphy-
                      Followed your instructions, and got this working with JiveLite. It seems to perform much better than my FLIRC dongle! The FLIRC was sitting behind the screen, so that may have been part of the problem, but the IR receiver using lirc just seems much more responsive.
                      Some of the instructions were a little confusing. To modify the config.txt, I ended up removing my SD card, and editing using my PC. I was also somewhat confused on how to get the /usr/local/etc/lirc/lircd.conf setup. I created both a lirc and a lirc/lircd.conf directory. Somewhere the lircd.conf directory was replace by the lircd.conf file, but it was populated with the squeezelite (or piCorePlayer) controls. I then pasted the jivelite control settings into this file to get the JiveLite controls to work.
                      It is working well with my Touch IR remote, with one nit: buttons seem too responsive - example, when "right" selecting a menu item, it often jumps two menus. I suspect there's a way to "slow down" the key repeat rate?
                      I'd like to configure for a different remote - if it's successful, I'll see about sending you the config file to add to the repository.

                      THANKS! Looking forward to seeing this implemented in future releases of pCP - (although I can imagine it's less straight-forward - most cases require some soldering to access GPIO when using HATs, and various GPIO options). For simplicity, I chose to use the same GPIO as you - there was no contention with the HiFiBerry DAC+.

                      Comment


                        #12
                        Originally posted by tcutting View Post
                        Ralphy-
                        Followed your instructions, and got this working with JiveLite. It seems to perform much better than my FLIRC dongle! The FLIRC was sitting behind the screen, so that may have been part of the problem, but the IR receiver using lirc just seems much more responsive.
                        Some of the instructions were a little confusing. To modify the config.txt, I ended up removing my SD card, and editing using my PC. I was also somewhat confused on how to get the /usr/local/etc/lirc/lircd.conf setup. I created both a lirc and a lirc/lircd.conf directory. Somewhere the lircd.conf directory was replace by the lircd.conf file, but it was populated with the squeezelite (or piCorePlayer) controls. I then pasted the jivelite control settings into this file to get the JiveLite controls to work.
                        It is working well with my Touch IR remote, with one nit: buttons seem too responsive - example, when "right" selecting a menu item, it often jumps two menus. I suspect there's a way to "slow down" the key repeat rate?
                        I'd like to configure for a different remote - if it's successful, I'll see about sending you the config file to add to the repository.

                        THANKS! Looking forward to seeing this implemented in future releases of pCP - (although I can imagine it's less straight-forward - most cases require some soldering to access GPIO when using HATs, and various GPIO options). For simplicity, I chose to use the same GPIO as you - there was no contention with the HiFiBerry DAC+.
                        Sorry for the confusion. Quite often my fingers can't keep up with my thoughts and things get missed.

                        The initial /usr/local/etc/lirc/lircd.conf is created from /usr/local/share/lirc/files when lirc.tcz is installed and is for a headless squeezelite with slimdevices remote. You should not have needed to create /usr/local/etc/lirc. This may be broken. I haven't tested a lirc setup from scratch in a while.

                        If you create/modify /usr/local/etc/lirc/lircd.conf then you need to add usr/local/etc/lirc/lircd.conf to /opt/.filetool.lst and backup pcp config to prevent the file being overwritten on reboot.

                        The jivelite configuration files are not included in the tcz ATM and needs to downloaded from github.

                        You can try incrementing suppress_repeat in lircd.conf by 1 and testing that value for a while, if you still get repeats too fast, +1 again, repeat.

                        You can use sudo kill -HUP pid of lircd to force a configuration reload without having to restart the daemon or reboot.
                        Ralphy

                        1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                        Squeezebox client builds donations always appreciated.

                        Comment


                          #13
                          Hi Ralphy,

                          I'm assuming that this procedure will not work on Pcp 2.04 as I have tried it and it didn't seem to work.

                          Is this down to the later kernel in Pcp2.04 ?

                          Jeff
                          sigpic
                          Want a webapp ? Get SqueezeLite-X ! https://forums.slimdevices.com/showt...l=1#post903953

                          Comment


                            #14
                            Originally posted by Jeff07971 View Post
                            Hi Ralphy,

                            I'm assuming that this procedure will not work on Pcp 2.04 as I have tried it and it didn't seem to work.

                            Is this down to the later kernel in Pcp2.04 ?

                            Jeff
                            LIRC works fine with 2.04.

                            You need to copy irda-4.1.20-piCore* from github into the optional folder.

                            Sorry, I committed these yesterday but forgot to push them to github. Also updated the README.md
                            Ralphy

                            1-Touch, 5-Classics, 3-Booms, 2-UE Radio
                            Squeezebox client builds donations always appreciated.

                            Comment


                              #15
                              Originally posted by ralphy View Post
                              LIRC works fine with 2.04.

                              You need to copy irda-4.1.20-piCore* from github into the optional folder.

                              Sorry, I committed these yesterday but forgot to push them to github. Also updated the README.md
                              Thanks Ralphy,

                              I did look for updated irda files but did not find them. I'll give it a try later on. Thanks Again

                              Jeff
                              sigpic
                              Want a webapp ? Get SqueezeLite-X ! https://forums.slimdevices.com/showt...l=1#post903953

                              Comment

                              Working...
                              X