Connecting the Sharp IR Sensor

From ROBOTC API Guide
Jump to: navigation, search

Connection

The Sharp IR sensor has 3 connections:

  • Ground
  • Power (5V)
  • Signal (analog output)

Unlike the Lego products, which use Lego's own wire jack, the Sharp IR Sensor uses a type of connection is called a JST (Japanese Solderless Terminal). Unfortunately, the JST can't be plugged directly into the breadboard without a JST wire adapter. You can find these adaptors online at places like sparkfun.com. [1]

The Circuit

Sharp IR Sensor circuit schematic

Notepad.gif NOTE: ROBOTC currently configures the analog input pins slightly different from the wiring language (Arduino IDE). As such, it is necessary for the moment to use the resistor between the signal connection and ground.

Making the Connections

Connecting the JST to the sensor

First connect the JST connector to the Sharp IR sensor, and put the three wires on the other end of the connector into the breadboard

connecting the JST Connector cable to the Sharp IR sensor.
Lego Sharp Sensor Virtual Breadboard Connection.png
Lego Sharp Sensor Breadboard Connection.jpg

Adding the resistor

Since we need the resistor to get the right values out of the Sharp IR sensor, we should add it now. We're using a 10KΩ resistor, color code "Brown-Black-Orange".

Lego Sharp Sensor Virtual Breadboard Resistor.png
Lego Sharp Sensor Breadboard Resistor.jpg

Adding the wires

Finally, we add the wires in, and the Sharp IR sensor is ready to go! Remember that the connector to the resistor will need to be grounded in addition to the IR sensor's ground.


Lego Sharp Sensor Virtual Breadboard.png
Lego Sharp Sensor Breadboard.jpg

Mounting the IR Sensor

In order for the Sharp IR sensor to perform its function in this section, we must remove the ultrasonic sensor, and create a rig something like the one below in its place.

Lego Sharp IR Mounting Rig.png

The 4x1 Lego brick fits perfectly into the back of the Sharp IR sensor if you put it in diagonally and slide it up to the top, like so:

Lego Sharp IR With Mounting Rig.png

(You may want to secure the IR sensor to the brick with a piece of tape or something of that nature)

Then simply remove the axle and connector pegs and attach them to the robot about where the Ultrasonic sensor was

Lego Sharp IR Rig On Robot.png

Then just attach the IR sensor, and you are all set.

Lego Sharp IR With Mounting Rig Mounted On Robot.png

Notepad.gif NOTE: Due to supply issues, we used our own custom rig Sharp IR in the videos for this section instead of the standard Sharp IR depicted here