Asked — Edited

Distance Sensor

I got a problem when I got my distance sensor. Is there any tutorials that teach how to connect the distance sensor in EV4?


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

#1  

Which sensor, ultrasonic or IR ? Go to the top of this page, then select "Learn" then at the top of the page select "ARC Manual". Then scroll down to the type of sensor you have and watch the video. The. videos include the EZB(3) but the connections are identical on the EZB(4)

United Kingdom
#2  

The V4 requires the regulator though.

#3  

What I got is an ultrasonic distance sensor. It works in arduino uno, but when I try to connect it to ev4, it doesn't show anything.

I bought roli, and it has an ultrasonic with it when it came. I also bought several ultrasonic sensors which work fine in arduino uno. But when I test the roli ultrasonic distance sensor to the arduino uno, it didn't work in both 3.3v and 5v.

And I test both sensors to the ev4, none of them work.

I'm wander whether the triger pin and echo pin should connect to the analog or digital?

#4  

Digital.

Trigger on port 0 and echo on port 1 for example.

Red and black can be off of port 0 passing through a voltage regulator for 5 volts.

Then in ARC specify port 0 as trigger and port 1 as echo.

These are all digital.

#5  

Is it a 3 pin or 4 pin ping (ultrasonic sensor).... if it is a 3 pin like the parallax ping then you can specify the same port as trigger and echo... Either way you still need a voltage regulator in order to plug it into the ezb4 board (The power pin is not regulated to 5v like the arduino is)

#6  

Thank you all!

What kind of regulator do I need? When I got roli, it did have a small circuit within the cable, I guess that's the regulator, right?

And where can I buy regulator, because I may install multiple sensors to ev4 for my project.

#7  

Ez robot has them in their store... Or you can make one like I did using a LM7805 5V voltage regulator ... I simply spliced the 7805 into a servo extension cable...

#8  

What you got should be the regulator.

It will have two black wires going into it and 2 wires coming out. These wires will be black and red both going into and out of the circuit.

#9  

I did the way you told me, but it still failed to detect any distances.

What I did is connect trigger pin to port 23, echo pin to port 22, and connect ground and vcc pins to port 21, but ARC can't show any distance but 255.

Here are the images of my settings.

And I'm sure this ultrasonic distance sensor works because I test it in arduino successfully.

I'm not sure which step is wrong! User-inserted image

User-inserted image

User-inserted image

User-inserted image

#10  

Did you ever connect it without the voltage regulator? If it receives more than 5 volts, it will instantly fry and from then on will always show a distance of 255.

Alan

#11  

I did, the regulator is in the first image I uploaded, you believe you can find that.

#12  

As Alan said... if you hooked it up even briefly without the 5V regulator you might have just killed your ping....

United Kingdom
#13  

@Gerald.

As well as what Alan has already mentioned, another thing to check is if you wired up the regulator correctly, by that I mean EZ-B to "V IN" and "V OUT" to sensor. If it's reversed, that could damage the regulator and possably the sensor also. Check the sensor with the Arduino again and see if it's still working.

PRO
Canada
#14  

@Gerald I believe your issue is likely that you are using D23, we have recently found that it isn't working with the Ultrasonic please try 21 and 22, or 20 and 21. I have mentioned it to DJ and it's likely on the list to be looked at.

#15  

I connected mine with no problem. I believe that the regulator is in line, as stated already.

#16  

@Gerald, You said in one of posts;

Quote:

What I did is connect trigger pin to port 23, echo pin to port 22, and connect ground and vcc pins to port 21, but ARC can't show any distance but 255.
Try connecting the ground and VCC to the same pin as your trigger. For example: Vcc, Ground and Trigger - Port22 and Echo to Port 23. (You can any 2 ports) That's how I have mine set up and they work great.

#17  

Yeah, it is, port 22 and port 23 don't work, I tried port 0 and port 1, it works.

I think the problem is the original ultrasonic distance sensor that roli comes whit is broken. Because I believe I must tested it before when I first got roli, and it didn't wokr. Also, I test it in my arduino, it doesn't work neither.

Anyway, I finally figure it out, thank you for your help.