Bill Of Materials

To be purchased

Components

Wired Connectors

Arduino Uno: The brains of the robot. Mircocontroller that takes in input from the camera  decides what to tell the motors to do

L298 Motor Driver: Takes input from the Arduino to control speed and direction of each motor

Pixycam 2Analyzes video footage in real time of the ground in front of the robot and reports back to the Arduino where the lines and intersections are in its field of view

DC Motors and Wheels: Take input from the motor driver to know what speed and direction to run. Can go forwards or backwards and in different directions from each other

Caster Ball: Provides robot a third point of contact with the ground for stability. Free spinning and allows robot to turn with ease

Female to Male Jumper Wires: Come with motor diver. Connect pins of motor driver to Arduino

USB to Barrel Jack connectorConnects battery to Arduino to supply power

USB to Exposed WireConnects battery to motor driver to power motors

Ribbon Cable: Comes with pixycam. Connects camera to Ardunio

MicroUSB to USB: Comes with pixycam. Connects computer to camera for programming and monitoring purposes

To be printed

Chasis: Body of the car where all other components are mounted

Caster housing: Keeps caster ball in place horizontally while inducing minimal friction

Caster shroud: Not visible once in place. Creates low friction surface for caster ball to freely move around while maintaining vertical distance from bottom of car

Chasis and caster shroud design by engineers at NVIDIA, creators of the jetbot

Assembly

Once all components are acquired and printed, 3D prints must be cleaned and excess support material must be removed and filed down. 

Solder wire to each lead of each motor if they did not come pre-soldered. I like to apply a small bit of hot glue over the solder to give the flimsy leads extra support. Place the motors on the underside of the chasis and slide into place. Then us the nuts and bolts that came with the motors to secure them in place.

IMG_1226

Wire motors to motor driver using screwdriver to secure leads. Using hot glue, mount motor driver to bottom on side without circular indent. Orient so blue terminal blocks are closest to outside edge of car. 

Place smaller flat end of caster shroud in circular indent on bottom on car. Then place caster ball on top. Finally, encase both with caster housing. Using #4 self tapping screws, secure housing to bottom of car in preprinted holes.

Attach the wheels to the motors. This is hard to do the first time and takes patience to line up perfectly. When properly aligned, wheels should pop onto motor shafts with some force.

Using hot glue, mount clear arduino base to top of car so that barrel jack is facing away from the wheels. Do not glue arduino directly to car. .

Using hot glue and angle brackets that came with camera, mount camera to top of car directly above motor driver. This is now the front of the car. Using ribbon cable, connect camera to arduino.

Cut and strip the two usb cables and separate ground and power wires. One needs to reach from the back of the battery to the motor driver. The other needs to reach from the back of the battery to the barrel jack connector on the arduino. Solder jumper cables to the longer cable and screw these into the motor driver. Black goes to ground and red goes to 5V. Screw ends of shorter cable into terminals on barrel jack terminal block. Now all components will have power when battery is turned on.

Separate group of 6 male to female jumper cables. Attach female end to motor driver and male end to arduino.

Below is a schematic of the overall circuit for simplicity

That is it for the physical assembly of the car. Now on to the software.

Code

Motors

L298 motor driver can control two independent groups of motors. On the right is a circuit diagram showing how to wire the motor driver to the motors and Arduino. 

The pins connected to the red, orange, and yellow wires control the left motor. The green, blue, and purple wires control the right motor. 

Orange and yellow act as power and ground. When you want to run the motor in one direction, you would treat the orange as power and yellow as ground. If you want to reverse the motors direction, yellow becomes power and orange becomes ground. The same applies for blue and green for the right motor. 

To control the speed of the motor, the red and purple wires come into play. Maximum speed corresponds to a value of 250 and minimum is 0. 

Check out Arduino’s page on the L298 motor driver to learn more.

Below on the right is a screen shot of arduino code used to control the motors. On the left, I explain what each line is doing.

Initialize motor arduino pins we are going to use and set them as outputs. This means they will only give information to the motor driver and not receive any feedback. 

 

Code will run through this loop section continuously until power is turned off. Here, moveRobot function is called and tells the left motor to run forwards at speed 170 while right motor does not move at all. After 1000 milliseconds (1 second), moveRobot is called again but this time tells left motor to run at -170 (backwards) while right motor stays stationary.

moveRobot is the function that controls how fast and in what direction motors move. It takes in a leftSpeed and rightSpeed.

If left speed is positive, pin 3 is power and pin 4 is ground. This causes the left motor to turn forwards.

If left speed is negative, pin 3 is ground and pin 4 is power. This causes the left motor to turn backwards.

 

The same applies to right motor.

 

 

 

 

 

Once direction is figured out above, speed can be set. Pin 5 controls the speed of the left motor and pin 0 controls the speed of the right.

Camera

Check out the PixyCam website to get familiar with the camera and its built in functions. 

The Pixycam camera does all of the image processing for the system so the arduino does not have to. It is analyzing its video feed at a rate of 60 frames per second and reports back to the ardunio the location of objects of interest in its field of view.

The camera sees objects and lines by distinguishing between pixels of different colors. It had a built in line tracking program that detects lines and intersections.

Made by Juliet O'Riordan

Updated April 2021