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
Step 2: Comparator Circuit
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
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
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
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
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
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
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 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!
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!