Autonomous Dynamic Sensor RC Automobile - an Arduino Project
by sabethonlouis5 in Circuits > Arduino
80 Views, 0 Favorites, 0 Comments
Autonomous Dynamic Sensor RC Automobile - an Arduino Project
This project is an Arduino-based object-detection RC car that can drive using four DC gearbox motors, avoid obstacles with ultrasonic sensors, and scan its surroundings using a servo-mounted distance sensor. I built it as a small robotics platform that combines CAD design, circuit simulation, soldering, and real-world testing into one project.
At first glance it may look like a basic Arduino car, but the goal was to make it more complete than just “connect motors and upload code.” I designed the layout, tested the wiring logic in Tinkercad, used a motor driver for proper motor control, added a fixed front safety sensor, added a second scanning ultrasonic sensor on a servo, and planned the wiring so the same control logic could transfer from simulation to the real DRV8833 driver.
The car uses skid steering, which means the two left motors always move together and the two right motors always move together. Driving both sides forward moves the car straight. Reversing one side while driving the other forward makes the car pivot.
This build is meant to show the full engineering process: planning, simulation, wiring, coding, troubleshooting, and final assembly.
Supplies
Electronics
- Arduino Uno R3
- DRV8833 Dual Motor Driver Carrier
- 4x TT yellow DC gearbox motors
- 2x HC-SR04 ultrasonic distance sensors
- Micro servo, SG90/SG92R style
- IR receiver and IR remote
- Jumper wires
- Breadboard or solderable prototyping board
- Battery pack for motor power, preferably 4xAA or 6V range
- Battery pack or USB power for Arduino
- Capacitor for motor power smoothing, such as 100 µF to 470 µF
- Optional heat sinks for the motor driver
Chassis / Mechanical Parts
- 3D printed chassis or laser-cut/cardboard/acrylic chassis
- 4 wheels compatible with TT motors
- Screws, nuts, spacers, or hot glue
- Small platform/bracket for the servo-mounted ultrasonic sensor
- Zip ties or tape for wire management
Tools
- Computer with Arduino IDE
- Tinkercad Circuits
- Soldering iron
- Solder
- Wire cutters / wire strippers
- Screwdriver
- Multimeter, optional but very useful
Design the Car Before Wiring Anything
Before wiring the circuit, I planned the basic layout of the car. I wanted the final robot to be compact, but still easy to troubleshoot. The important design choices were:
- Four powered wheels for better traction.
- Skid steering instead of a steering rack.
- A fixed front ultrasonic sensor for quick obstacle detection.
- A second ultrasonic sensor mounted on a servo so the car can scan left and right.
- A motor driver placed near the motors to keep motor wiring short.
- The Arduino placed where USB access would still be easy.
The main reason for using skid steering is simplicity. Instead of building a steering mechanism, the car turns by changing the direction of the left and right motor pairs. This is how many tank-style robots drive.
The left front and left rear motors are wired together as one side. The right front and right rear motors are wired together as the other side. That gives the robot four-wheel drive while only needing two motor channels.
Simulate the Circuit in Tinkercad
Tinkercad does not include the DRV8833 motor driver, so I used the L293D motor driver as a simulation stand-in. The exact physical pinout is different, but the control idea is the same: each motor channel has two input pins, and the Arduino controls direction by setting one input HIGH and the other LOW.
The simulated pin map was:
FunctionArduino Pin
Front ultrasonic TRIG
D2
Front ultrasonic ECHO
D3
Sweep ultrasonic TRIG
D4
Left motor IN1
D5
Left motor IN2
D6
Right motor IN1
D7
Right motor IN2
D8
Servo signal
D9
IR receiver signal
D11
Sweep ultrasonic ECHO
D12
The fixed front sensor is the safety sensor. It checks directly in front of the car. The sweep sensor is used for navigation. It moves left and right on the servo and records which direction has the most open space.
One of the most important wiring rules is that all grounds must connect together. The Arduino, sensors, servo, motor driver, and motor battery all need a shared ground so the signals have the same reference point.
Power wiring:
FromTo
Arduino 5V
Sensor VCC, servo VCC, driver logic/enable
Motor battery +
Motor driver motor power input
Arduino GND
Shared ground
Motor battery –
Shared ground
Motor driver GND
Shared ground
For the real DRV8833, the motor battery connects to VM, not to the Arduino 5V pin. The Arduino 5V is only for logic-level parts like sensors and control signals.
Build the Chassis and Mount the Motors
I mounted the four TT gearbox motors so that each side of the car had two motors. Since this is a skid-steering robot, motor placement matters. Both motors on the left side should spin together, and both motors on the right side should spin together.
The left motors are wired in parallel to one motor-driver output pair. The right motors are wired in parallel to the other motor-driver output pair.
That means:
- Left front motor + and left rear motor + go to the same driver output.
- Left front motor – and left rear motor – go to the other output for that channel.
- Right front motor + and right rear motor + go to the same output on the second channel.
- Right front motor – and right rear motor – go to the other output for that channel.
If one motor spins backward compared to the other motor on the same side, flip that motor’s two wires. Both motors on the same side need to push the car in the same direction.
I also left enough room on top of the car for the Arduino, motor driver, batteries, and servo scanner.
Solder and Wire the DRV8833 Motor Driver
The DRV8833 is the motor driver that controls the four motors. The Arduino pins cannot directly power four TT motors, so the motor driver acts like a switch that lets the Arduino control a separate motor power supply.
The DRV8833 has two motor channels. Since the car uses skid steering, one channel controls the left motor pair and one channel controls the right motor pair.
Basic DRV8833 wiring:
DRV8833 Pin Connects To
VM
Motor battery positive
GND
Shared ground
AIN1
Arduino D5
AIN2
Arduino D6
BIN1
Arduino D7
BIN2
Arduino D8
AOUT1 / AOUT2
Left motor pair
BOUT1 / BOUT2
Right motor pair
SLP / nSLEEP, if present
5V or pulled HIGH
I also added a capacitor across the motor power input. This helps reduce voltage dips when the motors start, stop, or suddenly reverse direction.
Important: the Arduino 5V pin should not be connected to the motor battery positive. The motor battery powers the motors through the driver. The Arduino 5V powers logic parts like sensors and servo signal logic. The shared connection between the two systems is ground.
Add the Sensors and Servo Scanner
This car uses two ultrasonic sensors:
- A fixed front sensor.
- A servo-mounted sweep sensor.
The front sensor is like an emergency reflex. If the car gets too close to something, the code stops the motors, backs up, and turns.
The sweep sensor gives the robot more information. The servo moves the sensor from side to side, and the code keeps track of which angle has the most open space. When the car needs to turn, it uses that best open angle to decide whether to pivot left or right.
Sensor wiring:
PartSignal PinVCCGND
Front HC-SR04 TRIG
D2
5V
GND
Front HC-SR04 ECHO
D3
5V
GND
Sweep HC-SR04 TRIG
D4
5V
GND
Sweep HC-SR04 ECHO
D12
5V
GND
Servo signal
D9
5V
GND
IR receiver signal
D11
5V
GND
I tested the sensors separately before combining everything. This helped confirm that the servo and ultrasonic sensors were working before troubleshooting the motor system.
Upload the Code
Upload this code to the Arduino. It uses the fixed front sensor for obstacle detection, the sweep sensor for scanning, and the motor driver pins for skid steering.
Before running the full code, I recommend testing one subsystem at a time:
- Test the servo by sweeping from 30 to 150 degrees.
- Test each ultrasonic sensor in the serial monitor.
- Test the left motor pair alone.
- Test the right motor pair alone.
- Then test the full obstacle-avoidance code.
This makes troubleshooting much easier.
Troubleshooting and Tuning
This project taught me that most robot problems are not caused by the code first. They are usually caused by wiring, power, or motor direction.
Here are the problems I checked during testing:
Motors do not spin
Check:
Motor battery positive goes to the motor driver motor power input.
Motor battery negative connects to shared ground.
Arduino ground connects to the same shared ground.
Motor driver sleep/enable pin is HIGH.
Motors are connected to driver outputs, not directly to Arduino pins.
The motor driver is not overheating.
The motor battery is not dead.
One side spins backward
Flip the two motor wires for that side, or reverse the HIGH/LOW logic in code.
Servo works but motors do not
That usually means the Arduino side is powered correctly, but the motor power side is not. Check VM, GND, and the motor driver output wiring.
Ultrasonic sensor says “NO ECHO”
Check the TRIG and ECHO pins. It is very easy to swap them. Also make sure the sensor has 5V and GND.
Car turns instead of going straight
One motor pair may be reversed, or one side may be weaker. First fix motor direction, then check battery power and friction.
Car resets when motors start
The motors are pulling too much current or causing voltage dips. Use a separate motor battery, add a capacitor across motor power, and make sure grounds are connected correctly.
Final Testing
For final testing, I placed the car on the floor with a few objects in front of it. I watched the serial monitor first to make sure the front sensor and sweep sensor were giving reasonable distances.
The final behavior I wanted was:
- Drive forward when the path is clear.
- Continuously scan left and right.
- Stop if the front sensor sees an obstacle too close.
- Reverse briefly.
- Turn toward the side with more open space.
- Continue driving.
This made the robot feel more intentional than a car that simply bumps into things or randomly turns. The sweep sensor gives it a basic way to “look around” before choosing a direction.
Conclusion
This project combines mechanical design, electronics, programming, and troubleshooting into one small robot. The most important part was not just making the car move, but building a system that could sense, decide, and react.
The final car uses four-wheel skid steering, a motor driver, two ultrasonic sensors, and a servo scanner. I also used Tinkercad to plan and test the wiring before moving to the real build. That saved time because I could confirm the logic before soldering and assembling everything.
If I built a second version, I would improve the chassis layout, add cleaner wire routing, and possibly add speed control using PWM. I would also add a more complete manual RC mode using the IR remote, so the car could switch between autonomous obstacle avoidance and manual driving.
Overall, this project is a strong beginner-to-intermediate robotics build because it goes beyond a basic Arduino car. It includes simulation, CAD planning, soldering, sensor scanning, motor-driver control, and real debugging. That full process is what makes the project interesting: it is not just a car that moves, but a small robot that senses its environment and makes driving decisions.