When Will Mobile Ultrasonic Radar Scan Be Updated?


just wondering about the Ultrasonic scanner available on windows EZ builder but for mobile it always says not yet supported. Will this be added to mobile app? As it would make the mobile scripting and Blockly much faster to program and the radar scanner graphic would be a big help to see if the sensors are actually pinging. I am currently using script the hard way to get mobile sonar working,so with 2 sonars going it gets more complex when you can't see the red dot pings.


There is no date at this time for an ultrasonic radar control for EZ-Builder mobile. Consider using Blockly and creating a loop which moves a servo back and forth, while retrieving the ultrasonic distance value. If the distance value is less than a value you compare against, have the robot turn LEFT or RIGHT for a period of time.


Yes thanks DJ for the clarification on that sonar scanner. I have actually made mobile scripts that will either stop,turn, reverse or all 3 same time.Blockly is a fantastic tool to learn it as well. Love the fact that after Blockly you can always convert it to easy script after, for more complex commands to add on. However, once it becomes more complex, I seem to need a cardboard "old school" computer programmers Flow chart to figure out why or where did my pingers stop pinging,LoL! No real complaints here, the fact that I can program the bot on desktop PC and then upload the same program to the Android phone App to be used as a mobile robot anywhere in the world.....What a miracle of scientific Engineering ...and so much fun I don't even realize I am learning more now than I ever did in the technical schools. Smile


Here, try this out... I whipped it up pretty quick and don't have a way to test, but the variables are documented well.

1) Start and stop the script using ControlCommand()
2) The script is assuming 90 degree servo position has the sensor facing forward
3) The script assumes < 90 degrees is LEFT side of robot
4) The script assumes > 90 degrees is RIGHT side of the robot
5) The script assumes the servo scan range is 50 degrees to 130 degrees
6) The script moves the scanning servo 10 degrees at a time
7) The script TURNS the robot for 1 second (1,000 milliseconds)
8) The script pauses 250ms between scans and servo movements


# Initialize the servo to the starting position
Servo(D0, 50)

# Begin moving the robot forward

# Initialize the direction a servo will move
$ScanningDirection = "right"


IF ($ScanningDirection = "right")

# Move servo position 10 degrees to the right
Servo(D0, (((GetServo(D0)) + 10)))


# Move servo 10 degrees to the left
Servo(D0, (((GetServo(D0)) - 10)))


# Pause for a period of time for the servo to move

# Get the distance of the ping sensor
$PingDistance = (GetPing(D1, D2))

# Check if the detected distance is less than specified.
# If the distance is less, then we turn the robot
# the opposite direction the servo is facing.
# If no object is detected, we will continue to move the servo.
IF ($PingDistance < 100)

IF ( GetServo(D0) > 90)

# Object detected while on the right side so turn robot left


# Object detected whlie on the left side, so turn robot right



IF ((GetServo(D0)) >= 130)

# Set servo to start moving left
$ScanningDirection = "left"

ELSEIF ((GetServo(D0)) <= 50)

# Set servo to start moving right
$ScanningDirection = "right"




To start the script... use ControlCommand and the script name. For example...


# Start the scanning script
ControlCommand("Scanning Script", ScriptStart)

To stop the script... use the ControlCommand, the script name and STOP the robot from moving. For example...


# Start the scanning script
ControlCommand("Scanning Script", ScriptStop)

# Stop the robot from moving forward


Thanks for the help DJ, my bot is currently struggling to get out of a broom closet and seems unable to get out with my basic sonar script. Will try out what you got and see if it makes a big difference. Tongue


@robo rad, Have a look at this thread written by Rich as well. I've used the basis of his coding described in his tutorial to do exactly what you are trying to do. It's a great tutorial.


Hey that's a great find, looks like I will throw on some coffee and see what else I can learn tonight! Thanks bhouston as well!


So with my limited understanding of how the ultrasonic radar sweep works in the EZ Builder Windows ,with the radar sweeping,red dot graphics. I was trying to do something similar in the Android mobile EZ app. I was able to get some reasonable object avoidance but not 100 percent perfect, Sometimes robot will still hit something as if the sonar was missing a spot or off.Now my way of understanding was to start with Blockly as it had a sensor ping command block which I later switched to script code to add more complicated script. I really like what DJ Sures has written above for example codes. I shall try to see how his code works because I bet his code will be way more efficient and streamlined to work 100 percent of the time. What I need to know is how the heck does the windows radar scan work so good if my sensors are both non moving fixed to the body base with no servos to move them left and right? I am wondering if what DJ used in above code is similar to the windows radar graphic sweeping? Except it is pure code that can still work in mobile phone app. Is the sonar sensor sweeping by adjustment of the current/voltage? Sorry if I can't get my point across, am still curious how the sonar can see left to right with no moving part inside?I seem to remember the sonic pattern is cone shaped and should see objects in that cone pattern. Also just want to say sorry about all my previous posts about sonar but as it is easy for most coders out there, it was a struggle for me last few months.I am happy with how far I got it working on my phone App, the robot can perform out at shopping mall floors and children's hospital rooms with no need for computer,just the phone app running! Kids seem so delighted too. Most of the time avoids the walls and chairs but I do see room for improvements. Winky


@robo rad... I think you are a little confused... There are no moving parts in a ping sensor. The ping sees about a 15deg cone pattern in front of it only... The Sweeping action is done by mounting the ping on a servo which would sweep the ping back and forth like radar (covering a larger swath)... Look at the radar scan control... Notice the servo port listed in the settings? That is used to physically sweep the ping while the radar scan control is being used...


Hey there Richard, yes that is what I thought about these sensors but then I notice if I put my hand in front of it, I will see the red dot showing my hand on the windows graphic radar at one side of the animated sweeping Window. That confused me as it looks like the sonar is actually moving left and right when I know it is not really moving at all. How does the animation seem to work? If I put hand on right side of sensor, the red blip also will show on the right side of screen after the animated sonar beam moves to the right. Of course I know the sonar beam would be so much wider if I had a servo moving the sensor but it still seems to have the illusion of moving on the windows sonar animation. This is why I use 2 sensors front left and right and they both seem to show accurately where my hand is making a red ping dot ,even with no servos moving them....I know I always have trouble explaining things clearly but hope you see what I mean,LoL! Smile

Actually Just watched carefully the beam animation really is just nothing as I do notice the red dot will show all the way across the screen, not just one side.I think I understand it now,sorry guys, my mistake I should have watched more closely before.Like they say...learn something new everyday! Grin