Autonomous and Remote Control Robot

by Psuedohim in Circuits > Raspberry Pi

3166 Views, 5 Favorites, 0 Comments

Autonomous and Remote Control Robot

face.jpg

This robot build is meant to be relatively cheap and quick. Here is what you will need to get started:

Hardware


Other

  • A box to act as a chassis
    • My box is 7.5" x 4" x 2"
  • A hot glue gun
  • A knife or pair of scissors
  • A soldering iron

Obtain a Box

get-box.jpg

Try to find a box that fits all of your hardware without leaving too much room. A box that measured 7.5" x 4" x 2" fit all of my components perfectly.

Cut Holes for Motors

cut-holes.jpg

Cut out holes on both sides of the body so that it is possible to make a connection between the wheels and the motors.

Solder Leads Onto Motor Connections

solder-mtr.jpg

Most DC motors will come with small loops to which you will need to make a connection. Soldering the wires onto the loops is the best way to ensure a strong connection.

The leads will be connected to the outputs on the H-Bridge driver.

Glue Motors Inside of Box

glue-mtr.jpg

Using hot glue, place your motors in the box so that they secure against the corners. Apply a generous amount of glue and be sure to hold in place until glue has stiffened.

Connect H-Bridge to Motors

place-h.jpg

Connect the leads that are coming off of the motors to the outputs on the H-Bridge. See ( https://www.bananarobotics.com/shop/How-to-use-the-L298N-Dual-H-Bridge-Motor-Driver ) for more information on the L298N H-Bridge.

Solder Leads Onto Buck Converter

prep-buck.jpg

To power the H-Bridge I will be using 2 1s lipo batteries. At full charge these batteries put out over 8V when connected in series. I do not need my motors running so quickly so I use the buck converter to bring the voltage down to 5V. No matter what you are using to power the H-Bridge you will need to run a common ground from the H-Bridge to your Raspberry Pi.

If you are using a power source that is in the range of 4V - 7V then you may not need to use a buck converter. In this case, the leads coming from the power source can be connected directly to the H-Bridge. However, you will still need to run an extra wire from ground on the H-Bridge to a ground pin on the Raspberry Pi.

Install Buck Converter

place-buck.jpg

Find a spot to glue your buck converter into. Make sure you have access to the small screw located on the top of the board. We will be using this screw to adjust the output voltage.

Install LIPO Batteries

lipo.jpg

WARNING! Improper use of lipo batteries can lead to bodily harm or destruction of property. Make sure you fully understand the ins and outs of lipo batteries before implementing them in any project.
To secure my lipo batteries in place I used a velcro like material on the inside of the lid. This makes sure they cannot be easily poked or punctured by a pin.

Install HC-SR04 Ultrasonic Sensor

8C3403D1-301E-4973-A947-B231C818C036.jpeg
Find a spot to cut out holes for the ultrasonic sensor. Alternatively, the sensor can be mounted on top of the box. If building an autonomous robot is not your goal then you can omit the ultrasonic sensor as it won't be necessary to control the robot remotely.

Wiring

Screen Shot 2018-09-23 at 2.05.42 PM.png

If you would like to be able to copy the code from github and use it without any issues then you must wire your robot exactly as I am going to describe.

Dual H-Bridge

IN1 - GPIO 2

IN2 - GPIO3

IN3 - GPIO 4

IN4 - GPIO 17

Ultrasonic Sensor

VCC - 5V GPIO

TRIG - GPIO 27

ECHO - GPIO 22

The echo pin outputs 5 volts, the GPIO pins on the pi are only rated for 3.3 volts. Giving a GPIO 5 volts may cause damage to the pi. To avoid this we will put a voltage dividing circuit between ECHO and GPIO 22. To learn how to make a voltage divider, refer here.

Software

First off, you will need to have raspbian installed onto your Raspberry Pi. For more information on installing raspbian onto your Pi, check out this installation guide.

Once raspbian is booted up you will want to ssh into the raspberry pi. Here is a good guide on how to do so securely.

Once you have ssh'd into the pi, install git and 'clone' the files from this link:

https://github.com/Psuedohim/ARCRobot/tree/master/ARCRobot-1

This can be accomplished via:

git clone https://github.com/Psuedohim/ARCRobot/tree/master...

Finally to run the program, get into the ARCRobot-1 directory and run python3 go_auto.py.

.