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

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

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

This was a quick map and is not fully featured.

On link up/down the onboard Pi Pico LED will light indicating connection

Channel Logical Mapping Joystick Mapping
1 A X
2 E Y
3 T Z
4 R Rx
5 AUX1 (1510-2011) Button 0
6 AUX2 (1510-2011) Button 1
7 AUX3 (1510-2011) Button 2
8 AUX4 (1510-2011) Button 3
9 AUX5 (1510-2011) Button 4
10 AUX6 (1510-2011) Button 5
11 AUX7 (1510-2011) Button 6
12 AUX8 (1510-2011) Button 7
13 Not Used Not Used
14 Not Used Not Used
15 LQ - Not Used Not Used
16 RSSI - Not Used Not Used

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
Tiny 2040 (alt part) https://www.pishop.us/product/tiny-2040/ $10
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 (what I had on hand) https://www.adafruit.com/product/757 $4
Level Shifter (alt part) https://www.aliexpress.com/item/1972789887.html?spm=a2g0o.productlist.0.0.5c50769dtUDJLs&algo_pvid=ac5a3bf0-d505-4a7b-ad5d-90b0f2860eaf&algo_exp_id=ac5a3bf0-d505-4a7b-ad5d-90b0f2860eaf-0&pdp_ext_f=%7B%22sku_id%22%3A%2212000022963323570%22%7D&pdp_pi=-1%3B1.5%3B-1%3B-1%40salePrice%3BUSD%3Bsearch-mainSearch 10 for $3

Approx part cost $22

Wiring

Should be self explanitory, but using GPIO 4/5 (physical pin 6/7) on the pi pico for UART to ELRS RX. UART from pi pico is fed through a level converter to the ELRS RX.

Most other wiring is for HV (5V) and LV (3V) and GND pins.

Future Plans

  • Convert from Arduino IDE to platform.io
  • Add failsafe nopulses / hold
  • design hardware carrier board
  • design enclosure
  • use Tiny 2040 instead of full pi pico
  • TBD other features

Demo Video

ELRS HID Joystick Demo

Prototype Photos

proto pic

Similar Resources

Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485

Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485

ABB Aurora protocol You can refer the complete documentation on my site ABB Aurora PV inverter library for Arduino, esp8266 and esp32 I create this li

Sep 8, 2022

MCP2515 CAN Controller Driver for Arduino

MCP2515 CAN Controller Library for Arduino Compatibility with the ACAN library This library is fully compatible with the Teensy 3.x ACAN library https

Jul 13, 2022

Arduino library for the MCP2515 CAN Controller

MCP2515 CAN Controller Library for Arduino Compatibility with the ACAN library This library is fully compatible with the Teensy 3.x ACAN library https

Oct 1, 2021

Arduino CAN driver for MCP2517FD CAN Controller (in CAN 2.0B mode)

MCP2517FD CAN Controller Library for Arduino (in CAN 2.0B mode) Compatibility with the other ACAN libraries This library is fully compatible with the

Jun 10, 2022

Distribution of Arduino driver for MCP2517FD CAN controller (CANFD mode)

MCP2517FD and MCP2518FD CAN Controller Library for Arduino (in CAN FD mode) Compatibility with the other ACAN libraries This library is fully compatib

Jul 19, 2022

CAN / CANFD Arduino Library for Teensy 4.0

CAN Library for Teensy 4.0 / 4.1 It handles Controller Area Network (CAN) for CAN1, CAN2 and CAN3, and Controller Area Network with Flexible Data (CAN

Sep 20, 2022

Unified interface for selecting hardware or software SPI implementations on Arduino platforms

AceSPI Unified interface for selecting hardware or software SPI implementations on Arduino platforms. The code was initially part of the AceSegment li

Oct 22, 2021

Unified interface for selecting different implementations for communicating with a TM1637 LED controller chip on Arduino platforms

AceTMI Unified interface for communicating with a TM1637 LED controller chip on Arduino platforms. The code was initially part of the AceSegment libra

Feb 2, 2022

Unified interface for selecting different I2C implementations on Arduino platforms

AceWire Wrapper classes that provide a simple, unified interface for different I2C implementations on Arduino platforms. The code was initially part o

Feb 3, 2022
Comments
  • Port to Seeed XIAO RP2040

    Port to Seeed XIAO RP2040

    Added port to Seeed XIAO RP2040 that uses Adafruit TinyUSB.

    Need to install the Seeed XIAO RP2040 board and select the Adafruit TinyUSB stack to build.

Related tags
Arduino Arduino library for the CloudStorage server project. The library provides easy access to server-stored values and operations.

Arduino-CloudStorage Arduino/ESP8266 library that allows you to easly store and retreive data from a remote (cloud) storage in a key/value fashion. Cl

Jan 30, 2022
Arduino library for making an IHC in or output module using an Arduino

Introduction This is an Arduino library for making an IHC in or output module using an Arduino. (IHC controller is a home automation controller made b

Mar 26, 2020
ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT Cloud

ArduinoIoTCloud What? The ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT

Aug 22, 2022
ESP32-S2 and CC1101S 433Mhz usb stick to record and send car gates/garages data keys and open stuff
ESP32-S2 and CC1101S 433Mhz usb stick to record and send car gates/garages data keys and open stuff

HackZeGarage ESP32-S2 and CC1101S 433Mhz usb stick to record and send car gates/garages data keys and open stuff **HackZeGarage @sulfuroid / Dr CADIC

Mar 16, 2022
Arduino Library and code to flash CC2510, CC1110 or other Texas Instruments CCxxx Microcontroller
Arduino Library and code to flash CC2510, CC1110 or other Texas Instruments CCxxx Microcontroller

ESP CC flasher This software brings you the possibility to Read and Write the internal Flash of the Texas Instruments CC 8051 series with an ESP32 usi

Jul 13, 2022
Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames.
Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames.

107-Arduino-MCP2515 Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames. This library is prepared to interface easily

Aug 3, 2022
Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages.
Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages.

107-Arduino-NMEA-Parser Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages. This library

Aug 27, 2022
Arduino library for providing a convenient C++ interface for accessing UAVCAN.
Arduino library for providing a convenient C++ interface for accessing UAVCAN.

107-Arduino-UAVCAN Arduino library for providing a convenient C++ interface for accessing UAVCAN (v1.0-beta) utilizing libcanard. This library works f

Aug 20, 2022
A RESTful environment for Arduino

aREST Overview A simple library that implements a REST API for Arduino & the ESP8266 WiFi chip. It is designed to be universal and currently supports

Sep 18, 2022
Arduino web server library.

aWOT Arduino web server library. Documentation 1. Getting started Hello World Basic routing Application generator Serving static files 2. Guide Routin

Jul 21, 2022