Tutorial – Adding GPIO to a Radiobuttonshow

Greg Reynolds from the Canadian Air and Space Museum in Ottawa has provided a tutorial on how add GPIO based buttons to a Radiobuttonshow. He provides much useful information which is not immediately obvious from the manual including the directory structure of Pi Presents. He takes you through editing gpio.cfg and a copy of the pp_radiobuttonshow_1p3 example profile to show how to set up the control path between a button click and a video playing.

The tutorial is applicable to Version 1.3 (gapless). Version 1.2 (next) has detailed differences but the genral principles are the same.

The tutorial is a pdf document which can be found here

Advertisements

11 Responses to Tutorial – Adding GPIO to a Radiobuttonshow

  1. Frank says:

    Hello! I Is it possible to use GPIO to select a specific video file? I Just found out about this software and started experimenting with it. GPIO basically works, but i am only able to proceed to the next track.
    Let me explain what I am panning to do: I want the pi to boot up and show a black screen in fullscreen. If someone presses button 1, it should play video 1 and return to the black screen. If someone presses button 2 it should play video 2 and return to the black screen.

    Is that possible? Thanks

  2. Nick says:

    OK so I must be the stupid one. I am now at 20 + hours trying to use pipresents. What I am trying to do is this: I want a TV in a museum to display a jpeg image (with details of the video to follow) and when a button is pushed, a video is played. When the video finishes playing, it goes back to the jpeg.
    I am using mediashow for this. It starts automatically to the JPEG, then for ‘next’ I have set it to ‘input’. I have modified the GPIO.cfg file so that pin 18 is direction ‘in’, falling name ‘button’, and everything else left as is.
    I have placed the GPIO.cfg file into a folder called ‘pp_io_config’ which is in my profile folder.
    I then entered ‘edit show’, and opened the control tab. I added the line ‘button play’.
    I have tested that the button is working with a small python script called ‘buttontest.py’ which confirms it is working fine.
    When I run the show, the JPEG displays as it should, but the button does not trigger the video to play. The down arrow on the keyboard does trigger this, and the video plays as it should.

    Am I on the right track?

    Any guidance would be hugely appreciated, my boss is starting to look at me like I am stupid.

    • KenT says:

      You do not need the play command which plays a child show. Also the trigger should remain at start.
      .In your app it appears all you need is a mediashow with 2 entries and for controls to rotate around the show.
      Set the duration of the image track to 0
      The control in the image track needs to be button down (plays the next track)
      The video track will end naturally and show the image track

      Gapless is the latest and greatest version of Pi Presents,

      • Nick says:

        Hi Ken

        Thank you so much for your reply. However I still can’t make the button work.

        #You do not need the play command which plays a child show.
        OK, I’ve deleted that.

        #Also the trigger should remain at start.
        Do you mean in the “edit show” dialog box? These are my settings: “trigger for start – start”. “Trigger for next – input”. “Next trigger parameters – button”. “Sequence – ordered”. “Track count limit – 0”. “Repeat/Single – Repeat”.

        #In your app it appears all you need is a mediashow with 2 entries and for controls to rotate around the show.
        Yes, that’s how it seems to me also.

        #Set the duration of the image track to 0
        Done.

        #The control in the image track needs to be button down (plays the next track)
        So I select the jpeg image in the medialist, click edit, then click on the control tab. In that field I typed “button down”. Is that what you meant?

        #The video track will end naturally and show the image track.

        Again, it works fine, but only advances from the jpeg to the video when I push the down arrow on the keyboard, not the button.

        What am I missing?
        Imagine you are explaining this to a child.
        Thank you again for your patience.
        Nick

        • KenT says:

          #Also the trigger should remain at start.
          Do you mean in the “edit show” dialog box?
          Yes

          These are my settings: “trigger for start – start”. “Trigger for next – input”. “Next trigger parameters – button”. “Sequence – ordered”. “Track count limit – 0”. “Repeat/Single – Repeat”.
          Trigger for next should be continue so button is not required as a trigger input

          #The control in the image track needs to be button down (plays the next track)
          So I select the jpeg image in the medialist, click edit, then click on the control tab. In that field I typed “button down”. Is that what you meant?

          Yes

          # Again, it works fine, but only advances from the jpeg to the video when I push the down arrow on the keyboard, not the button.

          What am I missing?

          It sounds like you are not using a gpio.cfg file to attach a physical button to the event with the button symbolic name

  3. Fernando Har says:

    Hello Ken,

    Thank you for the great software! I am using this for an Expo in Hong Kong for elderly health care support.

    I am using Pi3, Jessie, gapless version. In my profile, my “start show” is a “radiobuttonShow”. In the radiobuttonshow’s control tab I defined the mapping in which GPIO plays my tracks. (Total three tracks). Each go my tracks are “mediashow”, and each mediashow contains images. Everything goes well, I can start pipresent with my profile, and pressing GPIO buttons jumps to different tracks.

    However, I am having problem trying to make another GPIO button that performs “pp-up” or “pp-down” for moving between images when my mediashow is playing. Is that a limitation to the software or I have misconfigured my profile? Many thanks.

    Fernando Har

    • KenT says:

      Hi
      Its a limitation of a radiobuttonshow.
      In all other types of show input events are passed down to the lowest level subshow.
      However in a radiobuttonshow the above means that during the running of a show track it is not possible to interrupt it and run an alternative track, which is the primary feature of a radiobuttonshow. So in a radiobuttonshow subshows will have no controls.

      You can have one or the other but not both.
      You can change the behaviour in pp_radiobuttonshow to give control to subshows by commenting and uncommenting the lines in

      def handle_input_event(self,symbol):

      around line 136. If you do this you will lose the ability to interrupt the show to select another track during a show.

      I think I need to make the alternatives an option in the profile in the next release.

  4. Thank you for this tutorial. I am trying to use this to set up buttons to change images not videos but I don’t know what syntax to use under Controls. For video he used “play” what do you use for an image? I’ve tried several guesses and when I run Validate I get “error – incorrect number of fields in control”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s