This project puts together an obstacle-avoiding self-driving robot car. At a later stage I will also upgrade it to receive control over Bluetooth phone-joystick and to turn on and off headlights based on light conditions.
Video 1 | Video 2 | Video 3 |
---|---|---|
Contains basic car chassis, motors, wheel and tyres and a not very useful 4 x 1.5V AA battery holder.
The information I have about the motors is:
Q: How powerful are the wheel motors individually (i.e., RPMs, amps, max. speed, torque, etc.)?
A: Its speed is 200 rpm. Torque is 0.68. current is 90 mA. All parameter are tested without loading.
I have actually measured the motor usage at 180 mA without any loads.
Q: Does this meet these specifications:brushed [versus brushless] dc motors 5v-9v 100ma to 500 ma with tires and integrated gearbox?
A: Its motor power supply is 3V ~ 6V without without load.
Wires need soldering to the motors. The battery holder is useless because you cannot power the bridges with 6V.
Here's some very useful information about them:
I know they're considered ancient and inefficient, but I chose them because there's a ton of information and tutorials out there about them.
Key take-aways:
- Needs around 7.5V to power up
- Can provide regulated 5V out, which can be used to power the Arduino
- Will drop 1.4-1.7V, or more (inefficiency)
- Has a 5V jumper in place: jumper in - you provide 7.5V to the H-Bridge and it outputs 5V, otherwise you have to provide the 5V as logical input
- You can provide PWM to the Enable pin, to control speed of the motor
- Make sure you have a common ground with the Arduino
Not sure if they regulate the voltage passed to the motors, I think not. So if you have a 3~6V motor, you'd probably want to pass no more than 6V + 1.4V
to the H-Bridge, which will drop the voltage down to 6V for the motor.
I am going to use a combination of jumper wires and a stripped CAT5 cable.
6x holder of 1.2V AA NiMH recharchable batteries (rated 2000mAh each) = 7.2V
- Ultrasonic sensor HC-SR04 (to detect and avoid obstacles)
- Standoffs, to be able to put the components on to the chassis
- Will require only 6 pins on the Arduino
- A bit less coding
- Symmetry
- Left side and right side motors are 'grouped' (i.e. both wheels on each side can only go in the same direction)
Click image to download
fzz
file
See code here. All code is implemented as non-blocking, i.e. there are no delay
calls.
There is two setting files that may need adjustment:
- Settings - various fine-tune settings, such as
min
andmax
robot speed, obstacle evasion strategy and similar. - Pins layout - the Arduino pins to be setup in accordance with your own wiring.
Code responsible for the robot movement management is implemented here:
It is not responsible for controlling the behavior of the robot, only for the movement, such as turnLeft
, turnRight
, moveBackwards
, moveForward
, etc.
The code responsible for detecting obstacles is implemented here:
It makes use of NewPing library.
The code responsible for taking robot-driving decisions based on input from the outside world (such as obstacle detection) is implemented here:
Ideas for sensors and parts to be added in a later release:
- Servo (to rotate Ultrasonic sensor)
- Bluetooth (to receive control over bluetooth phone joystick) or IR (take commands from remote control)
- Headlights, rear lights and photoresistor (to turn on/off LED headlights)
- Screen to show misc information