How to Make Arduino Bluetooth +obstacle Avoiding Car
by ideasu-6 in Circuits > Arduino
22 Views, 0 Favorites, 0 Comments
How to Make Arduino Bluetooth +obstacle Avoiding Car
Welcome to my Arduino Bluetooth + Obstacle-Avoiding Car project! This DIY project combines creativity, electronics, and programming to build a robotic car that can avoid obstacles autonomously while also being controlled via Bluetooth.
The car is equipped with an ultrasonic sensor to detect and avoid obstacles in its path, ensuring smooth and intelligent navigation. Additionally, with the help of a Bluetooth module, you can manually control the car's movements using a smartphone or Bluetooth-enabled device.
This project is perfect for beginners and enthusiasts who want to explore the world of robotics, Arduino programming, and sensor integration. Whether you're creating this for fun, education, or as a submission for a competition, it’s a fantastic way to learn about robotics and showcase your skills.
Supplies
Supplies for the Arduino Bluetooth + Obstacle-Avoiding Car
Here’s the complete list of components and materials you’ll need to build this project:
Electronics
- Arduino Uno/Nano – 1 unit (main microcontroller board).
- L298N Motor Driver – 1 unit (to control the motors).
- HC-05 Bluetooth Module – 1 unit (for Bluetooth connectivity).
- HC-SR04 Ultrasonic Sensor – 1 unit (for obstacle detection).
- DC Gear Motors – 2 or 4 units (for car movement).
- Wheels – 2 or 4 units (to attach to the motors).
- Battery (7.4V Li-ion or 9V) – 1 unit (power source).
- Battery Holder – 1 unit (to secure the battery).
- Jumper Wires – 10–20 pieces (for wiring).
- Switch – 1 unit (to turn the car on and off).
Tools and Accessories
- Car Chassis – 1 unit (base to mount components).
- Screwdriver – For assembly.
- Double-sided Tape or Screws – To secure components.
- Breadboard (optional) – For testing connections.
- Hot Glue Gun (optional) – To secure components to the chassis.
Software
- Arduino IDE – For programming the Arduino.
- Bluetooth Controller App – A mobile app to control the car via Bluetooth.
Steps to Make It
Steps to Build the Arduino Bluetooth + Obstacle-Avoiding Car
Step 1: Assemble the Chassis
- Take the car chassis and attach the DC gear motors to the slots provided.
- Mount the wheels onto the motor shafts securely.
- If your chassis includes a caster wheel, attach it to the front or rear for stability.
- Secure the battery holder to the chassis using double-sided tape or screws.
Step 2: Wire the Motor Driver (L298N)
- Connect the DC motors to the output terminals of the L298N motor driver (labeled OUT1, OUT2, OUT3, OUT4).
- Left motor: OUT1 and OUT2.
- Right motor: OUT3 and OUT4.
- Connect the +ve and -ve terminals of the battery to the motor driver’s power inputs (VCC and GND).
- Connect the 12V jumper pin from the motor driver to the 5V pin to power the Arduino.
Step 3: Connect the Ultrasonic Sensor (HC-SR04)
- Mount the ultrasonic sensor on the front of the chassis using screws or glue.
- Wire it to the Arduino:
- VCC to 5V.
- GND to GND.
- TRIG to digital pin 9.
- ECHO to digital pin 10.
Step 4: Connect the Bluetooth Module (HC-05)
- Place the HC-05 module on the chassis.
- Wire it to the Arduino:
- VCC to 5V.
- GND to GND.
- TXD to Arduino pin 11 (RX).
- RXD to Arduino pin 10 (TX) using a voltage divider (to prevent over-voltage).
Step 5: Arduino Connections
- Connect the motor driver input pins to the Arduino:
- IN1 to pin 2.
- IN2 to pin 3.
- IN3 to pin 4.
- IN4 to pin 5.
- Connect the Enable pins of the motor driver:
- ENA to pin 6.
- ENB to pin 7.
Step 6: Upload the Code
- Open the Arduino IDE and load your obstacle-avoidance and Bluetooth control code.
- Verify and upload the code to the Arduino via USB.
- Ensure the Bluetooth module is disconnected during the upload process.
Step 7: Test the Car
- Power the car using the battery.
- Pair the Bluetooth module with your smartphone using a Bluetooth controller app.
- Test the obstacle avoidance by placing objects in the car’s path.
- Use the Bluetooth app to control the car manually and switch between modes.
Step 8: Fine-Tune and Record
- Adjust the ultrasonic sensor’s range if necessary.
- Record a demo video showcasing both automatic and Bluetooth-controlled modes.
Coding
Bluetooth + Obstacle-Avoiding Car project. The code integrates obstacle avoidance using an ultrasonic sensor and manual Bluetooth control using the HC-05 module.
Code Explanation:
- The car avoids obstacles when no Bluetooth commands are received.
- Bluetooth commands control the car manually.
- 'F': Forward
- 'B': Backward
- 'L': Left
- 'R': Right
- 'S': Stop
Arduino Code
How It Works:
- Bluetooth Control:
- When a command is received via Bluetooth, the car performs the corresponding action.
- Obstacle Avoidance:
- If no Bluetooth command is received, the ultrasonic sensor continuously checks for obstacles. If an obstacle is detected within 20 cm, the car stops, moves backward, and turns.