Your first robot
You've now learned enough to make a simple robot. Its purpose is to always be looking at the closest object. OK, it's not the most exciting robot, but it's a great demo of how you can combine what you've learned about the PWM and ADC subsystems.
For this, you will need:
- Breadboard
- 1x Sharp IR proximity sensor
- 1x micro servo motor
- 3x 1 kΩ resistor
- 1x 0.1 µF capacitor
- Jumper wires
Wire up the circuit on your breadboard, as shown in the figure:
The Sharp IR proximity sensor contains an infrared LED, an infrared detector, and some circuitry to drive them. The detector measures the amount of infrared light that is reflected back from whatever object is in front of it, which will vary depending on how close the object is, and a voltage is generated on the output which corresponds to the distance. It requires a 5 V supply to operate, and the output voltage can exceed 3 V. Therefore, a voltage divider is used to not exceed the ADC's 1.8 V maximum. The...