The AAA Robot is a perfect robot for beginners. It is versatile, easy to build, and discusses many of the topics roboticists need to learn, including but no limited to transistor switches, motor driving nad analog sensors. This Instructable includes step-by-step instructions on how to build your very own robot.
This robot has two modes, manual and automatic. In manual mode, one pair of sensors is compared on the left and right side of the robot and the code (attached in file) will compare the two readings and steer the robot towards the stronger reading. The automatic mode pretty much does the same, except you can switch between three sensors, using one at a time.
To build this robot you will need:
- LM 272 Op Amp
- Resistors (3)
* 1k Ohm (2)
* 470 Ohm
- 2N3904 NPN Transistors (2)
- 2N3906 PNP Transistors (3)
- Arduino Uno
- 9 Volt Battery
- 1n4148 Diodes (2)
- 5.6 nF Capacitors (2)
- Wires (approx 10 ft)
- Electrical tools (i.e.- soldering irons, wire clippers, etc.)
- DC Motors (2)
- Arduino Power Cable
When you have all your stuff ready, get your safety goggles and start building!
Step 1: Inserting the chip
Insert the LM 272 Op Amp with pin 1 on e1 on the breadboard. Then connect pin 4 to ground and pin 8 to voltage. RECALL THAT ALL TIE POINTS ON THE BREADBOARD IN THE SAME ROW ON THE SAME SIDE OF THE CHIP SLOT ARE CONNECTED.
Step 2: Comparator Circuit
Insert a 1k resistor from pin 2 of the 272 to ground and another 1k resistor from pin 6 on the 272 to ground. Connect pin 2 to b5 and pin 6 to d5. Then connect pin 5 to i5 and pin 2 to g5.
Now we'll hook up the outputs to the Arduino. Connect pin 1 of the 272 to pin 6 on the Arduino and pin 7 on the 272 to pin 7 on the Arduino.
After the comparator wiring iss finished, we can proceed to sensor triggering and transistor switches.
Step 3: RGB LED Hookup and Transistor Switches
First insert an RGB LED with the cathode at c14, red at c13, blue at c16 and green at c15. Place the 470 Ohm resistor across a14 and ground. This resistor will prevent the LED from drawing excessive current while giving it a nice glow.
Now that the LED is safely wired, we can start adding the transistor switches to power the leads and sensors. Since the comparator compares two voltages, we don't have to worry about the number of sources we hook up to the transistors. Insert one transistor with E at g12, B at g11, and C at g10. Connect the E pin to voltage. Connect C on the transistor to the red lead of the LED and to h18. Then, with jumpers, connect B to pin 8 on the Arduino. Insert the second transistor with E at h12, B at h13, and C at h14. Connect C to the green lead on the LED and h19. Using jumpers again, connect B to pin 9 on the Arduino. Insert the third transistor with E at h17, B at h16 and C at h15. Connect E to voltage and B to pin 12 on the Arduino, once again, using jumpers. Finally, connect C to the blue lead on the RGB and to h120.
The transistor switches and RGB LED are now done. Make sure your wiring is correct and that you are using PNP transistors.
Step 4: Motor Drivers
Now we'll build the motor drivers. In order to supply the DC motors we'll be using, we'll need to rectify the current and use a capacitor to hold the extra charge.
Take 1 5.6 nF capacitor and place it across a30 and a 26. Then place the other 5.6 nF capacitor and place it from j30 to j26. These Capacitors will hold the charge generated by the motor spinning.
Then place one diode (anode to cathode) from e30 to e26. Place the second diode from f30 to f26, once again, anode to cathode. These diodes will rectify the current supplying the motor.
Step 5: Motor Transistor Switches
The motor requires too much current and cannot be supplied by the Arduino. Therefore, we will use two NPN transistors. These will not only switch the motor on and off efficiently, but will also reduce the current drawn by the motors, which are notoriously hungry for electrons.
Insert one transistor with C at c26, B at c25, and E at c24. Hook up E to ground and B to pin 10 on the Arduino. Insert the second transistor with C at h26, B at h25, and E at h24. Similarly to the last transistor, connect E to ground and B to pin 11 on the Arduino.
Now we have saved our current supply while also building a neat transistor switch for our motor drivers. You can also modify the code to use PWM to control the motors now.
Step 6: Hooking up the motors
Now that we have our switches for our motors ready, we can hook up our rotary actuators (fancy fancy talk for motors).
First solder the two motors to two long wires. put the left motor facing to the outside of the robot. Look at the motor wire near the back of the robot. This will be called the rear lead. Repeat the process with the other motor. Connect the rear lead of the left motor to C of the left transistor. Connect the rear lead of the right motor to C on the second transistor. Then connect the remaining lead of both the motors to voltage.
We are now ready to drive our motors and have concluded the construction of our TTL-Motor driver circuit. Next we are going to discuss the options of automatic and manual modes to control the triggering of sensors.
Step 7: Adding switches
You will need the two center-off SPDT switches for this step. These switches will turn on the modes and sensors of the robot.
The first switch we will hook up is the mode switch. This will change the robot's mode. Connect the supply pin on the switch to voltage. Connect the two other leads to pins 2 and 3 on the Arduino.
Now we'll hook up the second switch. Connect the supply pin to voltage and the two other pins to 4 and 5 on the Arduino. This switch will switch between sensors in automatic mode.
Step 8: Manual mode configuration
This is where you can make your own decision of what to do. You may choose whether to go with the automatic or manual configuration. Fortunately, as we are using solderless technology, we can easily switch between modes with a few modification. This is where the true elegance of this robot lies. I suggest you try manual first and then go into automatic once you are familiar with the circuit.
Most sensor modules made for Arduino have three leads, naturally- +V, GND, and OUT. +V is the power source of the sensor, GND is the ground connection, and OUT is an analog output. You may make your own modules, but they will, most likely, follow the same format.
Connect the voltage and ground pins on the module to voltage and ground, respectively. Then connect the OUT pin to any unoccupied row on the breadboard. do this process to both the left and right sides of the breadboard. Connect the left OUT row to c5 and A0 on the Arduino. Connect the right OUT row to h5 and A1 on the Arduino.
Now to switch to manual mode, turn on the robot. Insert the red LED from pin 13 to ground on the Arduino. Move the mode switch until you see this LED light up solidly. Then move the switch to the middle position. Now your Manual mode robot is ready to run.
Step 9: Automatic mode configuration
The heart of this robot lies in its ability to manipulate a variety of sensors to properly assess a room. You can switch between sensors on Automatic mode. As I mentioned before, please familiarize yourself with Manual mode first. If you are ready, you can now start optimizing the potential of the AAA Robot
The PNP transistor switches we built earlier will now be used. Connect the +V pins of the first pair of sensors to g18, the second pair to g19, and the third to g20. Connect all of their GND pins to ground. Then hook all the left sensors' OUTs in one unoccupied row on the breadboard. Do the same for all the right sensors.
Now the automatic mode works very similarly to the manual mode. Since you have connected three of the OUT pins on one row, there are two tie points remaining on that row. Connect one tie point on the left to A0 on the Arduino and the other tie point to c5. On the right, connect one of the remaining tie points to A1 on the Arduino and the other to h5.
Now you are finished with the automatic mode configuration. Hooray for you!
Step 10: Troubleshooting, Encore, and More!
Now that you are done building the robot, you can give yourself a pat on the back. Check all your wiring before you launch the robot. You may alter the code of the robot if you wish, as it has been designed to be hacked and modified.
If you are facing problems:
- Check your wiring
- Update your driver
- Switch the motor wires
- Leave a comment and I will reply ASAP
Well, I hope you enjoyed building this robot. Good luck to your future builds!