To resolve asymmetric detent mapping (e.g., left stick reaches 1500โ2000 in only 2 detents, right stick in ~3.1 detents), use test_RC/test_RC.ino:
- Purpose: Interrupt-based PWM capture on pins
2(Right) and3(Left). Prints per-channelraw(last/min/max) and per-channel calibratednorm(normalized to 1000โ2000). - How to use:
- Upload and open Serial at
115200. Move sticks across detents and extremes; observe once-per-second prints. - Record
min/mid/max(mid = around center detent). - Example calibration: Right
min=1435, mid=1493, max=1994; Leftmin=1498, mid=1529, max=2006. - Normalization: piecewise around mid โ
minโmidmaps to1000โ1500,midโmaxmaps to1500โ2000to keep center stable and stretch both sides.
- Upload and open Serial at
If a channel hits 2000 ยตs within few detents, Arduino cannot increase its physical resolution. Adjust on the transmitter:
- Endpoints/ATV/Travel: increase the faster-saturating channel or unify both sides, so equal detent span maps to similar PWM.
- Subtrim/Center: ensure both channels center at ~
1500 ยตs. - Dual Rates/Expo: disable or unify during testing to avoid nonlinear detent effects.
- Output range (if supported): unify to
1000โ2000 ยตs. - Run the transmitterโs stick/channel calibration.
After transmitter calibration, re-measure with test_RC.ino and update calibration constants; we will apply the same per-channel normalization in test/test.ino and wifi_RC_control/wifi_RC_control.ino to align gears with physical detents.
This is an Arduino project for controlling dual thrusters (Left/Right) with multiple control modes.
- original/ - Original RC remote control version
- ros_control/ - ROS + RC mixed control version
- wifi_control/ - WiFi control version
- wifi_RC_control/ - WiFi + RC hybrid control with automatic priority switching
- wifi_manager_RC_control/ - โญ Advanced WiFi + RC control with multi-network management (Recommended)
- Reads PWM signals from RX receiver
- Valid range: 950-2000 ยตs, mapped to ESC range 1100-1900 ยตs
- Center deadband control
- Timeout protection: auto-stop after 200ms without signal
- Supports mixed RC and ROS control
- Receives ROS commands via USB Serial
- Command format:
C <left_us> <right_us>\n - Auto fallback to RC control on ROS command timeout
- Real-time status output:
S <mode> <outL> <outR>\n
- TCP server on Arduino (192.168.50.100:8888)
- Receives commands from ROS via network
- Command format:
C <left_us> <right_us>\n - Status reporting:
S <left_us> <right_us>\nat 10Hz - WiFi-only, no RC fallback
- Combines WiFi and RC with automatic priority switching
- Priority: WiFi > RC > Failsafe
- WiFi timeout: 500ms (auto-switch to RC)
- RC timeout: 200ms (auto-switch to neutral)
- Best of both worlds: wireless control with RC safety backup
The most advanced version with multi-network support:
- ๐ Multi-WiFi Configuration โ Save up to 5 WiFi networks with priorities
- ๐ Priority-Based Auto-Connect โ Tries networks by priority on boot
- ๐ฑ Web Configuration Portal โ Manage networks via phone/computer (192.168.4.1)
- ๐ Persistent TCP Connection โ Stable ROS communication, no reconnects
- ๐ Auto-Reconnect โ Background WiFi retry every 30 seconds
- ๐พ EEPROM Storage โ Configurations saved permanently
- ๐ฎ Hybrid Control โ WiFi > RC > Failsafe with automatic switching
- ๐ Real-Time Status โ Streaming status at 10Hz with detailed logging
Perfect for:
- Multi-location deployment (home, office, field)
- Production environments requiring reliability
- Easy setup without code changes
- Automatic network failover
See wifi_manager_RC_control/README.md for detailed documentation.
Use wifi_RC_control โ Single WiFi network, quick setup
Use wifi_manager_RC_control โ Multiple networks, web configuration, automatic failover
Use original โ No dependencies, pure RC control
- CH_LEFT_IN: Pin 2 - Left channel PWM input (RC receiver)
- CH_RIGHT_IN: Pin 3 - Right channel PWM input (RC receiver)
- ESC_LEFT_OUT: Pin 10 - Left ESC signal output
- ESC_RIGHT_OUT: Pin 9 - Right ESC signal output
RC Receiver:
CH1 โ Pin 2 (CH_LEFT_IN)
CH2 โ Pin 3 (CH_RIGHT_IN)
GND โ GND
ESC Controllers:
Left ESC Signal โ Pin 10
Right ESC Signal โ Pin 9
GND โ GND (common)
Power:
ESC Power โ 5-12V (depends on ESC spec)
Arduino USB or external 5V
Command: C <left_us> <right_us>\n
Example: C 1600 1400
Response: S <mode> <left_us> <right_us>\n
Example: S 1 1600 1400
mode: 0=RC active, 1=WiFi active
import socket
# Connect to Arduino
s = socket.socket()
s.connect(('192.168.50.100', 8888))
# Send command
s.sendall(b'C 1600 1400\n')
# Receive status (10Hz stream)
while True:
data = s.recv(1024)
print(data.decode()) # S 1 1600 1400
s.close()1. Open wifi_manager_RC_control/wifi_manager_RC_control.ino
2. Upload to Arduino UNO R4 WiFi
3. First boot: Connects to AP "ArduinoR4-Config"
4. Visit http://192.168.4.1 to add WiFi networks
5. System auto-connects by priority1. Open wifi_RC_control/wifi_RC_control.ino
2. Edit WiFi credentials in code:
const char* ssid = "Your_SSID";
const char* password = "Your_Password";
3. Upload to Arduino
4. Connect and control via TCP port 88881. Open original/original.ino
2. Upload to Arduino
3. Connect RC receiver to pins 2, 3
4. Manual control via RC transmitter- RX Valid Range: 950-2000 ยตs
- ESC Output Range: 1100-1900 ยตs
- Center Position: 1500 ยตs
- RC Timeout: 200 ms (failsafe to neutral)
- WiFi Command Timeout: 500 ms (fallback to RC)
- Status Update Rate: 10 Hz (every 100ms)
Open Serial Monitor at 115200 baud:
| Command | Function |
|---|---|
CONFIG |
Start configuration AP |
LIST |
Display all saved WiFi profiles |
STATUS |
Show WiFi connection status |
SWITCH <i> |
Switch to profile index i |
DELETE <i> |
Delete profile index i |
RESET |
Clear all profiles and restart |
- โ Auto-stop on signal timeout โ RC 200ms, WiFi 500ms
- โ Input range validation โ Constrains to safe ESC range
- โ Center deadband protection โ Prevents drift
- โ Priority failsafe โ WiFi โ RC โ Neutral (1500ยตs)
- โ Persistent configuration โ EEPROM storage survives power loss
- โ Connection monitoring โ Real-time status logging
- Board: Arduino UNO R4 WiFi (Renesas RA4M1)
- IDE: Arduino IDE 2.x or later
- Required Libraries:
Servo.h(built-in)WiFiS3.h(built-in for R4)EEPROM.h(built-in)
โ Hardware:
- Arduino UNO R4 WiFi
- Standard RC receiver (PWM output)
- Standard ESCs (1100-1900ยตs range)
โ Software:
- ROS Noetic + Python 3
- TCP socket communication
- Multiple WiFi networks (2.4GHz)
โ Performance:
- TCP connection: Stable, no drops
- Status update: 10Hz consistent
- WiFi switching: < 30 seconds
- Command latency: < 50ms
- Ensure 2.4GHz network (R4 doesn't support 5GHz)
- Check SSID and password are correct
- Move closer to router for initial setup
- Verify using latest
wifi_manager_RC_controlversion - Check serial output for connection logs
- Ensure client sends commands with
\nterminator
- Check RC receiver wiring (pins 2, 3)
- Verify ESC calibration (neutral = 1500ยตs)
- Confirm ESC power supply is adequate
- Wait for serial confirmation after adding profile
- Don't power off during EEPROM write
- Use
RESETcommand to clear corrupted data
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test thoroughly on actual hardware
- Submit pull request with description
- v2.0 (2025-12-05) - WiFi Manager with multi-network support
- v1.3 - WiFi + RC hybrid control
- v1.2 - WiFi control via TCP
- v1.1 - ROS + RC mixed control
- v1.0 - Original RC control
MIT License - See LICENSE file for details
- Repository: https://github.com/exordor/Arduino_thruster_control
- Issues: Report bugs via GitHub Issues
- Documentation: See individual project README files