RC Robot Tutorial

This commit is contained in:
2025-07-21 02:53:25 -04:00
parent 54c2219049
commit bfdec7603d
8 changed files with 246 additions and 192 deletions

View File

@@ -125,6 +125,27 @@ The following images illustrate various PWM duty cycles registered by oscillosco
<br/><br/><br/><br/>
Fusion of Software with Hardware
--------------------------------
On one hand, we have the hardware designed so that the joystic x- and y- axis, and DC motors are wired to the proper GPIOs on the
ESP32-C3 WROOM microcontroller. On the other hand, we have the software that reads the joystick x- and y- axis, sends the data
to the receiver device, and converts that to PWM values on the receiver device.
In essense, the direction and speed of the bitByte Rider car is controlled by the two variables. On the remote controller device,
the joystic x- and y- axis values are sent to the receiver device in a raw format (i.e. analog voltages, "as-is"). On the receover
device, these two values are converted to the two PWM values; one for each pair of DC motors on left and right side.
When the joystick is pushed forward, the X-axis voltage remains at 1.65V (neutral), while the Y-axis voltage rises to 3.3V. The
receiver on the RC car interprets this input and generates 100% PWM duty cycle signals on both sides, driving the car forward at
full speed.
Similarly, when the joystick is pushed fully to the left or right, the X-axis voltage shifts while the Y-axis remains neutral. For a
left turn, the receiver translates the signal into 100% PWM on the left-side motors and 0% on the right-side motors, causing the car
to pivot. The opposite occurs for a right turn, with 100% PWM on the right and 0% on the left, enabling precise directional control.
The table below summarizes the reserved GPIOs.
+------+-----+---------------------------------------------------------+----------------+
| GPIO | Pin | Function | Notes |
+======+=====+=========================================================+================+
@@ -143,9 +164,6 @@ The following images illustrate various PWM duty cycles registered by oscillosco
| 7 | 6 | PWM for counter-clockwise rotation of left-side motors | LEDC_CHANNEL_3 |
+------+-----+---------------------------------------------------------+----------------+
Fusion of Software with Hardware
--------------------------------
The *struct* for storing motors PWM values.
.. code-block:: c