Skip to content

a smart car controlled by an ESP32 , L298N microcontroller. DC motors, motor drivers, ultrasonic sensors, and Bluetooth modules. obstacle detection using embedded systems.

Notifications You must be signed in to change notification settings

NASO7Y/Building-A-Car-ESP32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Bluetooth Controlled Car using ESP32

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.

Features

  • 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.

Components Required

  1. ESP32 Microcontroller
  2. Motor Driver (L298N or equivalent)
  3. DC Motors (x4 for a 4-wheel drive setup)
  4. Power Supply (e.g., Li-ion batteries)
  5. Bluetooth-enabled Smartphone with the Dabble App installed
  6. Connecting wires

Circuit Diagram

Pin Connections:

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.


Installation

  1. Install the Dabble library in your Arduino IDE.
  2. Install the latest ESP32 board manager in your Arduino IDE.
  3. Clone this repository or copy the code into a new Arduino sketch.

Setup Instructions

  1. Open the Arduino IDE and select the ESP32 board in Tools > Board.
  2. Configure the correct COM port in Tools > Port.
  3. Upload the code to the ESP32.
  4. Open the Dabble app on your smartphone and connect to the ESP32 Bluetooth module (named "MyBluetoothCar").
  5. Use the Gamepad module in the app to control the car.

How It Works

  • 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.

Code Explanation

Key Functions:

  1. Move(int right_wheels_speed, int left_wheels_speed):
    • Controls the direction and speed of the wheels.
  2. setUpPinModes():
    • Initializes the GPIO pins and configures PWM for speed control.
  3. setup():
    • Initializes pin modes and sets up the Bluetooth connection.
  4. loop():
    • Continuously processes input from the Dabble app and controls the car accordingly.

Troubleshooting

  1. Bluetooth Connection Issues:

    • Ensure the ESP32 is powered on and within range.
    • Verify that the Dabble app is connected to the correct Bluetooth device.
  2. Motor Not Responding:

    • Check the connections between the motor driver and ESP32.
    • Ensure the power supply is sufficient for the motors.
  3. Unexpected Behavior:

    • Verify the code logic and adjust pin configurations if necessary.

Acknowledgments

  • Developed using the Dabble library for ESP32.
  • Inspired by IoT and robotics enthusiasts.

Contact

GitHub: naso7y

Email: [email protected]

LinkedIn: www.linkedin.com/in/nos7y/

About

a smart car controlled by an ESP32 , L298N microcontroller. DC motors, motor drivers, ultrasonic sensors, and Bluetooth modules. obstacle detection using embedded systems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages