Install the Joy Bonnet
The Joy Bonnet is a terrific little board! Originally designed to play video games in emulation, it's actually incredibly useful for adding a small set of controls to embedded projects as well.
Let's install the Joy Bonnet software so that the system can use it. You should already have the Joy Bonnet attached to the Pi Zero -- if not, do so now.
Installation is as simple as entering two lines in the Terminal, but you can read more details here in the Joy Bonnet Learn Guide.
Type this in to your Terminal to load the install script on your system:
cd ~ sudo apt-get install python3-pip sudo pip3 install --upgrade adafruit-python-shell wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/joy-bonnet.py
Then, type this in your Terminal to run the install script:
sudo python3 joy-bonnet.py
then press return, then:
- enter Y to agree to install
- enter Y again to disable overscan, and then enter:
- enter N to not install the GPIO-halt utility
- finally enter Y one last time to continue
Once installation is complete (it takes a few minutes), you'll be asked if you want to reboot. You can go ahead and type Y and press return. Or, you can reboot the system later by entering this in the Terminal:
sudo reboot
Joy Bonnet Button Configuration
Now, we can set up the buttons on the Joy Bonnet to run particular commands for our slideshow by sending keystrokes to feh.
First, let's open the joy-bonnet.py script which contains the key bindings by typing:
sudo nano /boot/joy-bonnet.py
Scroll down to the section that starts with:
KEYES= { # EDIT KEYCODES IN THIS TABLE TO YOUR PREFERENCES:
Then change the key assignments to the following:
BUTTON_A: e.KEY_N, # next image BUTTON_B: e.KEY_P, # previous image BUTTON_X: e.KEY_Z, # unassigned BUTTON_Y: e.KEY_M, # toggle menu SELECT: e.KEY_Q, # quit feh START: e.KEY_H, # pause/continue slideshow PLAYER1: e.KEY_ESC, # escape key to close menus PLAYER2: e.KEY_ENTER, # enter key for menus 1000: e.KEY_UP, # Analog up for menu nav 1001: e.KEY_DOWN, # Analog down for menu nav 1002: e.KEY_LEFT, # Analog left -- menu nav and next image 1003: e.KEY_RIGHT, # Analog right - menu nav and previous image
Once edited, save the file by pressing ctrl-x followed by Y and return.
Reboot the Pi Zero so the changes take effect. Then, try out the Joy Bonnet buttons by opening a Terminal and pressing the buttons to "type" the assigned letters.
Now, let's use them as intended! Run the frame player script by typing this in your Terminal:
bash start-picture-frame.sh
Once the slideshow has begun, try pausing with the Joy Bonnet Start button, and then advancing or going back through the images with the A and B buttons.
Next, let's change the system to portrait orientation.
Page last edited March 08, 2024
Text editor powered by tinymce.