Thumbnail

Ultrasonic Radar

How to add the Ultrasonic Radar 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 Ultrasonic Distance category tab.
  5. Press the Ultrasonic Radar 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 Radar robot skill.


How to use the Ultrasonic Radar robot skill

This robot skill uses an ultrasonic distance sensor mounted to a servo to sweep up to 180 degrees for objects within proximity. If an object is detected, the robot skill will use the current movement panel to have the robot reverse or turn away toward a clear direction.

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, sunlight or black materials do not affect their operation. 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 display the distance of a detected object/wall in front of the sensor on the radar display. The sensor is then mounted on a servo to sweep the sensor back and forth in a scanning motion to detect objects in a 180-degree radius.

If an object is detected, it is displayed by a little red dot similar to an army radar scanner. Optionally, you can use the Settings menu to control the current Movement Panel Skill. With this option selected, this skill will interact with a movement panel and automatically steer your robot away from obstacles. Another great feature of this skill is the "Scan only when moving forward" option. This ensures the scanner and object collision detection are only enabled when the robot moves.

This skill is integrated with scripting and will update when GetPing() is called (with the 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. Radar Display
This displays red dots representing a detected wall/object in a 180-degree space in front of the Ultrasonic sensor. The distance values are between 0-255, which corresponds to the detected distance being sent by the ultrasonic sensor.

2. Sweep line
This line represents the position that the sweeping servo is in.

3. Clear Button
This button clears the red dots from the Radar display.

4. Pause Checkbox
This checkbox pauses the ultrasonic distance value capture and the sweeping servo's movement.

5. Servo and Distance Values
This section displays the values of the Ultrasonic sensor and the servo position signal being sent.

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 to which 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. Servo Settings
This section sets up the sweeping servo. You can use the drop-downs to select the servo port and the minimum/maximum servo positions. There is also an "invert servo" checkbox, making the servo sweep the opposite way.

7. Increment Speed Drop-down
This drop-down adjusts the speed of the servo sweep. The range is between 1-36. The default value is 1.

8. Movement Checkboxes
These checkboxes control settings that interact with a movement panel within your ARC project. They enable different features, such as only scanning when the robot is moving forward, controlling the movement panel (automatic obstacle avoidance), and reversing before turning (backup then turn when an object/wall is encountered).

9. Minimum Distance Before Turn Drop-down
This drop-down selects the ultrasonic distance value as the minimum limit before the skill instructs the movement panel to turn the robot. The range is between 1-255. The default value is 20. This drop-down only works in tandem with a movement panel skill, and the movement checkboxes must be enabled to use it.

10. Movement Delay Drop-downs
These drop-downs adjust the Turn and Reverse delay values (how long they will activate) in milliseconds. The range is 10-5000 milliseconds. The default value is 250 for both. These drop-downs only work in tandem with a movement panel skill, and the movement checkboxes must be enabled to use them.

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
4-wire Wiring (with regulator)
  • 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 Ultrasonic Resolution

If you use an EZ-Robot ultrasonic distance sensor, false positives may come 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.


Resources


Synthiam has an ultrasonic hardware reference design here.


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

PRO
Germany
#1   — Edited

Feature Request, would it be possible to also send this skill as an output to the camera, such as in the skill "The Better Navigator"?

User-inserted image

send the actual picture ...

User-inserted image

Regards Uwe

.

PRO
Germany
#3  

That's exactly what I was looking for and couldn't find. Perfect, thank you ...

PRO
Synthiam
#4  

Haha that’s because I just made it when I saw your question

PRO
Germany
#5  

ahh, i was wondering why i didn't see it, but it's new, thank you very much.

#7  

Would anyone have any suggestions on how to use this and a Movement Panel if I wanted to use 4 ping sensors, one in each direction?

As I understand it, I would need to turn each ping sensor on and off before using it in order for them not to interfere with each other.

PRO
Synthiam
#8  

This robot skill uses one ping sensor mounted on a servo. You can scroll up and read the manual, which does a better job than me explaining it.

#9  

Excuse me I'm new to this one but have questions. Is this ultrasonic radar scan rotating? What does this ultrasonic radar look like, is it somewhat similar to 360 lidar? Once an object is detected is there a way zero in on it similar to camera tracking. Interesting material here any videos on it to show in more detail on how and what you can do with the data?

PRO
Synthiam
#10  

If you scroll to the top of this page, the information about the robot skill is there. It answers your questions better than I will by repeating it:)