How to add the Ultrasonic Collision Detection robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Ultrasonic Distance category tab.
- Press the Ultrasonic Collision Detection 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 Ultrasonic Collision Detection robot skill.
How to use the Ultrasonic Collision Detection robot skill
Ultrasonic sensors use sonar (sound navigation ranging) to determine the distance to an object or wall, the same way some animals like bats and dolphins do. They offer excellent range and accuracy in an easy-to-use package. Unlike infrared sensors, their operation is not affected by sunlight or black materials. However, they have trouble with soft fabrics; the sonar echo works ideally when bouncing off hard surfaces.When an HC-SR04 or equivalent Ultrasonic Distance Sensor is connected to an EZB, this skill will Stop a movement panel if an object is detected within the specified range. This skill does not cause a robot to steer or avoid obstacles; it merely stops the robot when the minimum distance is detected. For object avoidance and steering use the Radar skill.
This skill is integrated with scripting and will update when GetPing() is called (with matching port configured) and the PAUSE checkbox is checked. That way, you can have this skill on your project, but it won't use any communication resources unless it's called from a script with GetPing(). You can leave the PAUSED checkbox checked; this skill will be updated when GetPing() is called.
It's worth noting that the distance displayed is not a unit of CM or Inches. The distance value is an arbitrary number related to the sensor type, voltage, detected material, and temperature. If a specific distance unit is required, use a tape measure to identify the distance value.
Main Window
1. Ultrasonic Distance Value
This value between 0-255 corresponds to the detected distance sent by the ultrasonic sensor. If the value is red, it indicates that the collision min distance has been achieved. If it's green, the minimum distance hasn't been reached yet.
2. Bar Display
Displays a visual representation of the detected ultrasonic distance value.
3. Pause Checkbox
This checkbox pauses the capture of the ultrasonic distance value.
Settings
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 ultrasonic sensor is connected to.
3. Trigger Port Drop-down
Select the digital port that your ultrasonic trigger wire is connected.
4. Echo Port Drop-down
Select the digital port that your ultrasonic echo wire is connected to. *Note: This port must be the same as the trigger port when using a 3-wire Ultrasonic sensor.
5. Interval Drop-down
This drop-down selects the interval rate in milliseconds at which the ultrasonic sensor will be sampled. The range is 100-60000 milliseconds. The default setting is 250.
6. Minimum Distance Drop-down
This drop-down selects the minimum distance the ultrasonic sensor can detect before turning the ultrasonic distance value red and sending the Stop command to a movement panel. The range is 1-255. The default value is 30.
Wiring Diagram
Ultrasonic Distance Sensors come in 2 versions. A 4-wire type with/without an inline voltage regulator and three wires with/without a built-in voltage regulator. If an Ultrasonic has a voltage regulator, it will need +6V or greater Voltage input; if it doesn't, it will need +5V.
3-wire Wiring (with built-in regulator)
- Ground = Black wire to GND
- Power = Red wire to Vin
- Trigger/Echo = white wire to Digital pin
- Ground = Black wire from regulator to GND
- Power = Red wire from regulator to Vin
- Trigger = white wire to Digital pin
- Echo = green wire to a second Digital pin
Fix Resolution
If you use an EZ-Robot ultrasonic distance sensor, there may be false positives from the ping sound echoing within the casing. It is easy to fix with a few cotton balls inserted in the case around the sensors. Watch this video for detailed instructions.
Tech Detail Video
Resources
Synthiam has a ultrasonic hardware reference design here.
Related Tutorials
Related Robots
Related Questions
question
Wire Length For The EZB Ultrasonic Sensor
Hello folks, Figured Id throw this out there and see what others think...Has anyone ever had to install the EZB...
question
How Do I... Not Be Hopelessly Lost?
Im sorry for ANOTHER stupid question, but Im having a REEEALLY hard time following the Tutorials and searching for help...
question
Ultrasonic Radar Panel Bot Keeps Doing Circles
Hello everyone, Im using the HC-SR04 , works well but when using the Radar it detects then bot move back and just keeps...
Upgrade to ARC Pro
Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming