Series: alt.ctrl activities; builds on Gametrak
Comparable three-axis position sensing is easy to build from readily available string potentiometers and joysticks. A string potentiometer (string pot) measures how far its cable is pulled out; passing the cable through a joystick's knob, as the Gametrak does, adds the cable's two angles.
| Item | Amazon | Adafruit | SparkFun | Digi-Key |
|---|---|---|---|---|
| String potentiometers, from makers such as Celesco or Penny and Giles. The links are to Celesco's SP series, sold by TE Connectivity Measurement Specialties (SP1, SP2), with measuring ranges up to 50 inches | SP series | |||
| Analog joysticks | 512 | COM-09032 | ||
| A microcontroller (MCU) with analog inputs |
A prompt to give a coding assistant, to start the code for this activity. Copy the box, answer its questions about your board and pins, and test what comes back on the bench before you rely on it.
I am building "Build a Tether Sensor from String Pots and Joysticks", the activity at https://adrianfreed.com/tether-sensor-string-pots.html.
Write a program for a microcontroller that reads tether sensors, each made from a string potentiometer, which measures how far its cable is pulled out, and an analog joystick that the cable passes through, which measures the cable's two angles: three analog inputs for each sensor.
Calibrate each axis's range, and send the readings as OSC messages with an address for each axis, such as /left/x, as a Gametrak's readings are named, so that the same software can read either.
Libraries to explore:
Before writing anything, ask me what I am using: the board and its pins, or the software (such as Max, Pd or Python), and check its documentation for what this needs. Put the pin numbers, ranges and other settings in one block at the top, each with a comment. Say which of the libraries above you use, and why. Start with a test that shows the raw readings, so that I can check the wiring and the ranges before the rest.
This activity by Adrian Freed is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0): you may share and adapt it with attribution, for non-commercial purposes such as personal projects and teaching, and you must share adaptations under the same licence. Product names and links belong to their suppliers.