The purpose of this vehicle is to be able to follow a black line on the floor, all while having a functional, remotely operated camera with a wide range of motion positioned on the front. The inspiration for this project was the desire to be able to capture low to the ground, moving camera shots.
Step 1: Materials
Roughly 1/2 square foot of aluminum
1- Car kit OR 2 DC Motors with attachable wheels, a self crafted frame, and a battery pack
1- Arduino: Uno
1- Motor Driver:TB6612FNG
2- Servo Motors
2- QRE1113 Analog Line Sensors- or equivalent
1- FS-R6B 6 Channel receiver
Potentially 1 acrylic sheet roughly 2 inches by 5 inches
1- FS-T6 Remote Controller
Step 2: Basic Car
You will need a car with two DC motors- this car frame can be found as a kit, which is what we did, or it can be made from scratch if so desired.
We recommend testing the motors first to see if they work. To do this, simply use the power source and connect it directly to the wires on the motors, and the motors should spin. Our car we used was old, so we found we needed to replace the motors.
Step 3: Wiring: Arduino and Motor Driver
The motor driver controls the two DC motors on the car. The two motor outputs (A01/A02 and B01/02) can be separately controlled. This gives the car the ability to turn as one wheel spins faster than the other.
PWMA to ~3
AIN2 to 8
AIN1 to ~9
STBY to ~10
BIN1 to ~11
BIN2 to 12
PWMB to ~5
VM to battery power (+)
VCC to 5V
GND to GND and battery power (-)
Step 4: Connect Circuitry to Car
There are three things that need to be connected between the circuitry and the car:
1.) Connect wires from the circuit board to the car battery. This will be VM to positive and GND to negative.(shown in the first picture, top left, red and yellow wires.)
2.) AO1 and AO2 to one DC motor
3.) BO2 and BO1 to the other DC motor
Step 5: Connect Sensors
In this step the two QRE1113 sensors get connected to the Arduino. The pins on the sensor are listed on the left, and the pins on the Arduino are listed on the right.
OUT to A1
VCC to 5V
GND to GND
OUT to A2
VCC to 5V
GND to GND
The sensors are what allow the car to detect the black line and follow it.
Step 6: Acrylic Sheet
We found that we needed an acrylic sheet roughly two inches by five inches attached to the back in order to fit the Arduino.
We drilled some holes in the top of the sheet, as well as some on the side of the bottom of the sheet that lined up with holes in the car and holes in the Arduino, respectively. We then zip tied the Arduino to the sheet and the sheet to the car.
We also found we needed to file down the acrylic in two spots to fit around a couple screws on the back of the car frame.
Step 7: Place Sensors
Place the sensors on the vehicle, in the front. You'll want to position them as close to the ground as you can. We achieved this via a handy cardboard box we found and some tape, as pictured above.
It is recommended that you run some tests with the sensors to make sure they are giving you values you want.
When they are not above the tape, you want very low values, around 100-150.
When they are above the tape, you want significantly higher values. Somewhere in the range of 700-900.
A good way to test this is to use some of the Arduino sample coding. This can be found in the Arduino coding program by going to file=>examples=>01.Basics=>AnalogReadSerial
This should open up a basic anolog reading code.
Go to the line that says: int sensorValue = analogRead(A0);
Change A0 to whichever analog pin you wish to test. If you followed our instructions thus far, it should be A1 and A2. You can then test the sensors one at a time by uploading this code to the Arduino and hooking up the power to the circuitry. To see the values, you need to go to the serial monitor. This can be found under tools or as a magnifying glass in the upper right hand corner of the window.
Step 8: Second Power Source
You will also need a secondary power source. This is in order to power the Arduino, unless you are so inclined to chase the car around while it's hooked up to your computer (not recommended). The easiest way to achieve this is via a 9V battery.
Connect the positive side of the battery into Vin, and the negative side into GND on the Arduino.
As for battery placement, we just set it on the Arduino, as shown in the picture above.
Step 9: Camera Mount
First, choose a motor. We used servo motors as our motor of choice, and so the diagram above is tailored to servo motors.
In the above diagram, you can see outlined the cuts to make out of a small sheet of aluminum. The smaller end of each rectangle is about 1 inch.
On the dotted lines, fold up. We recommend using a vice and a hammer to make the folds. On the top rectangle, the rectangle inside of that is a cut for the servo.
When we made it, we used some scraps from a previous project, but the above template is all you need to recreate the mount.
The circles are screw holes. You can use whatever size you want for the ones on the left, and the four holes in the upper right to mount the server just have to match whatever size the holes on the servo motor are. Unfortunately, I was not paying attention when choosing my drill bit, and therefore do not have the sizes.
Once you have those pieces cut out and folded, take two circular servo discs and cut similar holes to the ones on the left, so you can screw the aluminum plates to the discs.
The top rectangle should attach to the bottom servo on the left, and the top servo fits into the right side and screws in.
The bottom rectangle attaches to the top servo motor on the left.
When the entire thing is assembled, it should look like one of the above pictures (In that picture, the bottom servo is being held by the hand).
Step 10: Wiring the Camera Mount
Taking the radio receiver, attach the servo motors to whichever channels please you. The ground wire belongs on the far outside, and the signal comes from the pin on the inside. We chose to attach our base servo to channel 4, and our top servo to channel 2, because those channels aligned with the knobs on the controller we wanted to use. You can play around with it to find what best suits you and your servo motors
To power the receiver, choose any channel you're not using, and connect voltage to the middle pin and the ground to the far outside pin. The power source you can use is the same one that powers the DC motors of the car. All you have to do is use wires to connect them up.
Step 11: Attaching the Camera Mount
This can be done whatever way you best see fit.
We used a hot glue gun and glued the bottom of the base servo to the frame of the car, as pictured above.
It's recommended that you place it more towards the front of the car to place more weight on the front tires.
Step 12: Code
Lots of our base code for the motors was found at http://bildr.org/2012/04/tb6612fng-arduino/
We modified it to then suit our needs.
Our code is available for download below.
Basically it operates by first checking one sensor to see if it sees black tape, and then checking the other sensor. If neither sensor sees black tape, it just keeps going. If one of them does see black tape, the loop will adjust the speeds so that it turns. Because of the loop structure, if both see black tape, the first one will dominate other.
You may have to adjust some of the values in the code, depending on how you wired your circuit. The code is commented, clearly labeling what numbers do what.
Step 13: Add Camera
This step is pretty self explanatory. We used a gopro, and just taped it on. You could use a camera phone if you wanted, it doesn't really matter. Just keep in mind size constraints and the durability of aluminum when choosing your camera. If the camera proves too heavy and the aluminum starts to bend, you can always reinforce it with some wood or acrylic, or even more aluminum.
Step 14: Optional: Add Weight
We found that, since our Arduino and circuit board and literally everything else was positioned at the back of the car, our front tires didn't have enough friction and would often slip on the floor and not go anywhere.
We remedied this by placing a hunk of metal on the front of the car.
If this problem also occurs to you, simply place something on the front of the car. It doesn't have to be anything to heavy. I also found that my phone worked as a good counterbalance.