This firmware turns a SparkFun Pro Micro (ATmega32U4) into a USB flight simulator HID for elevator, aileron, rudder, air brakes, and wheel brake (digital), plus a few buttons. Analog axes are read via an ADS1015 I²C ADC to maximize resolution.
- Arduino Joystick Library (Matthew Heironimus) — exposes HID joystick
- SparkFun ADS1015 Arduino Library — external 12‑bit ADC
- Encoder (PJRC) — quadrature encoder for wheel brake
- Wire — built‑in I²C
- EEPROM — built‑in (used for calibration storage)
Libraries referenced in code:
Joystick.h,SparkFun_ADS1015_Arduino_Library.h,Wire.h,EEPROM.h,Encoder.h.
- MCU: SparkFun Pro Micro (5V/16 MHz or 3.3V/8 MHz)
- ADC: SparkFun ADS1015 (I²C)
- Default gain set to
ADS1015_CONFIG_PGA_1to avoid saturation.
- Default gain set to
- Brake: Quadrature encoder (CLK/DT)
- Buttons: Joystick pushbutton (active‑LOW), Brake button, Release switch
This is best accomplished using the sparkfun qwic connector.
| ADS1015 | Pro Micro | Notes |
|---|---|---|
| VCC | VCC (3.3 V or 5 V)* | Match board voltage |
| GND | GND | Common ground |
| SDA | SDA (labeled) | I²C data |
| SCL | SCL (labeled) | I²C clock |
* The ADS1015 accepts 2–5.5 V; use the same voltage as your sensors/pots.
Analog axes are read from the ADS1015 single‑ended channels:
| Function | Code Symbol | ADS1015 Channel | Notes |
|---|---|---|---|
| Elevator (Pitch) | elevatorPinADC |
A0 (0) | Hall Effect Sensor → A0, other ends to VCC/GND |
| Aileron (Roll) | aileronPinADC |
A1 (1) | Hall Effect Sensor → A1 |
| Rudder (Yaw) | RUDDER_ADC_PIN |
A2 (2) | Hall Effect Sensor → A2 |
Digital inputs on the Pro Micro:
| Function | Code Symbol | Pro Micro Pin | Mode | Active Level |
|---|---|---|---|---|
| Joystick Button | JOYSTICK_BTN_PIN |
D4 | INPUT_PULLUP |
LOW |
| Towhook Release | RELEASE_PIN |
D8 | INPUT_PULLUP |
LOW |
| Wheel Brake | BRAKE_BTN_PIN |
D9 | INPUT |
External pull‑up/down required |
| Air Brake Encoder CLK | BRAKE_CLK_PIN |
D0 | — | Quadrature A |
| Air Brake Encoder DT | BRAKE_DT_PIN |
D1 | — | Quadrature B |
| (Optional LED) | JOYSTICK_LED_PIN |
D5 | — | Defined, not used in code |
Note: D0/D1 are also hardware Serial (RX/TX) on the 32U4. The sketch uses
Serial, so avoid connecting external serial devices on these pins during normal operation.
elevatorPin A0, aileronPin A1, and rudderPin A2 are defined but not used; the sketch reads ADS1015 channels instead.
- USB HID joystick with Pitch, Roll, Rudder, Throttle/Brake and buttons
- On‑device calibration, persisted to EEPROM
- Adjustable encoder‑based brake input
- Hold the Joystick Button (D4) while powering or resetting.
- Move Roll/Pitch/Rudder to max positions when prompted (serial output).
- Move them to min positions when prompted.
- Release the button to save to EEPROM and start normal operation.
EEPROM addresses used (32‑bit ints each):
Roll: ADDR_ROLL_MAX=0, ADDR_ROLL_MIN=4 • Pitch: 8/12 • Rudder: 16/20 • Brake: 24/28.
- Install the required libraries (above) via Library Manager or from GitHub.
- Board: SparkFun Pro Micro (ATmega32U4). Select correct voltage/clock.
- Compile & upload the provided
glider-controls.ino. - Verify in Windows/Mac game controller panel that axes/buttons respond.
#define JOYSTICK_BTN_PIN 4
#define JOYSTICK_LED_PIN 5 // defined, not used
#define RELEASE_PIN 8
#define BRAKE_BTN_PIN 9
#define BRAKE_CLK_PIN 0
#define BRAKE_DT_PIN 1
// ADS1015 channels
#define elevatorPinADC 0 // A0
#define aileronPinADC 1 // A1
#define RUDDER_ADC_PIN 2 // A2
- No axis movement: Check ADS1015 power and I²C (SDA/SCL continuity). Ensure pots are wired as voltage dividers.
- Axis saturates/clips: Confirm gain = 1 in ADS1015 setup and sensor voltage matches VCC.
- Encoder erratic: Keep short, shielded wires; avoid using D0/D1 for other peripherals.
- Implement automatic calibration
- Set max/min a narrow band
- User starts every session by doing a full deflection on all flight controls
- Add Carb Heat/Throttle/Mix/Pitch functions
- Add Back button stick via i2c
- Add Flaps
Author: Rich Mayfield
Target Board: SparkFun Pro Micro