by subpilot » Sat Mar 18, 2006 10:05 pm
by subpilot
Sat Mar 18, 2006 10:05 pm
Here's a cheap and simple way for people to get started with adding external sensor functions. Pick up a Sharp GP2D120 Infrared sensor
http://www.acroname.com/robotics/parts/ ... 2D120.html
It has an analog voltage output representing the range from the front of the sensor to an object. All you have to do is add a plug and plug it in to an unused analog port.
For the board connector I use Digikey part# WM2801 with WM2555 pins.
http://rocky.digikey.com/scripts/Produc ... 50-57-9003
You can use a Radio Shack crimper to do the pins if you're careful but I recommend getting a Universal Crimp Tool (Molex)
Wire the connector with the red wire in the center and the black and yellow wires in the other two holes. Plug the connector into port AD0 (see page 42 of the manual) with the yellow wire inboard and the black wire outboard.
Here's a bit of code to make the robot backup if he senses something in the sensor range.
a=AD(0)
IF a > 100 THEN GOSUB k12
You can add more sensors and just plug them into more AD ports. Note that AD6 is used for battery voltage sense and AD7 is used for the IR link.
Here's a cheap and simple way for people to get started with adding external sensor functions. Pick up a Sharp GP2D120 Infrared sensor
http://www.acroname.com/robotics/parts/ ... 2D120.html
It has an analog voltage output representing the range from the front of the sensor to an object. All you have to do is add a plug and plug it in to an unused analog port.
For the board connector I use Digikey part# WM2801 with WM2555 pins.
http://rocky.digikey.com/scripts/Produc ... 50-57-9003
You can use a Radio Shack crimper to do the pins if you're careful but I recommend getting a Universal Crimp Tool (Molex)
Wire the connector with the red wire in the center and the black and yellow wires in the other two holes. Plug the connector into port AD0 (see page 42 of the manual) with the yellow wire inboard and the black wire outboard.
Here's a bit of code to make the robot backup if he senses something in the sensor range.
a=AD(0)
IF a > 100 THEN GOSUB k12
You can add more sensors and just plug them into more AD ports. Note that AD6 is used for battery voltage sense and AD7 is used for the IR link.