IR Range Sensor Reference Manual Revision: October 31, 2011 1300 NE Henley Court, Suite 3 Pullman, WA 99163 (509) 334 6306 Voice | (509) 334 6300 Fax Overview The IR Range Sensor is a great way to add range detection to robotic projects that use Cerebot boards. The sensor detects reflective objects 10 to 80 cm away. Features include: * * * a Sharp 2Y0A21 infrared sensor Futaba-style 3-pin connector an 8" Digilent cable Functional Description Cerebot Interface The IR Range Sensor is a three-terminal device that generates an analog voltage representing the distance to a reflected object. The Cerebot II's ADC analog pins are connected through servo pins S1-S8. Plug the IR Range Sensor directly into the onboard servo header, or use a PmodCON3 to connect up to four sensors via JH pins 1-6 or 7-12. The sensor connects to the ADC found on all Cerebot boards. The cable maps the output pins to a 3-pin connector. The yellow wire is for the analog output signal. The pin should be connected to the analog-to-digital converter (ADC) on your microcontroller. The red wire is the Vcc power supply to the sensor and is diode-protected against reverse polarization. The black wire should be connected to the ground of the ADC. The Cerebot MX-series boards require a PmodCON3 to access the Futaba-style connectors on the analog ports. The PmodCON3 exposes four ADC analog channels to the connectors. The PmodCON3 can be used on any Pmod header with ADC analog pins. Use a 4.5V to 5.5V power supply for the IR Range Sensor. The sensor's Vcc input range is 0.3V to 7V, and the analog output is 0.4V to 3V, depending on the distance to the object. Note: When using more than one IR Range Sensor, additional bypass capacitors should be used between Vcc and ground to filter out the switching noise generated by the sensor on the Vcc supply line. See the Sharp 2Y0A21 datasheet for recommended capacitor sizes. Doc: 515-009 page 1 of 2 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. IR Range Sensor Reference Manual The following table lists the PmodCON3 header pins used with different Cerebot boards. Board Cerebot II Cerebot 32MX4 Cerebot 32MX7 Cerebot MX3cK Cerebot MX4cK Cerebot MX7cK PmodCON3 Header Pins JH JJ JK JA JE JJ JK JA 1-6 or 7-12 1-6 or 7-12 1-6 1-6 or 7-12 8-12 1-6 or 7-12 7-12 1-6 or 7-12 You could also use the J6 terminal block on the PmodCON3 to supply power to the servo power pins on the PmodCON3. The PmodRS232 uses Pmod header JE pins 1-6 to send sampled data. Any serial port monitor that displays hex data will work. In the code, the UART is configured to send data at 57600 baud, 8 bits, 1 stop bit with no flow control. Note: The Cerebot II uses servo connectors S1-S8. The MX3cK PmodCON3 header J2 does not have an ADC pin, so only headers J3-J5 have ADC channels tied to the IR sensors. Cerebot 32MX4 Sample Project The following is the hardware configuration for using the IR Range Sensor with a PmodCON3, PmodRS232, and Cerebot 32MX4 board. The code for this project can be downloaded from the IR Range Sensor page at www.digilentinc.com. The IR sensor is connected to header J2 on the PmodCON3. The PmodCON3 is then connected to the Cerebot 32MX4 using Pmod header JJ pins 1-6 (the top six pins of the header). Pin 1 of the PmodCON3 needs to be connected to pin 1 on the Cerebot 32MX4. The Cerebot 32MX4 uses a 5V power supply. The Pmod header has the Vcc power selector jumper JPJ set in the VU setting; this connects the Vcc pins on the Pmod header to the boards' external power supply. The PmodCON3 has jumper JP1 set to the Vcc position to draw power from the Vcc pins on the Pmod header. www.digilentinc.com page 2 of 2 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: Digilent: 240-037P 240-037