This is a simple Arduino-based robot which uses photoresistors to follow a black line printed on white paper. This was done as part of Mechatronics class at Rowan University in the 2015 spring semester.

Step 1: Materials

(1) Arduino Uno or similar board

(2) CdS photocell

(2) 10kΩ resistor

(2) Continuous rotation servo

(2) 1MΩ Linear Rotary Potentiometer

(1) 9 volt battery to Arduino power cable

(1) 4xAA battery pack

(2 sq. ft.) 1/8" plexiglass

(5 ft) Copper wire, 18 gauge

Assorted nuts and bolts

Step 2: Design

A simple body was designed to be cut from 1/8" acrylic using a laser cutter. Solidworks and vector schematics are available below. The body of the robot was designed around the components it was required to fit, therefore the width of the body was determined largely by the width of the servos used for the wheels, and the length was chosen to fit both the Arduino Uno board, servo battery pack and Arduino battery. It was decided to use a simple hardpoint for the rear pivot, in the form of a 1/4" button head bolt, because the robot was designed to run on a flat, hard surface, which was not anticipated to pose problems to such a simple method of rear support.

Step 3: Robot Assembly

The robot body was cut on the laser cutter using the files in the previous step. The body was then assembled using superglue, and the servos were installed. The rear bolt was installed, and the AA battery pack for servo power was attached. The photoresistors were attached to the front of the robot body, mounted on lengths of cat5 cable such that their position was easily adjustable and stable.

Step 4: Autonomous Operation Circuitry

As shown in the image, the circuit for operation is relatively simple. One servo and one photoresistor are shown on the diagram for clarity, however the other servo and photoresistor were connected similarly, but on pins 6 and A1, respectively. The servo is connected such that it receives power from the AA battery pack, as the 9V Arduino power is insufficient to deliver the necessary current while also maintaining power to the Arduino. The signal pins from the servos are connected to Arduino digital pins 6 and 9, for speed control of the servo. The photoresistor circuit is a simple voltage divider, with the analog pins A0 and A1 used to measure the signal in the middle of the divider, which changes based on the level of light received by the sensor, and is calibrated in the code.

Step 5: Autonomous Operation

Arduino code for the autonomous control of the robot is available below. The robot functions by reading in values from the photocells on either side, then performing actions based on those values. For instance, when the left sensor reports seeing a darker image, it means the robot has encountered a left turn, and thus will turn its right wheel forward and its left wheel in reverse; vice versa for a right turn scenario. For cases where no dark image is seen (on a straightaway), both wheels turn forward until they encounter a turn. In the event where both sensors report a dark image (perhaps on a sharper turn), both wheels again turn forward, until a resolution is found on the track. A video of the robot running autonomously is embedded.

Step 6: Controller Assembly

Because manual control of the robot is also desired, a simple controller was created using linear rotary potentiometers, the circuit for which is shown in the image. A single potentiometer is shown for clarity, however the second potentiometer was connected similarly, with the exception that the signal pin connected to Arduino pin A5. The controller was then set up in Arduino code such that one potentiometer controlled the speed of the motors, and the other potentiometer controls the turning. This is shown in the next step.

Step 7: Manual Operation

Manual control of the robot is straightforward using the two-potentiometer setup outlined in the previous step. By turning the left potentiometer, the speed of both servos is either increased, set to zero, or reversed. In addition, turning the right potentiometer controls the turning action of the robot; spinning it to the left causes the left servo to run in reverse and the right servo to run forward, and vice versa for a right turn. There is a middle ground for the potentiometer where no turning can happen to allow easier control for the robot to stay on course. A video of the robot being manually controlled is embedded.

About This Instructable




More by tmauriello:Arduino Balancing Robot Line Following Robot How to make an origami cube 
Add instructable to: