This project demonstrates how to build and program a Bluetooth-controlled car using an ESP32 microcontroller and the Dabble app. The car can be controlled via a smartphone using the gamepad module in the Dabble app.
- Bluetooth Control: The car can be controlled wirelessly using the Dabble app.
- Four-Wheel Drive: Supports forward, backward, left, and right movements.
- Adjustable Speed: Uses PWM to control motor speed.
- ESP32 Microcontroller
- Motor Driver (L298N or equivalent)
- DC Motors (x4 for a 4-wheel drive setup)
- Power Supply (e.g., Li-ion batteries)
- Bluetooth-enabled Smartphone with the Dabble App installed
- Connecting wires
| ESP32 Pin | Motor Driver Pin | Description |
|---|---|---|
| GPIO25 | IN1 | Motor 1 control |
| GPIO26 | IN2 | Motor 1 control |
| GPIO27 | IN3 | Motor 2 control |
| GPIO14 | IN4 | Motor 2 control |
| GPIO32 | ENA | Speed control motor 1 |
| GPIO33 | ENB | Speed control motor 2 |
Connect the motors to the motor driver and ensure the power supply is sufficient for the motors.
- Install the Dabble library in your Arduino IDE.
- Install the latest ESP32 board manager in your Arduino IDE.
- Clone this repository or copy the code into a new Arduino sketch.
- Open the Arduino IDE and select the ESP32 board in Tools > Board.
- Configure the correct COM port in Tools > Port.
- Upload the code to the ESP32.
- Open the Dabble app on your smartphone and connect to the ESP32 Bluetooth module (named "MyBluetoothCar").
- Use the Gamepad module in the app to control the car.
- Gamepad Controls:
- Up Button: Moves the car forward.
- Down Button: Moves the car backward.
- Left Button: Turns the car left.
- Right Button: Turns the car right.
- The PWM signals generated by the ESP32 control the speed of the motors, and the digital signals determine the direction.
Move(int right_wheels_speed, int left_wheels_speed):- Controls the direction and speed of the wheels.
setUpPinModes():- Initializes the GPIO pins and configures PWM for speed control.
setup():- Initializes pin modes and sets up the Bluetooth connection.
loop():- Continuously processes input from the Dabble app and controls the car accordingly.
-
Bluetooth Connection Issues:
- Ensure the ESP32 is powered on and within range.
- Verify that the Dabble app is connected to the correct Bluetooth device.
-
Motor Not Responding:
- Check the connections between the motor driver and ESP32.
- Ensure the power supply is sufficient for the motors.
-
Unexpected Behavior:
- Verify the code logic and adjust pin configurations if necessary.
- Developed using the Dabble library for ESP32.
- Inspired by IoT and robotics enthusiasts.
GitHub: naso7y
Email: [email protected]
LinkedIn: www.linkedin.com/in/nos7y/