RCduino
Professional Arduino Library for RC Vehicle Development
Library Overview
What is RCduino?
RCduino is a comprehensive Arduino library designed specifically for RC vehicle developers. It provides a complete toolkit for building RC cars, planes, boats, and quadcopters with professional-grade features and safety systems.Motor Control
Advanced DC motor and ESC control with speed regulation and safety features.
Signal Processing
Decode PWM, PPM, and analog signals from RC receivers with automatic failsafe.
Battery Monitoring
Real-time voltage monitoring with low battery warnings and cutoff protection.
Safety Systems
Comprehensive fail-safes including signal loss detection and emergency stops.
IMU Integration
Built-in support for gyroscopes and accelerometers for advanced control.
GPS Support
Optional GPS integration for navigation and telemetry features.
Supported Platforms
- Arduino Uno
- Arduino Nano
- Arduino Mega
- ESP32
- RC Cars
- RC Planes
- RC Quadcopters
- RC Boats
Installation Guide
Requirements
- Arduino IDE 1.8.0 or later
- Servo library (included with Arduino IDE)
- Compatible Arduino board
Method 1: Arduino Library Manager
- Open Arduino IDE
- Go to Sketch → Include Library → Manage Libraries
- Search for "RCduino"
- Click Install
Method 2: Manual Installation
- Download the library files (RCduino.h and RCduino.cpp)
- Create a folder named "RCduino" in your Arduino libraries directory
- Copy the files into the RCduino folder
- Restart Arduino IDE
// Quick test to verify installation
#include <RCduino.h>
RCduino rc(RC_CAR);
void setup() {
Serial.begin(9600);
Serial.println("RCduino Library Version: " + rc.getVersion());
}
void loop() {
// Your code here
}
API Reference
Constructor
RCduino rc(VehicleType type = RC_CAR);
Core Methods
| Method | Description | Parameters |
|---|---|---|
begin() |
Initialize all components | None |
update() |
Main loop update function | None |
setThrottle(int) |
Set motor throttle | -100 to 100 |
setSteering(int) |
Set steering position | -100 to 100 |
emergencyStop() |
Immediately stop all motors | None |
Component Management
| Method | Description |
|---|---|
addMotor(pin, type) |
Add a motor controller |
addServo(pin) |
Add a servo controller |
addReceiver(type) |
Add signal receiver |
addBattery(pin, ratio) |
Add battery monitoring |
Constructor
RCMotor motor(pin, type = BRUSHED_DC);
Key Methods
| Method | Description | Parameters |
|---|---|---|
setSpeed(int) |
Set motor speed | -100 to 100 |
stop() |
Stop motor | None |
brake() |
Active braking | None |
setReverse(bool) |
Reverse direction | true/false |
Constructor
RCServo servo(pin);
Key Methods
| Method | Description | Parameters |
|---|---|---|
setAngle(int) |
Set servo angle | 0-180 degrees |
setMicroseconds(int) |
Direct PWM control | 1000-2000 µs |
center() |
Center servo | None |
setTrim(int) |
Set trim offset | -45 to +45 |
Constructor
RCReceiver receiver(type = PWM_SIGNAL);
Key Methods
| Method | Description |
|---|---|
addChannel(channel, pin) |
Add receiver channel |
getChannelValue(channel) |
Get normalized value (-100 to 100) |
getChannelRaw(channel) |
Get raw PWM/analog value |
isSignalValid() |
Check signal status |
Safety States
enum SafetyState {
SAFE,
SIGNAL_LOST,
BATTERY_LOW_WARNING,
BATTERY_CRITICAL_WARNING,
EMERGENCY_STOP
};
Key Methods
| Method | Description |
|---|---|
triggerEmergencyStop() |
Immediately stop vehicle |
getSafetyState() |
Get current safety state |
setSignalTimeout(ms) |
Set signal loss timeout |
Example Sketches
Simple RC Car Control
#include <RCduino.h>RCduino rc(RC_CAR);
void setup() {
rc.addMotor(9); // Motor on pin 9
rc.addServo(10); // Steering servo on pin 10
rc.addReceiver(PWM_SIGNAL);
rc.addBattery(A0, 2.0); // Battery monitor on A0 with 2:1 divider
rc.begin();
}
void loop() {
rc.update(); // Handle all control automatically
// Manual override example:
// rc.setThrottle(50); // 50% forward
// rc.setSteering(-30); // 30% left
}
Advanced Control with Safety
#include
RCduino rc(RC_CAR);
void setup() {
// Setup components
rc.addMotor(9, BRUSHLESS_ESC); // Brushless motor
rc.addServo(10); // Steering
rc.addServo(11); // Auxiliary servo
// Receiver with 3 channels
rc.addReceiver(PWM_SIGNAL);
rc.getReceiver()->addChannel(0, 2); // Throttle
rc.getReceiver()->addChannel(1, 3); // Steering
rc.getReceiver()->addChannel(2, 4); // Aux
// Safety system
rc.addBattery(A0, 2.0);
rc.addStatus();
rc.begin();
Serial.begin(9600);
}
void loop() {
rc.update();
// Custom behavior based on safety state
if (rc.getSafetyState() == SIGNAL_LOST) {
Serial.println("Signal lost! Stopping vehicle");
}
// Access raw channel values
int auxValue = rc.getReceiver()->getChannelValue(2);
rc.setAuxServo(1, map(auxValue, -100, 100, 0, 180));
}
RC Plane with Multiple Control Surfaces
#include
RCduino rc(RC_PLANE);
void setup() {
// Motors (brushless ESCs)
rc.addMotor(9, BRUSHLESS_ESC); // Main motor
rc.addMotor(10, BRUSHLESS_ESC); // Second motor (for twin-engine)
// Control surfaces
rc.addServo(11); // Ailerons
rc.addServo(12); // Elevator
rc.addServo(13); // Rudder
rc.addServo(A1); // Flaps
// Receiver setup
rc.addReceiver(PPM_SIGNAL);
rc.begin();
}
void loop() {
rc.update();
// Advanced mixing could be implemented here
// Example: Elevon mixing for delta wing planes
}
Wiring Guide
Typical RC Car Wiring Diagram
Figure 1: Basic wiring for an RC car setup
Pin Connection Reference
| Component | Arduino Pin | Notes |
|---|---|---|
| Main Motor | 9 | PWM pin required |
| Steering Servo | 10 | PWM pin required |
| Receiver Channel 1 | 2 | Throttle input |
| Receiver Channel 2 | 3 | Steering input |
| Battery Monitor | A0 | With voltage divider |
Important Wiring Tips
- Use separate power supplies for motors and control circuitry when possible
- Ensure proper voltage dividers for battery monitoring
- Keep wiring neat and secure to prevent interference
- Add capacitors near motors to reduce electrical noise
Interactive Demo
RCduino Virtual Control Panel
Throttle Control
-100%
0%
100%
Steering Control
-100%
0%
100%
System Status
- Motor: Ready
- Receiver: Connected
- Battery: 12.6V (100%)
- Safety: Normal
Actions
Telemetry Output
Troubleshooting
Common Issues and Solutions
- Check power connections to motor controller
- Verify correct pin assignments
- Ensure
begin()was called - Check for emergency stop condition
- Ensure adequate power supply
- Add capacitors near servos
- Check for signal interference
- Verify servo pulse range settings
- Verify correct signal type (PWM/PPM)
- Check channel mapping
- Ensure receiver is powered
- Check for proper signal grounding
Frequently Asked Questions
Yes! RCduino supports standard PWM and PPM signals from most RC transmitters.
You may need to adjust channel mappings and trims to match your specific
transmitter.
The RCduino class provides access to the underlying motor and servo objects.
You can create additional RCMotor and RCServo instances directly if you need
more than the default 4 of each.
Absolutely! When adding a motor, specify
BRUSHLESS_ESC as the motor
type.
The library will automatically handle the proper initialization and control signals
needed for brushless ESCs.
Need More Help?
Visit our community forums or open an issue on our GitHub repository for additional support.