A wireless gear shift sniffer and transmitter for Logitech G29 racing wheel simulation using ESP8266 and ESP-NOW protocol. This project interfaces directly with the G29 shifter hardware, reads analog gear position data, and transmits it wirelessly to display or receiver units.
- Hardware Interface: Direct analog reading from G29 shifter potentiometers
- Wireless Communication: ESP-NOW protocol for low-latency gear data transmission
- SPI Monitoring: Intercepts and decodes SPI communication from shifter
- Gear Mapping: Intelligent mapping of analog values to gear positions (R, N, 1-6)
- Reverse Detection: Special handling for reverse gear with button press detection
- High Precision: 200Hz polling rate for responsive gear detection
- Guaranteed Delivery: Retry mechanism until packet delivery is confirmed
- PlatformIO Compatible: Built for embedded development with PlatformIO
- MCU: ESP8266 (NodeMCU v2 or compatible)
- Shifter: Logitech G29 shifter with analog potentiometers
- Power Supply: 5V power source for ESP8266
- Receiver: ESP8266 device running G29_ShifterReceiver or G29_ShifterDisplay
- Optional: External antenna for improved wireless range
| Component | ESP8266 GPIO | Description |
|---|---|---|
| Analog Input | GPIO A0 | X-axis potentiometer reading |
| Control X | GPIO 13 (D7) | X-axis analog mux control |
| Control Y | GPIO 15 (D8) | Y-axis analog mux control |
| Status LED | GPIO 14 (D5) | Visual feedback indicator |
| Reverse Button | GPIO 4 (D2) | Reverse gear button detection |
| SPI CS | GPIO 5 (D1) | SPI chip select interrupt |
The shifter uses two potentiometers (X and Y axis) multiplexed to a single analog input:
- X-axis: Left-right shifter movement
- Y-axis: Forward-back shifter movement
The shifter communicates via SPI bus:
- CS Pin: Triggers interrupt on SPI communication
- Reverse Detection: Monitors reverse button state via SPI data
- PlatformIO installed
- ESP8266 development board support installed
- Access to G29 shifter internal wiring
- Open Shifter: Disassemble the G29 shifter to access internal wiring
- Identify Connections: Locate the analog potentiometer wires and SPI lines
- Wire Connections: Connect according to the wiring table above
- Update MAC Address: Modify receiver MAC address in
src/main.cpp:uint8_t broadcastAddress[] = {0xBC, 0xFF, 0x4D, 0x18, 0xBB, 0x31};
- Build and Upload:
pio run --target upload
- Monitor Serial Output:
pio device monitor
- Power on both the shifter sniffer and receiver devices
- Move shifter - Analog values are read and mapped to gear positions
- Monitor serial output to verify gear detection and transmission
- Check LED feedback for transmission status
The shifter uses analog voltage levels to determine gear positions:
// Y-axis thresholds
int y_low = 180; // Forward gears threshold
int y_high = 750; // Reverse gears threshold
// X-axis thresholds
int x_low = 310; // Left side threshold
int x_mid = 330; // Center threshold
int x_high = 600; // Right side threshold- Reverse (-1): Y > 750, X position varies, Reverse button pressed
- Neutral (0): Y between 180-750, X in center range
- 1st Gear (1): Y < 180, X on left side
- 2nd Gear (2): Y > 750, X on left side
- 3rd Gear (3): Y > 750, X in center
- 4th Gear (4): Y < 180, X in center
- 5th Gear (5): Y > 750, X on right side
- 6th Gear (6): Y < 180, X on right side
Enable serial monitor to see:
- Raw analog X and Y values
- Calculated gear positions
- SPI communication detection
- Transmission status and confirmations
- Arduino Framework: Core ESP8266 functionality
- ESP8266WiFi: WiFi connectivity for ESP-NOW
- espnow: Wireless peer-to-peer communication
const int8_t analog_pin = A0; // Analog input from mux
const int8_t control_x_pin = D7; // X-axis mux control
const int8_t control_y_pin = D8; // Y-axis mux control
const int8_t status_led_pin = D5; // Status LED output
const int8_t reverse_pin = D2; // Reverse button input
const int8_t CS = D1; // SPI chip select interrupt- Polling Rate: 5ms (200Hz gear detection)
- SPI Debounce: Interrupt-driven for precise timing
- Transmission Retry: Immediate retry until delivery confirmed
- Serial Monitor Speed: 115200 baud
int y_low = 180; // Forward gears threshold
int y_high = 750; // Reverse gears threshold
int x_low = 310; // Left side threshold
int x_mid = 330; // Center threshold
int x_high = 600; // Right side thresholdNo gear detection:
- Verify analog wiring connections (A0, D7, D8)
- Check shifter potentiometer values in serial monitor
- Adjust threshold values if shifter calibration differs
- Test with known voltage sources on analog input
No wireless transmission:
- Verify receiver MAC address is correct
- Check ESP-NOW initialization in serial monitor
- Ensure both devices are on same WiFi channel
- Verify receiver is powered and running compatible code
SPI reverse detection not working:
- Check CS pin interrupt wiring (D1)
- Verify reverse button wiring (D2)
- Monitor serial output for SPI activity
- Test with direct button press detection
Inaccurate gear mapping:
- Fine-tune threshold values for your specific shifter
- Check analog readings for each gear position
- Verify mux control pins are working correctly
- Consider hardware calibration if values drift
Intermittent transmission:
- Check power supply stability
- Verify antenna connections
- Consider adding external antenna for better range
- Monitor serial output for delivery confirmations
Enable serial monitor at 115200 baud to see:
- Raw analog X and Y values (for calibration)
- Gear position calculations
- SPI interrupt detection
- ESP-NOW transmission status
- Error messages from initialization
- Monitor Analog Values: Uncomment
printXY(x,y)in loop() - Record Values: Note X,Y values for each gear position
- Adjust Thresholds: Modify threshold constants to match your shifter
- Test Calibration: Verify correct gear detection for all positions
G29_ShifterSniffer/
├── src/
│ └── main.cpp # Main application code
├── include/ # Header files (empty)
├── test/ # Unit tests (placeholder)
└── platformio.ini # PlatformIO configuration
- Implement automatic calibration routine
- Add support for different shifter models
- Extend gear mapping for sequential shifters
- Add clutch pedal support
- Implement data filtering for stable readings
- Use PlatformIO unit testing framework
- Create mock shifter hardware for testing
- Test with multiple receiver devices
- Verify timing accuracy with oscilloscope
The shifter sniffer interfaces with:
- Analog Multiplexer: Reads X and Y potentiometer values
- SPI Bus: Monitors communication for reverse button state
- Interrupt Handling: CS pin interrupt for precise SPI detection
Transmits gear data via ESP-NOW:
typedef struct struct_message {
int16_t gear; // Gear position: -1=Reverse, 0=Neutral, 1-6=Gears
} struct_message;- Read analog values from both potentiometers
- Apply gear mapping algorithm
- Detect reverse button via SPI monitoring
- Send gear data via ESP-NOW with retry logic
- Update status LED based on transmission success
Reverse gear requires two conditions:
- Position: Shifter in reverse gear slot
- Button: Reverse button pressed (detected via SPI)
The SPI interrupt monitors the chip select line to detect when the reverse button is pressed, providing precise timing for reverse gear detection.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the terms specified in the License file.
- G29_CustomSteeringWheel - Custom steering wheel with display
- G29_Handbrake - Wireless handbrake controller
- G29_ShifterDisplay - Gear shift indicator display
- G29_ShifterReceiver - Wireless shifter receiver
For issues and questions:
- Check the troubleshooting section above
- Verify shifter hardware connections and wiring
- Review serial monitor output for analog values and gear detection
- Ensure proper ESP-NOW initialization
- Check threshold calibration for your specific shifter model
Shifter Disassembly: The G29 shifter requires partial disassembly to access:
- Analog potentiometer connections
- SPI communication lines
- Reverse button detection circuit
Analog Calibration: Each shifter may have slightly different analog ranges. Use the serial monitor to calibrate threshold values for accurate gear detection.
SPI Monitoring: The SPI interface provides precise timing for reverse gear detection but requires careful interrupt handling.
- v1.0.0 - Initial release with basic functionality
- Direct hardware interface to G29 shifter
- Analog gear position detection with custom mapping
- SPI-based reverse gear detection
- Wireless transmission with guaranteed delivery
- High-precision 200Hz polling rate