Step 6: Arduino, Wires, and Battery - Shocking!

Picture of Arduino, Wires, and Battery - Shocking!
Alright, now it's time for the electronic components of the project to come together. The electronics in this project are very simple as you are just hooking up three motors to the arduino. The picture of the breadboard below shows how I set mine up. The battery pack is wired to the V-in and ground on the arduino. The V-in and ground is also sent to the two driving motors with the V-in going to the red motor wire, and the ground going to the black motor wire. Then I sent the two motor signal wires (white in my case) using yellow wire to the arduino pmw ports at 5 and 6 (my "left" motor is attached to pin 6 and the "right" is in 5).

For the servo I also attached it to the V-in and ground, and the signal wire to the arduino pmw port 3. Next, I secured my battery pack to the open space left on the robot. You also want this as close to the center of the robot (by the pen) so that the weight isn't distributed too unevenly. After this I just cleaned up the motor wires with some zip ties. 

You can also power the motors and arduino independently. Send the arduino's power source into the V-in and ground terminals on the arduino and have the motor's power source hooked up to the motors (make sure to send the motors' ground line to the other arduino ground pin). Then just send the signal wires to the appropriate terminals.