Files on GitHub at https://github.com/bbsmith24/YamuraLogV6 in the ‘String Pots 3D Print and data sheets’ and ‘ProMini_StringPot’ folders
MORE TO COME!
What’s a String Pot? Why do I need one?
As part of making a data logger for my autocross car, I wanted to log two of the main driver inputs – steering and throttle position. Together with other data like position and speed from a GNSS module, longitudinal and lateral acceleration, brake line pressure, and engine RPM, it’s possible to learn where your strengths and weaknesses are as a driver and go faster.
For measuring linear motion or steering shaft rotation, draw-wire sensors, also known as ‘string pots’, are widely used in robotics, automotive testing, and industrial automation. They’re simple, reliable, and surprisingly precise. Attach the body of the string pot to a fixed point, connect the string to the moving point, and you can measure the changing distance. Wrap the string around a steering shaft, you can measure the rotation of the shaft (of course you can’t attach the string to something that rotates only in 1 direction, or rotates more than the string length).
String pots operate on an elegantly straightforward principle: as a cable extends and retracts, it turns the encoder’s shaft. The encoder returns a position value that can be read by a microcontroller to determine position in real time.

String potentiometer (Amazon)
The downside of using a string pot is the cost – they can cost well over $100 each. If you need to use a string pot but don’t want to spend a fortune on an industrial sensor, a DIY string pot might be the solution. All you need is a spool of string, a spring mechanism, a rotary potentiometer or other encoder, and a 3D printed enclosure.
Preliminary design
Notice that I avoided using the word ‘potentiometer’. This is deliberate – after experimenting with using multi-turn potentiometers as the encoding device, I found there was too much friction in the rotation of the shaft – I needed a bigger return spring and even then sometimes the return spring couldn’t keep up with fast changes in position. A multiturn potentiometer also took up more space than the reel and return spring housing.
After trying to measure the resistance across what I thought was a potentiometer in the factory throttle position sensor in my car, I discovered magnetic rotation encoders. These sensors can output a voltage based on rotation of the encoder shaft, just like a multiturn potentiometer, but don’t require any internal contacts. They use the orientation of a magnet attached to the shaft to measure the shaft angle. They’re small, have none of the internal friction associated with moving a potentiometer wiper across a resistor, and can return a voltage that looks just like a potentiometer. Since there’s no physical resistor, there’s no limit to the number of rotations a magnetic encoder can turn through. And since they have a built-in processor, they can return the position in different formats.
I settled on using the AS5600 magnetic encoder. It supports I2C, and reads the orientation of a magnetic field up to 3mm from the sensor. The angle can be returned as an integer value using I2C or a PWM value on the output pin.
The magnet needs to be within about 3mm of the sensor. Also, the AS5600 I bought included an axial magnet (north on one of the flat sides, south on the other). This type of magnet must be oriented so the flat faces are perpendicular to the sensor. I had more consistent reading with a diametrical magnet (north and south 180 degrees apart across the diameter of the magnet).

My existing logger hardware expects a voltage corresponding to the rotation position. I want to support multiple rotations of the sensor shaft, so I’ll need to do some preprocessing to convert the output voltage to a percent of the total range of rotations. To do all this, I’ll read the raw angle from I2C and use the Arduino Pro Mini to read the position, count the rotations, and use the 12-bit D2A converter to output a voltage corresponding to the percent of total displacement.
Notes on accuracy and precision
Accuracy is how close the reported value is to the actual value – when we pull the string out 100mm, how close is our string pot value to 100mm? If the values range from 99.95mm to 100.05mm, the values are accurate, but maybe not as precise as we want.
Precision in this case is repeatability. When we pull the string to 100mm multiple times, how close the readings are to each other. If every reported value is in the range of 94.99mm to 95.01mm, the measurement is precise but inaccurate.
Ideally, we would like both accuracy and precision. How close we get to both depends on how we use the hardware, and how good the string pot build and assembly is. Excessive clearances between the string reel and the shaft can cause wobble that will decrease repeatability (precision). Reading the magnet position and converting to to a voltage as described below affects accuracy.
The AS5600 returns the RAW_ANGLE value as a 12 bit integer, values from 0 to 4095. The ProMini and D2A converter will also output 4096 steps. For 1 rotation, that’s 0.08 degrees per step. For 10 rotations, 3600 degrees, that’s 0.8 degrees per step. The more rotations you need, the less accurate your results will be.
For 1 rotation of a 20mm diameter spool with 62.8mm linear travel per rotation, each step represents 0.17mm. For 10 revolutions of the same spool, each step represents 1.70mm. When configuring the string pot, a good estimate of the total revolutions of the spool required for the linear travel is important to maintain accuracy.
You can also reduce the number of rotations by increasing the reel diameter (1 or 2 turns to cover the full range instead of 9 or 10). This will improve accuracy for large displacements, but the string pot may become too big to fit in the space available.
The precision of the A2D conversion on the receiving side also matters – if you’re using a device with a 10 bit A2D you now have a range of 0 to 1023 and the displacement per step on a 20mm reel becomes 0.06mm, for 10 revolutions 0.6mm.
Keep the accuracy and precision of your string pot in mind. If you find you need something more accurate and/or precision than you can expect to build, you may need to pay the money to go with a high accuracy and precision industrial string pot.
Fortunately for my application – measuring steering and throttle positions – I don’t need high accuracy, but I do want good precision/repeatability. I’m looking for what the driver is doing, not using the measurements to control the engine speed or the actual position of the front wheels. More throttle or less throttle than before, or a different steering wheel position at a specific point on the course is what I’m interested in. This DIY string pot should provide all the precision/repeatability I need. If the steering wheel is turned 75% of max to the right or 85% of max doesn’t matter as much, as long as this steering position is always logged as 75% right.
Printing the enclosure and assembly
To print the enclosure, you can download the STL files from the GitHub repository and slice them for printing them on your printer. I printed with PETG for stability in warm and humid outdoor conditions, you may be able to use PLA if the string pots are used in a more controlled environment. The tolerances are fairly tight, you may need to use some sandpaper to clean up the surfaces where the shaft goes though the reel, and along the outside edge of the reel (shown in yellow below). Make sure the reel moves freely in the base without excessive play.

Insert threaded inserts into string pot base. Heat them with a soldering iron or insertion tool and press them into the plastic. Drill a hole in the base for the string. My donor badge reel had a small metal grommet for the string, I heated this up with a soldering iron and pushed it into the hole for the string in the base.

Drill a small hole in the reel base and tie a string to the reel base. Insert the retract spring in the reel base as shown, then thread the other end of the string through the hole in the base.

This is the tricky part. Before connecting the retract spring to the shaft, wind the string around the reel base by rotating the reel base clockwise. When the string is fully wrapped around the reel base, use needle nose pliers to add a turn to the retract spring, then push the end of the retract spring into the slot in the shaft. There should be some load on the string when you pull it out a bit. This step may take a few tries.
Place the reel cover on the reel base, and push the magnet into the top of the reel cover.

Attach string pot cover to string pot base.

Pull the string out to test the retraction. If it’s sticky, you may need to disassemble the string pot and do a little more cleanup on the 3D printed parts.
Don’t let the string snap back into the case. It can come off the reel and get lodged between the reel and the body. If this happens, you need to disassemble the string pot and reassemble it to fix the problem
Electronics assembly
After the string pot is assembled and the string pulls and retracts smoothly, you can move on to electronics testing.
Test setup
Solder VCC, GND, SDA, SCL wires to the AS5600 as shown, and clip it onto the string pot cover. The IC should be within 3mm of the magnet in the top of the reel. For testing, I connected servo pins to the other end of the VCC, GND, SDA and SCL wires so I could easily connect them to the breadboard.
On 1 breadboard, connect the Pro Mini, MCP4725 Digital to Analog breakout, and the Serial LCD as shown.

Connect VCC, GND, SDA and SCL from the string pot mag sensor to the Pro Mini breadboard. Download the following code to the Pro Mini (code available from my GitHub). After the code downloads and the ProMini resets, pulling the string will cause the rotation angle to change.
String fully retracted. It’s possible to set the 0 angle to this position; for my use I don’t need to do that.

String partially pulled out. Rotation angle still less then 360 degrees, to rotation count it 0

String pulled out further, angle passed 360 so rotation count increased to 1