Maker tech hub — AI · 3D print · Pi · ESP32 · plus the classic tech archive.

Free ESP32 kit · Books · Network Ninja · Archive

Classic tech archive. From the original averyjparker.com tech blog — historical context; pair with modern guides where noted. Full archive · Maker projects · Network Ninja

Classic tip · Linux

Joystick calibration under linux

I don't know off the top of my head of a graphical joystick calibrator for linux, but there is a command line utility that's dead easy to use.... jscal I found the tip in a flightgear mailing list af…

Written by

Avery J. Parker

IT veteran, maker educator, and author of Network Ninja, 3D Printing Mastery, and AI Workflow Mastery. Business IT: Diversified Tech Solutions.

I don't know off the top of my head of a graphical joystick calibrator for linux, but there is a command line utility that's dead easy to use.... jscal I found the tip in a flightgear mailing list after having a hard time with one of the first flights. The stick was very far off center, I had to pull almost all the way to the right to keep level. Anyway... here's the tip.


Joysticks are calibrated at the kernel level. So, for instance, a program like flightgear looks at the device and doesn't have a means for adjusting the data to correct for centering. It just assumes what it sees is accurate. So, here's how to calibrate.

jscal -c /dev/js0

This will have you move the 0-axis to it's minimum, center, maximum, then axis-1, etc. etc. etc. The only trick can be guessing which axis you need to use if you have more than 2. The other point to mention here is that if there are more axis' detected than you have it's ok. Just follow the instructions and if there's no change on an axis, keep pressing a button to move through. It's really fairly easy to use.

But what happens after a reboot? You lose the calibration... UNLESS.... you do this.

jscal -p /dev/js0 > calibrate-stick.sh

Which prints out your calibration information to a file, then after the next boot. (Maybe in a login script?)

sh calibrate-stick.sh

the above will "recalibrate" based on the settings that you've just assigned.

Some distros may deal with this, I suspect there may be GUI frontends for this, but it was the quickest route I had to getting to fly straight and level.