DIY load cell pedals and a flight stick on a Pro Micro
Advanced
Or see every lesson.
- 261parts on the bench
- 31boards running now
- 1.00xreal time, on every board
Sim racers and flight sim pilots are some of the most dedicated hardware builders there are. A set of load cell pedals or a stick and throttle can cost a lot to buy, and the electronics inside are a handful of sensors and a small board. The hard part is not the wiring. It is the calibration, the curves and the deadzones that make the controls feel right, and that part you can work out before you cut any metal.
The circuit above is a pedal set on a Pro Micro in Mokxi: a beam load cell on an HX711 for the brake, a hall sensor for the throttle and a pot for the clutch. Press Run and drag the load on the cell: the Serial Monitor shows the brake in kilograms. A second built-in, the flight stick, has a two-axis stick with a deadzone and an expo curve, a twist rudder, a hall sensor throttle, an eight-way hat and three buttons.
Up front: Mokxi does not simulate the USB connection. Both sketches use the Arduino Joystick library’s API, and in the simulator each report prints as a [Joystick] line instead of reaching the game. The sensors, the math and the report itself run for real. Flash the sketch to a real Pro Micro for USB.
Want the step-by-step version? The lesson "Build load cell pedals" walks through this with checkpoints.
Open the lessonWhy a load cell for the brake
A pot or a hall sensor measures how far a pedal moves. A load cell measures how hard it is pushed, which is how a real brake pedal works: your leg remembers force much better than distance. That is why so many DIY pedal sets put a load cell under the brake and keep position sensors for the throttle and clutch.
A load cell’s whole signal is about a millivolt, far too small for an Arduino pin. The HX711 is a 24-bit converter made for load cells, with its own two-wire output. The example runs it at 80 readings a second rather than the 10 it starts at, since a pedal needs to be quick.
Tare, counts per kilogram and full brake
Three numbers turn counts into a brake. At start-up the sketch averages a few readings with no foot on the pedal and calls that zero, because no load cell reads zero with nothing on it. COUNTS_PER_KG turns counts into kilograms: on your cell, stand a known weight on the pedal, take the reading minus the tare, and divide by the kilograms. BRAKE_MAX_TENTHS is the push that means full brake; a higher number makes a stiffer pedal.
Then comes the feel. BRAKE_CURVE blends a straight line with its square, so the first half of the travel is gentle and the end is sharp. A small deadzone ignores a resting foot, and the report only goes out when an axis moves more than a few counts, so the load cell’s wandering last digit does not flood the PC.
long counts = brakeCell.read() - tare;
long tenths = counts * 10 / COUNTS_PER_KG; // tenths of a kilogram
Joystick.setBrake(brakeAxis(tenths)); // deadzone and curveHall sensor throttle and pot clutch
The throttle is an SS49E linear hall sensor with a magnet on the pedal arm, and the clutch is a 10k pot. Nothing rubs inside a hall sensor, which is why builders like it for a pedal that moves all race. Its output does not run rail to rail and is not a straight line with distance, so the sketch maps two calibrated readings, rest and floor, onto 0 to 1023, with a little dead travel at each end so rest is really zero and the floor is really full.
Trying it in the simulator
Drag the HX711’s load to 20 kilograms and the Serial Monitor prints the brake in kilograms, while the [Joystick] line shows a brake axis well under half: that is the curve at work. Push to 40 kilograms for full brake. Slide the magnet against the hall sensor for full throttle, and turn the knob for the clutch. Then change BRAKE_CURVE to 0 and BRAKE_MAX_TENTHS to a stiffer value, run it again, and compare the numbers before you decide what your own pedal should feel like.
A flight stick with deadzone and expo
The flight stick built-in reads a thumbstick module standing in for a gimbal: a full-size stick reads its two axes the same way, from two pots or two hall sensors. Two numbers shape each axis. DEADZONE treats readings near the center as centered, so a stick that does not spring back to exactly the middle does not drift the aircraft. EXPO curves the response, gentle near the center for small corrections and still full at the edge.
The throttle is a hall sensor with calibration like the pedals, the twist rudder is a pot, and the hat switch is four switches turned into eight directions. Every input goes into one Joystick report with X, Y, rudder and throttle axes, a hat and three buttons. Many DIY sticks use the same library, as the HOTAS builders’ projects show.
From the simulator to the rig
Both sketches keep their numbers in a config block at the top: pins, calibration readings, deadzones, curves and the brake’s force. Change them and run again until the readings make sense, then flash a real board and map the axes in your game.
What Mokxi cannot test is the mechanical side, which is where builds differ most: how the cell is mounted, the springs or elastomers behind the brake, the gimbal’s centering. The electronics and the code are the part you can prove here.
Questions
Which load cell do DIY pedals use?
A beam load cell rated for the force of a hard stop, read by an HX711. The example models a 100 kg cell; set COUNTS_PER_KG from your own cell with a known weight.
Does Mokxi send the pedals to my racing game?
No. The USB connection is not simulated, so each report prints as a [Joystick] line. Flash the sketch to a real Pro Micro and the game sees three pedal axes.
What do deadzone and expo do on a flight stick?
The deadzone ignores small readings around the center so a stick that does not center perfectly does not drift. Expo softens the response near the center and keeps full travel at the edge.
Is there a course?
Yes. Build load cell pedals is three short lessons: the brake on an HX711, the throttle and clutch, and the curve and report.
Keep going
Where the facts on this page come from
Build this for real
Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.