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?


Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.


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

The V4 requires the regulator though.


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?



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.


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)


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.


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...


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.


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


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.



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


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

United Kingdom


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.


@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.


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


@Gerald, You said in one of posts;


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.


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.