Skip to content

Arduino code that runs on a Pi Pico (2040) to emulate a USB HID Joystick

License

Notifications You must be signed in to change notification settings

countofkrakow/CRSFJoystick

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRSFJoystick

Arduino code using the mbed core that runs on a Pi Pico (2040) to emulate a USB HID Joystick

Pirmarily developed to use and ExpressLRS receiver and a HID Joystick for Sim use!

Shout out to CapnBry for the Crsf Library

https://github.com/CapnBry/CRServoF

Shout out to RealRobots.net for the Gamepad Library

https://gitlab.com/realrobots/PicoGamepad/-/tree/master

Purchase

Hand built boards can be purchased from my page on FPVExchange

Compatability

This project was designed primarily with ELRS usage in mind, however this code base has also been tested with TBS Crossfire Receivers (915MHZ) (last tested v6.16) and TBS Tracer Receivers (2.4GHz) (last tested v6.17) and both appear to work! Flight was teseted in the Liftoff simulator.

I no longer have TBS Crossfire nor TBS Tracer TX modules or Receivers so future tests will have to be conducted by others.

Crossfire

Crossfire

Tracer

Tracer

Usage

Tested with arduino-1.8.19.

Go to Boards manager and install 'Arduino Mbed OS RP2040 Boards' package. I'm using version 2.6.1 currently.

Update the arduino ide preferences to point to the Sketchbook folder contained by this repo. Libraries and examples are already included.

Compile and upload.

On first upload to the pico, you will need to hold in the bootsel buttion before plugging it into the computer. This should only have to be done once and subsequent uppdates can be done automatically by the ide.

Once uploaded, the device should be recgonzed by your computer as a HID Joystick.

Mappings

#Channel mappings

(Mode2)

TX12 Channel PC Info
X CH1 X Ail (Analog)
Y CH2 Y Ele (Analog)
Z CH3 Z Thr (Analog)
Xr CH4 Xr Rud (Analog)
S1 CH6 Yr slider1 (Analog)
S2 CH7 Zr slider2 (Analog)
SA CH8 B1 2 states
SB CH9 SB 3 states
SC CH10 SC 3 states
SD CH11 B2 2 states
SE CH5 B3 2 states
SF CH12 B4 2 states

Installation

  • copy Sketchbook directory to your PC
  • Open sketchbook/crsf_Joystick with Arduino IDE
  • Change the directory in file->preferences to the sketchbook directory
  • Make sure the Squid Stick in connected to USB
  • Change the port to the Squid com port
  • Compile and upload

Configuration

  • Define the channels as in the table above
  • If needed , open "Set up USB game controllers" in windows to test and calibrate

Note additional button mappings can be created in caliration.h

Hardware

Part Link Approx Cost
Pi Pico https://www.pishop.us/product/raspberry-pi-pico/ $4 (Approx $6 with shipping)
Tiny 2040 (alt part) https://www.pishop.us/product/tiny-2040/ $10 (Approx $12 with shipping)
ELRS RX (any will do) https://www.racedayquads.com/products/happymodel-2-4ghz-ep1-rx-express-lrs-receiver?_pos=1&_sid=c7214d987&_ss=r $13.50
Level Shifter (Used for prototype boards) https://www.amazon.com/dp/B07F7W91LC?psc=1&ref=ppx_yo2_dt_b_product_details 10 for $7.50 ($0.75 ea)

Approx part cost for pico hardware (large footprint, cheaper) - $20-$25

  • Pi Pico - $4.00
  • ELRS RX - $13.50
  • Level Shifter - $0.75
  • Carrier Board - $1.00 (approx)
  • Shipping / Tax from vendors - varies

Approx part cost for tiny2040 hardware (much smaller footprint) - $25-$30

  • Tiny2040 - $10.00
  • ELRS RX - $13.50
  • Level Shifter - $0.75
  • Carrier Board - $1.00 (approx)
  • Shipping / Tax from vendors - varies

Carrier Boards (Tiny Version)

Hardware build files are located in hardware/kicad/CRSFJoystick/output/Rev1.0

I used JLCPCB with Black Soldermask and a board thickness of 1.6mm.

R1.0 Build Photo

Note the different orientation of the ELRS RX's. The orientation can be flipped. I installed each RX to ensure the boot pad is exposed should the RX need recovered.

Tiny2040

Tiny2040 Level shifter orientation

Tiny2040 Build Front

Tiny2040 Build Back

Tiny2040 Dimensions

Raspberry Pi Pico (Full Version)

Pico level shifter orientation

Pico Build Front

Pico Build Back

Pi Pico Dimensions

SEEED AXIO 2040

Board files now in the hardware folder. Not built or tested but should work.

SEEED XAIO RP2040 Dimensions

SEEED XAIO RP2040 Board

Waveshare RP2040-Zero

First batch on order!

WaveShare RP2040-Zero BoardDimensions

WaveShare RP2040-Zero Board

WaveShare RP2040 Case lower

WaveShare RP2040 Case Upper

WaveShare RP2040 Case assembled

CRSFJoystick2.0

Build a smaller pico by yourself.

CRSFJoystick2.3 Board Front

CRSFJoystick2.3 Board Back

CRSFJoystick2.3 Render Front

CRSFJoystick2.3 Render Back

General Assembly

  • Print the top and bottom enclosure
  • Print 2 of the spacers for the Pi2040, Print 4 of the spacers for the Pi Pico version
  • Follow the directions in this video https://youtu.be/Zuhfbobgm5A

Future Plans

  • Convert from Arduino IDE to platform.io
  • Add failsafe nopulses / hold
  • Add cases for SEEED XAIO RP2040 Board
  • Add cases for Waveshare RP2040-Zero Board
  • FPVExchange Links for BYORx versions

Demo Video

ELRS HID Joystick Demo

About

Arduino code that runs on a Pi Pico (2040) to emulate a USB HID Joystick

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 86.1%
  • C++ 12.0%
  • C 1.9%