The wiring is the foundation for ensuring that all electronic components of your robot car work together smoothly. In this article, I’ll show you how to connect the ESP32 to the PCA9685 servo controller, motor driver, OLED display, and LED ring.
Overview of Components
1. ESP32
The ESP32 is the central control module of your robot. All other components are connected to this microcontroller.
2. PCA9685 Servo Controller
This module expands the PWM outputs of your ESP32, enabling precise control of motors and servos.
3. Motor Driver (e.g., L298N)
The motor driver manages the control of the TT geared motors.
4. OLED Display
The display shows the current status of your robot, such as “Controller Connected” or “Motors Stopped.”
5. WS2812 LED Ring
The LED ring provides visual effects such as speed indicators or ambient lighting.
Step-by-Step Wiring Guide
1. Connecting the PCA9685 Servo Controller to the ESP32
The PCA9685 is connected to the ESP32 via the I2C interface:
- SDA (Data Line): Connect the SDA pin of the PCA9685 to GPIO21 of the ESP32.
- SCL (Clock Line): Connect the SCL pin of the PCA9685 to GPIO22 of the ESP32.
- VCC and GND: Connect the PCA9685 power supply to 3.3V (VCC) and GND of the ESP32.
2. Connecting the Motor Driver to the PCA9685
The PWM outputs of the PCA9685 control the motor driver:
- Connect six PWM channels of the PCA9685 to the inputs of the motor driver (e.g., IN1 to IN4) and ENA and ENB.
-
PCA9685 Servo Controller Motor Driver L298N Channel 0 ENA Channel 1 IN1 Channel 2 IN2 Channel 3 IN3 Channel 4 IN4 Channel 5 ENB
3. Connecting the OLED Display
The OLED display is also controlled via the I2C bus. Since pins 21/22 on the ESP32 are already in use, we use the I2C output on the PCA9685 Servo Controller.
- SDA: Connect the SDA pin of the display to the SDA output of the Servo Controller (shared with the PCA9685).
- SCL: Connect the SCL pin of the display to the SCL output of the Servo Controller (shared with the PCA9685).
- VCC and GND: Connect the power supply to 3.3V (VCC) and GND of the Servo Controller as shown in the image below.
4. Connecting the LED Ring (WS2812) to the ESP32
The WS2812 LED ring is controlled via a single data pin:
- DIN (Data Line): Connect the DIN pin of the LED ring to GPIO5 of the ESP32 as shown in the image below.
- VCC and GND: Connect the power supply of the LED ring to 5V and GND. The required 5V should come directly from a stable power source such as a step-down converter. Avoid connecting it to the 3.3V pin of the ESP32, as the current draw is too high. I used a cut USB-A cable and connected the red/black wires to the LED ring.
Important Power Supply Notes
- Shared Ground: All components must use the same ground (GND) to function reliably.
- Voltage Considerations: Ensure the ESP32 is powered with 3.3V and the other components with the appropriate voltage (e.g., 5V for the LED ring and motor driver).
Summary
With this wiring setup, all components of your ESP32 robot car are optimally connected. The PCA9685 handles PWM control, while the OLED display and LED ring provide visual feedback. The motor driver controls the motors, making your robot mobile.
In the next article, I’ll explain how to set up the software to unlock the full functionality of your robot. Have fun tinkering and wiring!
Artikel Übersicht ESP32 Roboter Auto:
ESP32 Dev Kit C V4 – Build Your Own Robot Car – Project KickoffESP32 Dev Kit C V4 – Build Your Own Robot Car – Electronics and Components
ESP32 Dev Kit C V4 – Build Your Own Robot Car – Chassis Examples
ESP32 Dev Kit C V4 – Build Your Own Robot Car – Power Supply
ESP32 Dev Kit C V4 – Build Your Own Robot Car – Power Supply Wiring
ESP32 Dev Kit C V4 – Build Your Own Robot Car – Logical Wiring
ESP32 Dev Kit C V4 – Build Your Own Robot Car – Setting Up the Arduino Development Environment
ESP32 Dev Kit C V4 – Build Your Own Robot Car – The Robot Software
Recent Comments