Head nod controlled page turner for PDF scores

Using the Raspberry Pi plugged into an external monitor, PiShield and one or two simple sensors, we can build an automatic page tuner for playing music.

Before delving into the details, here’s a short demonstration of the system in action:

Technical details and setup instructions.

Components Used:

  • Raspberry Pi 3 connected to monitor via HDMI, running GUI system (the XPDF renderer only works in the desktop environment)
  • PiShield, and ReachClose sensor. (any analog InfraRed distance sensor could work as well)
  • A Touch pressure sensor is also used for back turns, although this is not necessary or you could use any simple input button. (You could also use a second ReachClose sensor and map a different movement as well!)

The following photo shows the basic setup with the Pi+PiShield connected to HDMI, and a single sensor plugged into the PiShield

Software Setup:

  • In this example we’re using the desktop environment with the IDLE Python IDE.
  • XPDF (preinstalled in the Raspbian desktop environment) is used to display the PDF sheet music. In this software, ‘b’ and ‘n’ keyboard presses triggers the previous and next page commands, respectively. So our sensor script only
  • The Python code makes use of keyboard emulation, similar to the minecraft example with some modifications.
  • The script is available in the our Python examples repo (recently updated, so if you’re using our system image, its not yet available.). You can access just the script itself directly here.

And that’s it! You may want to tweak the threshold values to work with your particular setup and head movements. For convenience the script will print out the sensor values in the console so you can tune it to match your use case.

 

Leave a Reply