Introduction: BLE Page Turner 2.0

My dad recently purchased a bluetooth foot pedal enabling him to have his sheet music on a tablet and turning pages with his foot. Very applicable for both sheet music and PDF Lego instructions, which are two ofBoth my favourite pasttimes, and even though I wanted to have one of my own, I was not ready to pay 80€.

I started looking for DIY projects to make my own. Quickly, I stumbled upon an instructable by "Peakecentral" using an Adafruit Bluefruit EZ-Key doing exactly what I wanted. Problem was that Adafruit component is no longer available. I needed something else.

Searching the web I noticed that the ESP8266 successor (ESP32) has BLE support. That's when I decided to go for it. I ordered two ESP32 development boards (ESP-Wroom-32) and started prototyping. The result is the board shown on the next page, along with the circuit diagram.

Supplies

I used the BOM created by Peakecentral, who included a pair button which I used as a reset button. Both power and reset button have built-in LEDs, which i used to indicate whether the button is pressed (e.g. power is ON or a reset is performed:

  • casing, be creative
  • 1 ESP32
  • Arduino IDE with ESP32 board and BLE HID library prepared (tutorial)
  • 1 16mm OD SPST switch, latching, with blue LED (SW2)
  • 1 12mm OD SPST switch, momentary, with red LED (SW1)
  • 2 momentary footswitches (SW3 & SW4)
  • 1 PP3 battery connector
  • 1 PP3 battery
  • 2 1k0 resistors
  • stranded hookup wire
  • rubber tape to prevent sliding

Step 1: Prototyping

I use two momentary footswitches and two switches that have an LED in it. It took me some time figure out how to use the LEDs in the way I wanted. We have two LEDs. One will light up when the ESP32 is at boot, it then turns off and will light up as soon as a bluetooth connection is established. It is connected to IO13. The other LED is connected to het reset button and will light up when the button is pressed. Thus letting you know if the reset button was pressed properly. At first, I wondered why a resistor was connected on the switch, connecting the ground to the button. Therefore, I highlighted a section of the diagram for you to clearly see the connections of the resitor to both LED and ground.

Step 2: Software

With the prototype in place, let's start with the software part of the project. Initially, we want to setup the two buttons for page turning (up-arrow and down-arrow) and a third button for reset. After that, we'd want the led of the powert-button to turn on when de device is powered, than quickly turn it off, and finally turn it on when the device is connected.

I edited the script I googled for examples of the ESP32 HID. The example of https://www.hackster.io/user0448083246/esp32-ble-h... with the gamepad had four buttons ready, even though I only need two. I altered the software slightly to suit my needs. The IDE sketch can be downloaded from this page.

Step 3: Hardware Setup

For this tutorial, I assume you have some soldering skills. Please review the circuit diagram to create a small pcb for easy wiring. I have used PCB with small (3 holes per 'island'), I soldered the wires on the PCB. Finally, the ESP32 was soldered. Remember to use a solid casing that can withstand your foot pounding on it. Also, consider a solution to prevent it from sliding under yout foot.

So far, I have used my pedal on one 9v battery, and it is still going strong.

Good luck! Please leave your notes and comments below.