This document describes the common RTK-EASY robot wheel-controller communication protocol. It is used to control two wheels from the RTK AUTOPILOT ESP32 controller.
The same protocol applies to:
So RTK AUTOPILOT never needs to know which motor type is fitted to the robot — it always sends the same commands: a separate direction and speed, as a percentage, for the left and right wheel.
Version 1.0
RTK AUTOPILOT and the wheel controller are connected over UART:
RTK AUTOPILOT TX -> wheel controller RX RTK AUTOPILOT RX <- wheel controller TX GND --- common GND
Speed: 115200 baud · Format: 8N1
Important: if the wheel controller's TX signal is 5 V, it must be connected to RTK AUTOPILOT's RX through a voltage divider. The ESP32 GPIO RX pin is not 5 V tolerant.
Every command is a plain ASCII text line, terminated with a newline: LF or CR+LF. You can test with Arduino Serial Monitor, PuTTY or another terminal, set to "Newline" or "Both NL & CR".
Command form:
or you can control a single wheel:
L[value] R[value]
value is an integer from -100 to 100:
| Value | Meaning |
|---|---|
| Positive number | the wheel's chosen direction of rotation |
| Negative number | the opposite direction |
| 0 | stop that wheel |
| 100 or -100 | maximum requested speed |
The speed value is a percentage control level, not a direct PWM value. The DC controller maintains the requested speed using its own calibration and back-EMF measurement. A BLDC controller later interprets the same values through its own speed-holding system.
A note on sign convention: the left and right wheel motors are mounted as mirror images of each other on the robot. So when driving forward, it is normal for one wheel to receive a positive value and the other a negative one. This is a software direction convention, not a bug.
L[30]R[-30]
Left wheel drives at 30%, right wheel at 30%, each in its own forward direction.
L[-30]R[30]
L[-25]R[-25]
L[25]R[25]
L[40]R[-20]
In this example the left wheel drives faster than the right, so the robot turns right. Always confirm direction by safely lifting the wheels off the ground first — the actual side depends on motor wiring and mechanical mounting.
L[0]R[-35]
Stops the left wheel; the right wheel keeps driving in its direction.
This is the primary safety command. It stops both wheels immediately.
Send it:
Do not rely on L[0]R[0] alone when a guaranteed full STOP is needed. On both controller versions, the standard emergency-stop command is [0].
Request from RTK AUTOPILOT to the wheel controller:
Required controller response:
BAT=12.48
The number is in volts. The response must end with a newline. RTK AUTOPILOT uses it to show battery voltage on its own page. The current autopilot sends [BAT] roughly every 2 seconds.
Important for a future BLDC controller: it must respond in exactly the format BAT=xx.xx, with no extra text on the same line.
The web page's F/B/L/R buttons do not send those letters to the wheel controller. They are translated into the universal wheel commands, using the configured drive and turn speed (0–100%):
| Web button | Command to the wheel controller |
|---|---|
| Forward (F) | L[speed]R[-speed] |
| Backward (B) | L[-speed]R[speed] |
| Left (L) | L[-turnSpeed]R[-turnSpeed] |
| Right (R) | L[turnSpeed]R[turnSpeed] |
| Stop (S) | [0] |
On startup, the current RTK AUTOPILOT version defaults both straight-drive and turn speed to 15%. These can be changed on the autopilot's web page.
These commands are only for maintenance, calibration and diagnostics of the brushed-motor L298N controller. The BLDC controller is not required to support them, unless a future decision unifies the diagnostic side as well.
| Command | Purpose |
|---|---|
[CAL] | Starts back-EMF calibration of both wheels. The wheels must be lifted off the ground, with no mechanical load. During calibration the controller determines the minimum stable PWM and BEMF limits itself and stores them in EEPROM. |
[CALDATA] | Prints the stored calibration values, e.g.: LEFT MIN_PWM=40 MIN_BEMF=250 MAX_BEMF=670 WORK_MAX=... / RIGHT MIN_PWM=40 MIN_BEMF=245 MAX_BEMF=665 WORK_MAX=... |
[STAT] | Prints live diagnostics: command, BEMF target and measurement, PWM and VIN voltage. |
[LOG] | Turns the periodic diagnostic log on or off. |
[PLOT] | Turns data output for the Arduino Serial Plotter on or off. |
BAT[12.50] | Calibrates the controller's voltage-measurement coefficient, given that the real measured battery voltage is 12.50 V. This is not a normal autopilot command. |
[CAL] over Serial Monitor.CAL COMPLETE message.[CALDATA].L[15]R[-15] [0] L[-15]R[15] [0]
If you get ERR: CALIBRATION REQUIRED after reflashing or changing a motor, run [CAL] again.
For a BLDC controller to work with RTK AUTOPILOT without any changes on the autopilot side, it must:
L[x], R[x] and L[x]R[y], where x/y are -100..100.[0] as an immediate STOP command for both wheels.[BAT] and respond with a single line, BAT=voltage_in_volts.Key rule: the BLDC controller must not translate the main commands into another format, such as "LEFT=30" or "F". This keeps it directly compatible with the existing RTK AUTOPILOT, its web manual control, and the autopilot's own algorithm.
Over a terminal, sending each line with Newline:
[BAT] expected response: BAT=12.xx L[15]R[-15] the robot starts driving forward [0] the robot stops L[-15]R[-15] the robot turns in place, left [0] the robot stops
Run all first tests with the wheels lifted off the ground. Always be ready to send [0] quickly, or physically disconnect motor power. Before testing the autopilot, confirm that the F/B/L/R directions really match the robot's motion — not just the direction the motors spin.