Tab Stomper prototype 1 (V-USB, Arduino)
2018-02-19Hardware
The entire contraption looks like this: The Arduino Uno (R2) is the brains of the operation, USB is dealt with by my V-USB development board, and the user interface is a janky foot switch. Everything is connected with jumper wires, and there are no additional electronic components, so there's no sense in drawing a circuit.
The Arduino's 5V
and GND
pins are connected to VBUS
and GND
on the V-USB board.
As the Arduino is powered by the circuit, its USB and power connectors are left unplugged.
Digital pins 2, 3, and 4 go to D+
, PU
, and D-
.
The first of these is more or less non-negotiable, because D+
needs to go to INT0
, and that happens to be pin 2.
The V-USB default for D-
is the nearby pin 4, and I've put the pull-up pin between them.
Finally, the switch is connected to digital pin 5 and ground.
When the switch is pressed, it pulls the pin low; when it's not, the internal pull-up resistor drives the pin high.
The foot switch is a reset button from an old computer case mummified in an Altoids tin with electrical tape: The standard motherboard connector on the end of the switch cable is perfect for jumper wires. For best results, the switch is angled to sit perpendicular to the lid: It is crucial to stomp lightly.
Firmware
The firmware is based on Objective Development's V-USB, which makes prototyping low-speed USB devices a breeze. Since the library does all the heavy lifting, the firmware is very straightforward. It can be found on GitHub: https://github.com/0/tab-stomper-vusb. It is licensed under version 3 of the GPL.
The tab will typically not be aligned with the screen, so it's not sufficient to only send PageDown
, as parts of the tab may end up cut off.
To compensate, the firmware immediately sends UpArrow
several times to make the overall displacement slightly less than a screenful.
The implementation is a very simple state machine:
- Wait for the switch to be pressed.
- Press
PageDown
. - Release
PageDown
. - Loop:
- Press
UpArrow
. - Release
UpArrow
.
- Press
- Debounce.