Skip to content

Teku-Guy/RC-Car

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RC-Car

ESP32 RC car system using ESP-NOW for low-latency wireless control. Three-board architecture: TX (joystick controller), RX (car with L298N motor driver), and CYD telemetry display. Features bidirectional heartbeat, FreeRTOS motor watchdog failsafe, long-range PHY mode, expo curves, EMA smoothing, and LEDC PWM with v2/v3 compatibility.

Overview

Board Role Description
TX Transmitter Hand-held joystick controller
RX Receiver Car-side motor driver interface
CYD Telemetry ESP32-2432S028R touchscreen display (in progress)

Features

  • ESP-NOW wireless — sub-millisecond latency, no router required
  • Long-range PHY — 802.11 LR mode for extended range and noise immunity
  • Bidirectional heartbeat — TX and RX LEDs indicate link status in real time
  • FreeRTOS motor watchdog — independent timer kills motors if main loop hangs
  • Multi-layer failsafe — 200ms packet timeout + hardware watchdog + brownout protection
  • Expo curves & EMA smoothing — configurable joystick response and jitter filtering
  • LEDC PWM compatibility — shim layer supports Arduino-ESP32 v2.x and v3.x

Hardware

Components

  • 3x ESP32 dev boards (any generic ESP32-WROOM-32 module)
  • 1x L298N dual H-bridge motor driver
  • 1x Dual-axis analog joystick module
  • 1x ESP32-2432S028R (CYD) for telemetry (optional)
  • 2x DC motors (steering + drive)

Wiring — RX (Car)

L298N Pin ESP32 GPIO Function
IN1 27 Steering direction 1
IN2 26 Steering direction 2
ENA 25 Steering PWM
IN3 33 Drive direction 1
IN4 32 Drive direction 2
ENB 14 Drive PWM

Wiring — TX (Controller)

Component ESP32 GPIO Function
Joystick Y 32 Throttle axis (ADC)
Joystick X 33 Steering axis (ADC)
UART TX 27 Telemetry data to CYD

Getting Started

Prerequisites

  • PlatformIO (CLI or IDE plugin)
  • USB cable for flashing each ESP32

Build & Flash

# Flash the transmitter
pio run -e tx -t upload

# Flash the receiver (car)
pio run -e rx -t upload

# Flash the telemetry display (optional)
pio run -e telemetry -t upload

Serial Monitor

pio device monitor -e tx     # TX debug output
pio device monitor -e rx     # RX debug output

Project Structure

RC_Car/
├── include/
│   ├── rc_protocol.h      # Shared packet definitions & ESP-NOW config
│   ├── tx_config.h        # TX pin assignments & joystick calibration
│   └── rx_config.h        # RX pin assignments & motor tuning
├── src/
│   ├── tx/main.cpp        # Transmitter firmware
│   ├── rx/main.cpp        # Receiver firmware
│   └── telemetry/         # CYD display firmware (in progress)
└── platformio.ini         # Build environments (tx, rx, telemetry)

Configuration

Key parameters are defined in the config headers — no code changes needed for basic tuning:

Parameter File Default Description
ESPNOW_CHANNEL rc_protocol.h 1 Wi-Fi channel (must match all boards)
FAILSAFE_MS rc_protocol.h 200 Motor kill timeout on signal loss
JOY_THROTTLE_EXPO tx_config.h 0.4 Throttle expo curve (0 = linear, 1 = cubic)
JOY_SMOOTHING tx_config.h 0.3 EMA filter factor (0 = none, 1 = max)
STEER_FIXED_DUTY rx_config.h 255 Steering motor power (0-255)
DEADZONE_THROTTLE rx_config.h 80 Throttle deadzone (-1000..+1000 range)

License

This project is licensed under the MIT License — see the LICENSE file for details.

About

ESP32-based RC car system using ESP-NOW for low-latency wireless control with a three-board architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors