A python script for Raspberry Pi that reads a USB joystick (with pygame) and outputs a PPM signal to RC transmitter (with pigpio).
For the mandatory blinky-blinky, supports VERY FANCY (or so) visualizations for Scroll pHAT.
The input/output-mapping and visualization are highly configurable.
I wanted to try out how it's to fly FPV with a joystick. Project https://github.com/Iezious/rcjoy/wiki did seem very interesting, but I wasn't that thrilled about the low-level, hardware-specific approach; I wanted a simpler and more future-proof solution.
When the Raspberry Pi Zero came out, it seemed like a perfect hardware component for solving the problem. And then with the python libraries, the whole set came together very nicely — with very little code.
-
sudo apt-get install python-pygame git
-
Optional: from https://github.com/pimoroni/scroll-phat:
curl -sS https://get.pimoroni.com/scrollphat | bash
-
git clone https://github.com/jsa/flystick.git
-
Calibrate joystick, see
jscal
. Also the relatedjstest
,jscal-store
, andjscal-restore
. -
Insert to
/etc/rc.local
BEFORE THE LINEexit 0
:pigpiod cd ~pi/flystick python flystick.py & cd -
-
5V → Raspberry Pi
-
Raspberry PPM output → transmitter trainer port
jstest-gtk - joystick testing software sudo pigpiod - enable pigpio demon ./flystick.py - run the code ps aux | grep PROCESS_NAME - for getting process id kill -9 PROCESS_ID - for killing the demon or a process