Asked — Edited

HC-SR04 Ping Sensor

This tutorial demonstrates how to wire a HC-SR04 Ping Sensor to the EZ-B for use with the SDK or ARC software.

This sensor is very affordable compared to the Sharp IR Distance Sensor. They are going for around $14 USD shipped off ebay.

Ebay Link

Gnd = black Pos = red Signa = white (or sometimes yellow)

For this sensor, you will need 2 servo cables. One set of wires on the cable will be used for Positive, Gnd and Trigger. Only the Signal wire will be used on the second cable to connect to Echo.

The Gnd and Pos on the second cable can be cut because they will not be used.

User-inserted image

User-inserted image


Upgrade to ARC Pro

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

United Kingdom

I couldn't find the HC-SR04 sensor readily available in the UK so I used the SRF04 by Devantech available from the excellent Active Robot Site

It has 5 connections 1 of which is not used and seems to work just as well:)


That's super! Thanx for the info:D


For some reason, the IC chip on the T side of my HC-SR04 gets REALLY hot very quickly. Any thoughts on what might be causing this?


Check if it's connected to your EZ-B correctly, the last time I had that I had them connected the wrong way and the mysterious blue smoke came out.

(wrong way = signalwire (the white/yellow one) facing the inside of the EZ-B)


I've confirmed that everything is wired up properly. The Ping Sensor control panel was working fine for a few minutes. Then it shot up to 255 and the IC chip started heating up again. The settings are on 250ms interval. Anyone else experiencing this?


Hey guys, I need assistance with my ultrasonic (HC-SR04) distance sensor. I never was able to have it work properly. I have watch the tutorial over and over, check my wiring over and over and it simply refuse to behave properly. I order a new set of 5, coming all the way from China, playing the waiting game. Is it possible that I may have short circuit the ultrasonic board by mistake ?

User-inserted image

User-inserted image

United Kingdom

According to your diagram you look like you are using D8 for the Trigger signal and D9 for the Echo

Yet the notepad says D4 for the trigger and no port for the echo?

Sorry didnt see that D5 for the echo


Diagram is simply for show and tell was easier to draw D8 and D9. I am using D4,5

United Kingdom

Ok thats good looks like your wiring is correct then

Have you tried another ultrasonic control just on its own like Ping distance?


Yes I have and it is only ready a set value of 20, nothing else. I have tried adding a bunch of object different shapes, size and colors. Still nothing confused stress

United Kingdom

Err sounds like you are talking about the camera control?

what reading do you get when you hold your hand right in front of the sensor?


still reading at 20, nothing change. I am about to use servo wires, what i have learn so far "never assume".


Still No luck, I'll just wait for the new ones to come in stress

United Kingdom

What cables are you using? I found an old topic a few weeks back about poor quality extensions causing problems with the ultrasonic sensors, it may pay to try better quality cables. Also, I'm pretty sure I read that voltage is very important with these things, make sure you are supplying enough power to the EZ-B to ensure a constant 5V from the digital ports. Hook up a flylead from VCC of any digital port to signal of an ADC and read the ADC to check the voltage if you don't have a meter.


I switch to bench power supply and is reading a little above 5V.

United Kingdom

You need to try a new sensor then and be careful when soldering the fly leads dont get the pins on the sensor too hot


I have the same problem here. Double checked and treiud everything in the thread, no change. Maybe sensor is defect?

Update: Received new sensors today (ebay 9 EURs for 5 sensors) and it works now.