Skip to content

hyankov/robot_car

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

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.

Gallery

Videos

Video 1 Video 2 Video 3
Video 1 Video 2 Video 3

Photos

header Click image for full gallery

Parts used

Chassis kit

Contains basic car chassis, motors, wheel and tyres and a not very useful 4 x 1.5V AA battery holder.

Chassis kit

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.

L298N H-Bridge(s)

L298N

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.

Wires

I am going to use a combination of jumper wires and a stripped CAT5 cable.

Power

6x holder of 1.2V AA NiMH recharchable batteries (rated 2000mAh each) = 7.2V

Sensors

  • Ultrasonic sensor HC-SR04 (to detect and avoid obstacles)

Others

  • Standoffs, to be able to put the components on to the chassis

Wiring

4WD, 1 Bridge

Pros

  • Will require only 6 pins on the Arduino
  • A bit less coding
  • Symmetry

Cons

  • Left side and right side motors are 'grouped' (i.e. both wheels on each side can only go in the same direction)

4WD, 1 Bridge Click image to download fzz file

Code

See code here. All code is implemented as non-blocking, i.e. there are no delay calls.

Settings

There is two setting files that may need adjustment:

  • Settings - various fine-tune settings, such as min and max robot speed, obstacle evasion strategy and similar.
  • Pins layout - the Arduino pins to be setup in accordance with your own wiring.

Movement

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.

Obstacle detection

The code responsible for detecting obstacles is implemented here:

It makes use of NewPing library.

Self-driving

The code responsible for taking robot-driving decisions based on input from the outside world (such as obstacle detection) is implemented here:

TODO

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