Sharp IR Collision

How to add the Sharp IR Collision robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Infrared Distance category tab.
  5. Press the Sharp IR Collision icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Sharp IR Collision robot skill.

How to use the Sharp IR Collision robot skill

Sharp infrared (IR) distance sensors are a great way to determine the distance to an object or wall, using reflected infrared (invisible) light. They offer excellent range and accuracy in an easy-to-use package. Their operation is not affected by soft materials, as ultrasonic sensors are. However, they do have trouble with sunlight interference and black materials that are transparent to IR.

When connecting a Sharp IR distance sensor to an EZB's ADC (Analog Digital Converter) port, this skill will stop a movement panel if an object is detected within the specified range. This does not steer or avoid obstacles; it merely stops a robot when the minimum distance value is detected. For object avoidance and steering use the Radar skill.

This skill displays the ADC voltage as a value (between 0 and +5 VDC), as a VU meter, and as a linear representation of the voltage value (between 0 and 255). The voltage from a Sharp IR sensor directly relates to distance, check your sensor's datasheet for the conversion from voltage to distance unit.

*Note: Most Sharp IR sensors require a voltage supply of 4.5V to 5.5V. Check your sensor's datasheet. If you use 3.3V to supply a 5V sensor, the readings will be way off. If your EZB I/O Controller of choice doesn't output 5V, use an external 5V regulator.

Main Window

1. Sharp Sensor Distance Value
This is a value between 0-255 that corresponds to the detected distance being sent by the Sharp sensor. If the value is the color red it indicates that the collision min distance has been achieved. If it's green the minimum distance hasn't been reached yet.

2. Voltage Value
This is a value between 0-5V that corresponds to the detected voltage being sent by the Sharp sensor. The voltage is directly proportional to a distance unit. See your sensor's datasheet for details.

3. Meter Display
Displays the Sharp sensor value in a VU meter format.

4. Pause Checkbox
When checked the Sharp sensor readings will pause.


1. Title Field
This field contains the title of the skill. You can change it if you'd like.*Note: Changing the title will also change the title in the controlCommand() associated with this skill.

2. Board Index Drop-down
Select the EZB index number that your infrared sensor is connected to.

3. Port Drop-down
Select your ADC port number.

4. Interval Drop-down
Select the wait time in milliseconds between ADC samples. The range is between 100 to 60000. The default value is 500.

5. Minimum Distance Drop-down
This drop-down selects the minimum distance that the Sharp sensor can detect before sending the Stop command to a movement panel. The range is between 10 to 254. The default value is 30.

Wiring Diagram

Sharp Infrared Distance Sensors come in a variety of different types. The differences are usually in terms of range but some can be powered by 3.3V. The majority of the sensors require 5V. If you are powering a Sharp sensor with a voltage over 5V make sure you have a voltage regulator inline with the sensor.

3-wire Wiring (unregulated)
  • Ground = Black wire to GND
  • Power = Red wire to +5V or +3.3V (Sensor dependent)
  • Signal = white wire to ADC pin
3-wire Wiring (regulated)
  • Ground = Black wire from regulator to GND
  • Power = Red wire from regulator to Vin (>+5V)
  • Signal = white wire to ADC pin

How to use Sharp IR Collision

1) Connect a Sharp IR distance sensor to an EZB.

2) Add the Sharp IR Collision skill to your ARC project (Project -> Add Skill -> Infrared Distance -> Sharp IR Collision).

3) In the skill settings select the ADC port that you have the Sharp sensor plugged into.

4) Connect a Robot to EZB + Sharp sensor.

5) Add a Movement Panel Skill to your ARC project (Project -> Add Skill -> Movement Panels).

6) Start the Robot on it's movement trajectory and watch it stop when the Sharp sensor's minimum distance is detected.



An EZB I/O Controller with analog ports and a infrared distance sensor.


Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.