





Auto Mode.... with obstacle avoidance







Hybrid Mechatronics: The Smart 4WD Rover
The Smart Obstacle / Bluetooth 4WD Car is the final evolution of the basic robot kits. It is a "Hybrid" project: It isn't entirely autonomous, nor is it entirely manual. It represents modern Drive-by-Wire technology—you drive using an app, but the car will override your bad decisions to ensure safety.
I made this car since I found there is only one kind of option, either it is obstacle avoidance or Bluetooth control so if you want to take over manually you cannot do it. (or might be available and I haven't found it :))
This car can be auto driven by detecting obstacle on its way or if you connect with Bluetooth it will automatically come to manual mode and then you can control it manually, once Bluetooth connection disconnected or lost it will then automatically drive itself.
Fusing Comm Logic with Sensor Math
The structure of the loop() must be perfectly timed.
- The Radar Check: First, the HC-SR04 ping sensor mounted on the front bumper checks the distance.
- The Override Check: If distance is
< 20cm, the Arduino fires an interrupt. It forcesspeed = 0to all four motors, spins an alarm buzzer, and completely ignores any forward commands coming from your phone! - The Listening Phase: If clear (
> 20cm), it checksSerial.read()for incoming Bluetooth packets. - The Execution: If the phone transmits "Forward", the L298N pushes current to all four motors simultaneously.
There are three obstacle sensor, first the Ultrasonic which will work on both Auto mode and manual mode to avoid bumping the car in front, the back one is IR Obstacle sensor and will work just to avoid hitting from back when reversing and front IR Obstacle sensor will help to avoid dropping in front if there is no ground further or the ground distance further then set distance of the sensor.(Please make sensor LED downwards at floor/Ground)
Pan/Tilt Scanning (Optional Upgrade)
To make the car truly intelligent, the ultrasonic sensor is often mounted on a Micro Servo (SG90). When the car auto-stops before hitting a wall, it:
- Turns the servo left and pings. (60cm clear).
- Turns the servo right and pings. (10cm blocked).
- The Arduino decides the safest route is Left, spins the wheels, and continues its autonomous mission!
Central Hardware List
- Arduino Uno/Mega: The hybrid processor.
- L298N Motor Driver Module: Necessary for massive current draw.
- 4WD Chassis Kit (4 Motors, 4 Wheels).
- HC-SR04 Ultrasonic Sensor.
- HC-05 Bluetooth Module.
- Dual 18650 Battery Pack: 7.4 Volts minimum is required to beat the stall current of four engaged motors.
Note: Please tune Potentiometer on IR Obstacle sensor to tune distance as per your need. Please also flip wires from D4-D7 if motor is not going forward and instead going backward.