A joystick is a stick that tilts on two independent axes (forward and back, left and right), reads two angles and returns to center on its own when you let go. Designing one comes down to four decisions: how you mount the two axes, where the sensors go, what brings the stick back to center and where it stops. The usual travel, commercial thumbsticks included, is around ±20–25° each way. Throughout, θ is the stick's angle from vertical, which is its rest position.
Nested gimbal or crossed bails
Nested gimbal. The stick pivots on an inner axis mounted in a ring, and the ring pivots in the frame on an axis at 90° to the first. That is two pairs of pins, and every force passes through the ring. It is easy to print and comes out stiff.
Crossed slotted bails. Two arched bails, each with its axis supported in the frame and the two axes at 90°. The stick passes through both slots and pivots at the center on its own ball or pin. Each bail turns only with the component of the tilt in its own plane. This is the layout of almost every analog thumbstick and of many desktop joysticks.
The difference that matters is in the sensors. In the nested gimbal the inner axis is mounted in the ring, which moves: a sensor on that axis rides with it and its wires flex on every tilt. With bails, both reading axes stay fixed to the frame.
On the diagonals, the two layouts do not measure the same thing. The ring axis measures what the equivalent bail measures: the projection of the tilt onto its plane. The inner gimbal axis does not measure a projection but the stick's angle from the plane of the ring, which on the diagonal is slightly smaller. With the ring turned 25° and the stick at 25° to the ring, the equivalent bail would read 27.2° where the inner axis reads 25°. A per-axis center-and-endpoint calibration does not remove that difference, because it depends on both axes at once; a two-dimensional mapping in the firmware corrects it, or you live with it: it is 2°.

A print-in-place gimbal is fine for a toy, but its clearance of 0.3 mm per side (0.6 mm on diameter) leaves a lot of play at the tip, as worked out below. For an input device, print the parts separately and join them with pins. If you still want it printed in place, see Print-in-place pins and hinges.
Where the sensors go
Mount a potentiometer coaxial with each axis: the body screwed to the frame and its shaft keyed into the end of the bail or ring with a D-shaped socket. With bails, both potentiometers sit in the frame. With the nested gimbal, the ring's sits in the frame and the stick's rides in the ring: that one needs a slack wire loop, or you switch to bails.
Never use the potentiometer as a bearing: support each bail or ring on its own pins at both ends and let the potentiometer shaft carry torque and nothing else. If the potentiometer takes the side load from the spring and the hand, its wiper and bushing wear, and that axis feels stiffer than the other.
With potentiometers, the number of counts is not the problem. A panel pot has around 270–300° of electrical travel (check the datasheet for yours). A ±25° travel takes 50/270, or 18 %, of it: about 760 counts on a 12-bit analog-to-digital converter, 0.066° per count. That is finer than you need. What limits you is wiper and converter noise, which makes the reading jitter by several counts, track non-linearity, and wear, which makes both worse with use.
A magnetic angle sensor has no wiper, so it neither wears nor drifts the way a potentiometer does (that is why many console controllers now use them). Mount a diametrically magnetized magnet on the end of the shaft, facing a sensor such as the AS5600: 12 bits per turn, a typical air gap of 0.5–3 mm and a maximum magnet-to-sensor eccentricity of 0.25 mm with a Ø6 magnet. Its output range can be programmed below one turn (down to 18°, according to its datasheet), and the 12-bit output is spread over that range. That is scaling, not new resolution: the internal angle still measures 360° in 4096 steps, about 570 over your 50°, and without wiper noise that is plenty. Another option is a single magnet on the bottom end of the stick over a 3D Hall sensor that reads both axes at once. Then you do not need a sensor per axis: the gimbal or the bails only hold and center the stick.
The magnet changes the mechanics. Its 0.25 mm centering tolerance is tighter than the play of a printed pin, so the magnet's shaft has to turn in a precise bearing: a ball bearing or a reamed hole, not a loose printed pin. Pocketing and gluing the magnet is covered in Embedding magnets and nuts mid-print. Keep steel screws away from the magnet and the sensor.
Pivot clearance shows at the tip
A pin with diametral clearance c in its hole lets the axis tilt by an angle φ ≈ c/S, where S is the span between supports: the length that guides the pin, not its diameter. If that axis carries the stick, the tip moves φ·L, with L the distance from the pivot to the tip.
With a sliding fit, c = 0.4 mm on diameter (0.2 mm per side). A pin guided by a single 5 mm lug tilts 0.08 rad, 4.6°: 4 mm at the tip of a 50 mm stick. The same pin supported in two lugs 24 mm apart tilts 0.017 rad, 1°: 0.8 mm at the tip. Spread the supports as far apart as you can.
The play on the two axes does not add. Each axis tilts about its own direction, so the tip wanders inside a small square: on the diagonal it reaches √2 times the play of one axis, not twice. That is why you tune each axis on its own. How play accumulates along a chain of joints is in Clearances for moving parts.
This applies unchanged to both axes of the nested gimbal and to the central pivot of a bail stick, if that pivot is a pin. With bails, the stick is located by that central pivot: the tilt of a bail's pin moves the slot, not the tip, and barely changes the reading. What does matter is a different clearance, the stick's clearance in the slot (slot width minus stick diameter), c_r. While the stick takes up that gap, the bail does not turn and the reading does not move: a hysteresis of c_r/h_r, with h_r the height of the slot above the pivot. With 0.4 mm at 12 mm from the pivot, that is 1.9° in total. You reduce it with a tighter slot, a higher slot or a sliding block in the slot.
To take the play out of the pivots: a ground steel dowel or a shoulder screw in a reamed or drilled-out hole, or small bearings (683: 3×7×2; MR63: 3×6×2; 693: 3×8×3) seated as described in Seating bearings and bushings, with the dimensions from Standard bearings and bushings. Take out axial play with shim washers. Clearance values per machine are in Real printed clearances, and why the hole comes out smaller than the model, in Why holes print small.
Print the ring lying flat. That way both its axes are horizontal and both pairs of holes come out the same, slightly oval at the top. Even so, do not trust printed roundness for a pivot: drill the hole out and fit a steel pin, or give it a bearing seat. The ring is a frame loaded in bending, so its arms must lie in the layer plane (Layer orientation for mechanisms). Lying flat on the bed, they already do. The same goes for the bails: flat, with the arch in the layer plane.
The return to center
The problem is friction. Any spring whose torque is zero at center (a column, four springs, a flexure, a rubber boot) leaves a dead band: as long as the spring torque, k_θ·θ, is smaller than the friction torque in the pivots, T_f, the stick does not move. It stops anywhere up to θ_dead = T_f/k_θ on either side, not at center. And there is always friction, because the spring force itself loads the pins: T_f = μ·F·r_pin.
Commercial joysticks solve this with a preloaded flat plate. A spring pushes a washer or cup upwards against a flat disc of radius a, fixed to the stick at a distance d below the pivot. Centered, the plate touches the whole disc and the torques cancel. As soon as you tilt the stick, however slightly, the plate bears on a single edge and the restoring torque jumps to:
T = F·(a·cos θ − d·sin θ)
The stick returns exactly to center as long as F·a > T_f. On tilting, the plate drops a·sin θ − d·(1 − cos θ), the spring compresses and F rises. The distance d subtracts from the lever arm: the return vanishes when d = a/tan θ. Put the disc as close to the pivot as you can, and in any case keep d well below a/tan θ_max. The edge also slides on the plate and adds friction with an arm of ≈ d: another reason to keep d small compared with a.
Use a steel compression spring guided in a bore (Using bought steel springs; its rate is worked out in Coil springs) and check that it does not go solid with the stick at its stop. With closed, ground ends and guided, it does not buckle while L0/D < 5.26. The disc edge slides on the plate on every tilt: put a steel washer on that face or grease it (Friction and wear).

A printed spring does not solve it. A flexure gimbal (Flexure pivots, Sizing a flexure as a pivot) centers without friction, but has no preload: it keeps whatever dead band its hysteresis gives it, which is small as long as the stick does not also bear on pins. If it does, the T_f/k_θ dead band comes back. And if you leave the stick tilted for a long time, the flexure creeps (Creep and fatigue); centered, it is unloaded and does not creep. A TPU boot (TPU and flexible filaments, Accordion bellows) seals and helps, but it is still another spring with zero torque at center. And an elastic column that buckles picks a side and leaves the center unstable; if you use one with the plate, keep it from carrying axial load.
You can also center each bail on its own, with a spring or a detent on each, and give each axis a different feel. The center is well defined if each spring is preloaded against a stop: the same principle as the plate. For a detent at center only, see Ball and spring detents.
End stops and maximum angle
With a circular stop, the stick shaft (radius r_s) hits a round hole in the cover (radius r_a) at a height h above the pivot: tan θ_max = (r_a − r_s)/h. The stick stops at the same angle in every direction. On the diagonal, each axis reaches atan(tan 25°/√2) ≈ 18°, so the readings trace a circle and the firmware corrects them with a radial dead zone and, if needed, a circle-to-square conversion. With a square stop, the stick tilts atan(√2·tan 25°) ≈ 33° in the corners and each axis still reads 25°: the sensors see no more angle, but the mechanics do. Check that nothing collides at 33°, neither the bails or ring against the frame nor the stick against the cover.
At the stop, the force is multiplied: the hand pushes at distance L and the stop holds at height h, so F_stop = F_hand·L/h. A 20 N push at 50 mm against a cover 10 mm from the pivot loads the stop with 100 N, and the reaction goes into the pins. Place the stop as high as the design allows. Make its edge a full ring in the layer plane: with the cover printed flat, the hole comes out round and the load runs along the beads. The hand's load must never end up on the internal stop of a potentiometer or a sensor.
The stick has to reach the stop before the potentiometer's mechanical limit, and a sensor that saturates before the stop wastes travel. Set θ_max 1–2° above the calibrated range.

Worked example: a 50 mm stick at ±25°
The brief: a handheld or desktop stick, L = 50 mm from the pivot to the center of the knob, a circular stop at ±25°, crossed bails with the sensors in the frame and a gentle 1 N return at the knob as soon as it leaves center.
Return. T0 = 1 N × 0.050 m = 0.05 N·m. With a disc of radius a = 8 mm at d = 4 mm below the pivot, the preload is F0 = 0.05/0.008 ≈ 6.3 N. The return would vanish at d = 8/tan 25° = 17 mm, so there is margin. With a 0.8 N/mm spring, at 25° the plate drops 8·sin 25° − 4·(1 − cos 25°) = 3.0 mm and F rises to 8.7 N. The arm is 8·cos 25° − 4·sin 25° = 5.6 mm, so T = 0.048 N·m: 0.96 N at the knob. The feel is almost constant. If you want a force that grows with angle, use a stiffer spring with less preload.
Friction. A Ø3 steel central pin (r = 1.5 mm) in a printed hole, μ = 0.25: T_f = 0.25 × 6.3 × 0.0015 ≈ 0.0024 N·m, 5 % of T0. The stick returns to center. Compare it with a linear spring that gave the same 0.048 N·m at 25°, with the same friction: k_θ = 0.048/0.436 = 0.11 N·m/rad, and the dead band comes out at 0.0024/0.11 = 0.021 rad, 1.2° each side. That is 5 % of the travel, which the firmware dead zone would have to cover.
Play. The central pivot with supports 24 mm apart and a sliding fit (c = 0.4 mm) tilts about 1°: 0.8 mm at the knob. With 683 bearings, it drops below what you can feel by hand. The bail slots, at h_r = 12 mm from the pivot with 0.4 mm of clearance, add 1.9° of hysteresis to the reading; tightening them to 0.2 mm brings it down to 1°.
Stop. A Ø8 shaft at cover height (r_s = 4 mm) and the cover at h = 20 mm from the pivot, above the bails: r_a = 4 + 20·tan 25° = 13.3 mm, a Ø26.7 hole. A 20 N push loads the stop with 50 N. With the cover at 10 mm it would be 100 N.
Sensors. With potentiometers, ±25° gives about 760 counts at 12 bits, and what you will see jittering is noise. With a magnetic sensor, about 570 real steps with no wiper to wear. Calibrate the center with the joystick assembled; do not trust the angle in the model.
When it fails
| Symptom | Cause | Fix |
|---|---|---|
| It stops slightly off center and the reading changes every time you let go | Spring with zero torque at center plus friction in the pivots: dead band | Preloaded flat plate, smaller-radius pin, bearings and a firmware dead zone at least as wide as the measured spread |
| The stick wobbles and the tip shakes | Short span between supports (φ ≈ c/S) | Spread the supports, steel pins in reamed holes, bearings; take out axial play with shims |
| The reading does not change when you start moving it or reverse direction | Stick clearance in the bail slot (c_r/h_r) | Tighter or higher slot, or a sliding block in the slot |
| Click or step when crossing center, feel differs by direction | Disc not flat, or plate rocking on an elephant's foot | Print the disc with that face up or add a steel washer; chamfer the bed edge (The face on the bed) |
| Weak return that fades toward the stop | Disc too far from the pivot: the arm a·cos θ − d·sin θ approaches zero | Disc closer to the pivot or of larger radius |
| One axis stiffer than the other | The potentiometer acts as a bearing, or its body is misaligned | Support the bail on its own pins and let the potentiometer shaft carry torque only |
| Noisy or jumpy reading | Noisy or worn wiper | Magnetic sensor; filtering in the firmware |
| The stop cracks or the pins bend at the extremes | F_hand·L/h on a low stop | Raise the stop, make it a full ring in the layer plane, steel pins |
| The diagonals do not reach full scale | Circular stop | Firmware correction, or a square stop |
| The center drifts over the weeks with a printed spring | Creep from leaving the stick tilted | Steel spring, or leave the stick centered |
How to test it
Measure the force at the knob with a digital luggage scale or a kitchen scale, at 1°, 10° and 25°, in four directions. If the force is already non-zero at 1°, there is preload; if it is close to zero, the spring is linear. The general method is in Testing a mechanism before you trust it.
For return repeatability, take the stick to the stop and release it 20 times in each of 8 directions, noting the center reading. That spread, plus a margin, is your firmware dead zone.
Measure play by holding the stick centered and pushing sideways at the knob: watch how much the sensor reading changes, or measure the tip's movement against a fixed pointer.
To check durability, run a few thousand stop-to-stop cycles with a simple crank and repeat the three measurements. The first sign of wear is a growing center spread.
See also
- Universal joint: the same two crossed axes, transmitting rotation between two shafts at an angle.
- Ball joints: a free joint on three axes.
- Spring-return trigger: the trigger with its own return, if the stick carries one.
- Snap domes: the click when you press the stick down.
