I want to produce a foot pedal to scroll up and scroll down sheet music on a tablet or computer. The majority of commercially available products are page up/page down (as opposed to scrolling) controllers, usually bluetooth connected, and do not seem to be reliable. I envisage the foot pedal would have two momentary foot switches - one for scroll up, one for scroll down, and potentially a third adjustment to control rate of scrolling. I do not want a rotary encoder (ie dismantling a mouse and using the scroll wheel is not a solution). I would prefer USB connection to bluetooth - ideally wireless. I am fairly sure this can be done using arduino and I am reasonably handy - but I have not done any work with arduino before. Any advice or pointers would be most welcome.
I am planning to use standard foot operated momentary switches as used in almost all music pedal effect boards. These are readily available and cheap.
I had considered a larger wheel with a rotary encoder. However the device is intended to e used an stage by musicians - hence both size and noise are potential issues. I could do this easily using a modified mouse but don't think it is a satisfactory solution.
Regarding "not" scrolling. My intention is to use momentary (ie spring to off) foot switches. Hence when the switch is pressed scrolling starts - when release scrolling stops.
Have you written a program for either a tablet or a computer that currently scrolls the sheet music? Once that is done and working, then options to control it can be developed and tested.
Ah, good... "stop" is the normal state.
Perhaps a wheel (on a potentiometer or rotary encoder), poking just above the surface, to adjust speed.
Or this...
Down arrow = 0x51
Up arrow = 0x52
If you can emulate a bluetooth keyboard you can transmit those codes with switches.
BLE HID over GATT is the protocol.
This device is essentially for my own use - I'll be using it with android tablet(s) and a standard .pdf viewer. I know that this can be scrolled up and down using a mouse scroll wheel - as will most software on tablet or computer. There is specialised software that is designed specifically to display sheet music - however I do not wish to go down this route. The majority of commercial foot operated page turners do not do progressive scroll - ie the foot operation triggers a page up or page down - again something I find not very useful.
I would much prefer to use a wireless 2.4GHz connection - the general view seems to be that bluetooth is less reliable and that seems to be my experience. As this device is intended for on stage performances reliability is paramount.
So wireless keyboards don't work on stage? BLE is 2.4 GHz as well.
I've never had a glitch using the BLE wireless keyboard with my iPad. Maybe Android is different.
Wireless keyboards do work on stage. For a slightly different application I have used a wireless numeric keypad which works well. For this application I would like something small, silent and foolproof and think a device made specifically for the task would be the best solution.
If the Nano 33 BLE form factor is small enough for you you should be all set.
Looking at the Nano I am sure you are right. I am based in SE Melbourne Australia - so no Arduino groups particularly close to me. However I am completely new to this - I assume I would need a Nano, a power supply, a wireless dongle (?), and of course the foot switches and case - but I am not too sure where to go from there. Any advice on how to get started?
Basically any device with BLE capability would work. e.g. Pico W, ESP32 family. If you are thinking a dongle would be for BLE capability then you don't need that as it's built into the microcomputer board. Look for an HID keyboard example sketch. Double check the hex codes for the Up/Down arrows because they may be different for Android. Write your sketch to transmit the key codes when a button is pressed.
The only thing is don't want to transmit the Up/Down arrow codes. I want to transmit the signal that would be generated by a mouse scroll wheel (ie number of steps and direction of rotation). The direction would be set by which switch was pressed. I want the signal to continue as long as the switch is pressed. I think this will need programming. The advantage of using the emulated scroll wheel output is that it works for the majority of OS/software combinations.
I would hack into a key board food pedal volume controller...
The ESP32-S2 and S3 reportedly support native USB HID emulation, so presumably one of those could control your tablet with the Mouse.move(0, 0, scrollValue) command.
And with another ESP32 monitoring the foot pedal switches, it could send the switch states to the tablet-controlling ESP via ESP NOW. Or Bluetooth.
I haven't got an Arduino with bluetooth available at the moment, but the following code works on an Arduino Uno R4 Minima connected by a USB cable.
It shows that in principle what you are wanting to do should be possible using a different Arduino with bluetooth.
Tested on an Android Tablet, connected by USB cable.
/*
See: www.arduino.cc/en/Tutorial/BuiltInExamples/KeyboardAndMouseControl
*/
#include "Mouse.h"
// set pin numbers for the two buttons:
const int scrollUp = 2;
const int scrollDown = 5;
// adjust interval to change scroll speed:
int interval = 250;
unsigned long previousMillis = 0;
void setup() {
pinMode(scrollUp, INPUT_PULLUP);
pinMode(scrollDown, INPUT_PULLUP);
Mouse.begin();
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
if (digitalRead(scrollDown) == LOW) {
Mouse.move(0, 0, 1); // scroll downwards one scroll-wheel detent
}
if (digitalRead(scrollUp) == LOW) {
Mouse.move(0, 0, -1); // scroll upwards one scroll-wheel detent
}
previousMillis = previousMillis + interval;
}
}
Thanks for this. I get the general idea. Technically I could use a wired connection as the foot pedal will always be located at the base of the music stand on which the tablet is mounted. I would prefer not to use bluetooth if at all possible.
