Asked — Edited
Resolved Resolved by Dunning-Kruger!

Hc-Sr04 Shows Only 255

I am trying to get the HC-Sr04 sonar to work with the EZB. I use the add for my project, select radar view and the value stays at 255. I am using port D0 and D1. Could the sensor be bad? It is brand new, just received it in box with other components.

thanks


ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

United Kingdom
#2  

Check it's wired correctly. Check the power to it is 5V (or less). Check the config of the control is set correctly.

#3  

Can you take a picture of your wiring to the ezb board? Check and see if you have it wired correctly...

*** Important do you have the inline voltage regulator installed?***

  1. Power = Red pin D0 (voltage reg'd to +5V)
  2. Ground = Black Pin D0
  3. Trigger = D0 (white pin)
  4. Echo = D1 (white pin)
#6  

In the second picture you have the ports reversed from the first picture (trigger and echo)... how about your wiring..? Is it connected to the EZB like my example above? (see post #4)

PRO
USA
#8  

I think I have the wiring correct, posted a close up photo

PRO
USA
#9  

its the port names only I have reversed..does that matter...the wiring is correct

#10  

The green wire and the white wire shouldn't they be plugged into D0,D1 white pins? Looks like from your picture you have the green wire plugged into the RED pin on the EZB...

Black wire goes to black pin on EZB (D0) Red wire goes to red pin on the ezb (D0) White wire will be either white pin of the EZB on D0 or D1 Green wire will be on white pin of the EZB either D0 or D1

#11  

Forget my last post... Try reversing green and white... Look at the back of the Ping make sure the trigger goes to the EZB on the correct pin meant for the trigger and the same for the echo wire... D0 is your trigger (white or green) and D1 is your echo (white or green)...

#12  

From your last post (picture)... Green is your echo (plug it into the echo on the back of the ping) D1... White is your trigger (plug it into the trig on the back of the ping) D0... make sure your ping control in ARC reflects that setup...

PRO
USA
#13  

I have white on trigger going to d0 white Then I have green on echo going to d1 white

nothing 255.

#14  

Ok... one last thing to check... is the voltage regulator outputting 5V? I see the led on in your pics, but that may not mean anything... Can you confirm with a multimeter?... If it is maybe you do have a duff ping sensor.... You'll need to contact ez robot and I am sure they will mail you out a new one right away...

PRO
Canada
#15  

Hi @dbeard,

Thanks for your photos they really help! A couple other quick checks for you:

The Default value of the Ultrasonic is 255 until an object passes in front of it, have you tried placing your hand in front of the sensor at a fairly close distance (ex: 6 inches)?

How high of voltage input are you providing to the EZ-B?

Do you have the voltage input (Vin) side of the provided Ultrasonic 5V regulator connected to the EZ-B side or to the Ultrasonic side? It should be on the EZ-B side.

#16  

Awesome Jeremie.... Never thought about the possibility the voltage reg could have been connected backwards... that might be it...

#17  

When this happened to me, I found that my Ping unit was fried. It just takes a split second to touch wires were they don't belong. You will be lucky if you haven't blown something. Good luck. I hope things will be fine for you. If you go back and see D.J.s video on HOW to do this, it will help.

my 2 cents.

#18  

Is there a new video showing how to use the ping with the inline voltage regulator? If not, the old video would not be much help to him... The ping could have been defective right from the factory.....

PRO
USA
#19  

Good Morning. I verified that coming out of the regulator is ~4.9 volts. That is the side going out to the sensor, so I think that is good. I think everything is working fine except for sensor. Have ordered a new one and will be very careful to connect correctly before applying power. Thanks for all the support and suggestions.

#20  

You probably didn't ruin the sensor... More than likely it was duff from the factory... Glad you got it sorted out though...

Richard ;)

United Kingdom
#21  

They are very sensitive sensors, even the slightest hint of static and they can play up.

PRO
USA
#22  

Just wanted to update the thread. Received new sensor and it is working. Appreciate all the help.

PRO
USA
#24  

Thanks again to everyone.

#25  

Hi, old thread here but just wondering, i picked up the 4 wire sensor utrasonic with no regulator so,can I just hook up ping and echo to the white signals on EZB-v4 but the +5v and ground separately to a 5 volt battery external,do I need to attach another ground also to EZ-B? Or just leave it absent? (signals ony)

edit.....So I tried it out with no other ground than the 5 volt ac adapter on the sensor with the radar window,it is showing multiple red dots near bottom but hand in front of sensor then shows a red ping further to top of radar window and motors go into obstacle turning so I guess I can just run the sensor with it's own battery and nothing but signal wires to white ports EZ-B?will his cause any future harm if no extra ground to EZ-B?

next edit.....so since I was getting crazy random pings everywhere,thought I would add the ground wire on eZ-B and then $$bingo all the random pings stopped,now i was getting accurate steady red dot line showing the roof as my sensor was facing the roof and when I put my hand in front of sensor it showed up a red dot on radar closer to bottom,think that's it ,working good! :D

#26  

Yes, this is a very common oversight/mistake for folks newer to robotics and electronics, you always need interconnected grounds or "commons". This is the return path for electronics, with out a shared common connection for the ground the circuit would not be complete.

Good job solving your own question @RoboRad

Also (you already appear to know this) but as a reminder, do not exceed the 5volts for your ultrasonic sensor or you will damage it.