Skip to content

ButtonTestingAndCalibration

Colin Sullivan edited this page Mar 8, 2019 · 1 revision

Button Testing and Calibration

To ensure all buttons are working and adjust their sensitivity, we need to edit the code running on the Arduino. The Arduino code is located in arduino/owa_arduino/.

Working Directly on owapi.local

Because the buttons are affixed to the installation, it might be easiest to work directly from the installed RaspberryPI.

There is a script (installed via Ansible) in arduino/upload_arduino.sh that will build and upload the Arduino code. This script must be run each time the owa_arduino/ code is changed. More on that below.

Viewing Button Output

First, edit arduino/owa_arduino/owa_arduino.ino and set the DEBUG = true at the top of the file. Now, notice in the buttonTriggerThresholds list. This is the threshold for each individual button because some piezos are more sensitive than others. This is how to adjust the sensitivity for each button.

There is an npm script test_buttons that will print the debug messages from the Arduino. We need to build & upload the Arduino code (since we just changed it above), but we can do them both at once:

$ source owa_env && npm run upload_arduino && npm run test_buttons

Now the button outputs should be printing. Ctrl-c this script, edit the owa_arduno.ino file to adjust the button sensitivity, then run this script again.