
ZionPhil
USA
Asked
— Edited
I want to be able to use 3 of the Ultrasonic sensors at once on an EZB ver3. Is this possible? How would I do it in the ARC software? I only see the ability to use one now, or am I over looking something.
Instead of using a servo to scan, I want to be able to have one Ultrasonic sensor point forward, and the other 2 at 60 degree angles on the left and right of the one pointing forward.
Am I overlooking the ability to do this or is it not possible to use more than one Ping Sensor?
Thanks.
ZionPhil
Yes you can... you just use more ports and additional ping controls... very easy... You can also use scripts to replace the native sweeping ping control...
Great. Thanks Richard for the quick reply. I essentially would want a robot to turn and drive towards the ping reading with the highest number (obstacle avoidance). I have worked a little with the scripts in ARC and I am comfortable with making script calls to the open ARC windows and the buttons (functions) within them, but I am wondering if anyone has some sample code or an ARC file using 3 Ping Sensors out there. Thanks again Richard.
You don't even need to script it.
If you want to use them for collision detection just add 3 Collision Detection controls, configure the ports and the minimum distances and let it roll.
This will just stop the movement though, it will not avoid anything.
You could adapt my Ping Roam script to use 3 sensors and remove the servo. The scripts are commented (in fact in the one I linked to I even included my hand written notes on my original Ping Roam script).
If my script looks like it's what you want to use but with 3 sensors but you struggle to make the changes I'll gladly update it, it's something I need to do for Melvin at some point anyway but with one thing or another I've not gotten around to it.
Wow Rich. Fantastic. Thanks so much for the advice and program. I will give it a go and post results. Thanks again.
ZionPhil
@Rich . Hi Rich. I happen to have the perfect platform (IMO), for testing out many EZ-Robot modules. It's called Multiplo. It was a Kickstarter Robot Kit. It came with an Arduino Brain and HBridge on board called the DuinoBot. I built the 3 Wheeled Robot with Arm and Gripper.
ORIGINAL BUILD IMAGE BELOW:
As soon as I received an EZB 3, I immediately replaced the DuinoBot brain, with the EZB and the 2.5 Amp Motor Controller HBridge, to control the existing 2 servo Arm/Gripper and the 2 Motors for the front wheels...so I could do cool DJ Sures actions like below!
After I received Richard R's and your response today, I quickly prototyped a 3 Ping Sensor Array Rig and mounted it on the Multiplo Robot.
IMAGE BELOW
After arriving home I just wired all 3 Ping Sensors up and they are on the following pins:
Middle Ping Sensor Trigger D2 Echo D4
Right (Robot's Perspective) Ping Sensor Trigger D5 Echo D6
Left (Robot's Perspective) Ping Sensor Trigger D9 Echo D10
I downloaded your Ping Roam 1.2.0 Alpha Code and Merged the Script Manager with my existing Robot Code. Went smooth.
After looking at your PingRoam Script Manager window and then each script inside, I got a little confused as to how I would integrate a 3 Ping Sensor array and remove the servo code so that it just uses the left and right Ping Sensors instead of a servo to sweep. Basically the syntax.
Thanks for all of your input Rich. This code looks amazing. Going to try and play with just using the middle Ping sensor right now and removing the servo code if I can do it correctly.
@Rich . Ok after looking into your code a little further I see that the GetPing script is where I can add additional sensors. Excellent job on your #Comments in your code. I will give it a go.
*Quick Note. I noticed that the name of the script SweepCentre is spelled "C-E-N-T-R-E", but the servo call in the Roam script has it spelled "C-E-N-T-E-R".
actual code
$sweepcenter is making a string call to the script SweepCentre correct, or am I not understanding it correctly?
Thanks,
ZionPhil
ARC is not like C code for arduino... $sweepcenter in the context of your above example is just a variable (or constant)...it's not a call to a function... I myself am currently learning arduino and C.. ARC is far easier than Arduino C.... ARC code is almost like Basic (remember that ancient language) but way more powerful.... I haven't looked at Rich's code, but for simplicity sake you can use a repeatuntil loop that checks 3 pings with if statements....
Hang in there, you'll get the hang of ARC.... Simplicity, yet powerful.... all in one...
will he have to worry about a +5v regulator? or a 3.3? Cause it is going to get the voltage off of the ezb4?