Creative Commons images are CC BY 2.0

Description: This is the HC-SR04 ultrasonic ranging sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit.

There are only four pins that you need to worry about on the HC-SR04: VCC (Power), Trig (Trigger), Echo (Receive), and GND (Ground). You will find this sensor very easy to set up and use for your next range-finding project!

Features:

  • Operating Voltage: 5V DC
  • Operating Current: 15mA
  • Measure Angle: 15°
  • Ranging Distance: 2cm - 4m

Documents:

Recommended Products

Customer Comments

  • ——————– Tech Support Tips/Troubleshooting/Common Issues ——————–

    Acoustic Noise

    Just like any ultrasonic sensor, this product can be sensitive to other ultrasonic sensors and acoustic noise in the area. If your readings are jumping down to 0 inches even though you have an object placed a few inches away from the sensor, it could be due to interference caused by other ultrasonic sensors and your environment. If you have more than one ultrasonic sensor, try to turn each one on individually after a certain amount of time. If there is a lot of noise and and an HVAC in your area, it’s possible that it is tuned just enough where it interferes with the HC-SR04 ultrasonic range finder.

    Doing a quick search online, there is research [ https://www.bannerengineering.com/us/en/company/expert-insights/ultrasonic-sensors-101.html#gs.KxQbtoQ ] indicating that acoustic noise can cause problems with an ultrasonic sensor. Further research indicates that an HVAC can cause interference for 25-40kHz ultrasonic sensors [pg 10 - http://www.lrc.rpi.edu/programs/NLPIP/PDF/VIEW/SROS2.pdf ]:

    "For the open-office testing, the room’s HVAC system was turned off for testing the ultrasonic occupancy sensors since these products can be affected by the HVAC system..."
    

    The HVAC used in our custom made building was actually tuned just enough to interfere with the sensor’s reading in certain parts of our building. We had issues getting it to work reliably in our education department wherever we heard the acoustic noise.

  • Pro tip: you can tie the trigger and receive pins together and save yourself a pin. They’re never active at the same time. The receiver is locked out for a very brief period after the pulse is sent (if I had to guess, I’d say about how long sound takes to travel 2cm and back.) Search for SRF-04 if you’re trying to find a good datasheet.

  • I haven’t used this particular version before, but I’ve used a similar version and it works ok. A capacitor across VCC-GND did wonders stabilizing readings (1uF - 3.3uF). Not sure how much range you will get without the MAX232 (that was used as a voltage stepper which “rang” the ultrasonic speaker at +12/-12). The PING is significantly more robust, but it is more expensive no doubt.

    Following is some useful information. Hopefully it helps someone.

  • Valen / last year / 2

    This one seems significantly different from other HC-SR04 modules. It seems to lack the 3rd chip, a MAX232-like chip (TTL to RS232 chargepump converter) to boost the transmitter voltage. Not sure if this means less performance though, since I’ve read that it could also be the source of internal ringing noise in the detection circuit. Could be interesting to test and compare.

  • This device operates with an audio signal at 40KHz. That is within the hearing range of cats and dogs. I would never use this in a project that would operate in or around my home.

    • So.. that’s interesting, because I was actually coming here to post a question about it’s ability to DETECT a cat.. The video says it works best with a flat surface (of course) but if I just need to detect the existance of a fluffy cat getting ready to jump up on a birdcage, would it work… OR, would the 40khz be annoying enough to keep the cat away, and/or should I NOT do it because it will annoy/hurt the canary?!

      • We have a cat that would sit outside our bedroom door and cry incessantly for food promptly at 4:00 am. This was obviously driving us insane. In a sleep deprived stupor, I purchased a few items from Sparkfun (Ultrasonic sensor / 16x2 LCD / Voltage regulator / Power supply) and acquired a Particle Photon, 10V solenoid, a toilet flange from Home Depot and an air can. I can say that this sensor will most definitely detect cats. When triggered by the sensor, the solenoid pumps the air can for a quick second of PSSSSSSSTTT!!! followed by sweet silence. Thank you Sparkfun for a restful sleep!

      • I have not used this particular sensor, but, based on my past experience with similar ultrasonic sensors, you will not detect a fluffy cat with it. (The sensors I have used before even struggled to detect clothed humans…naked humans (or shaved cats?) do seem to be reflective enough. YMMV).

        Of course, if you can shoot at a wall or other hard surface in a no-cat state and then look for a major change in that reading as the cat absorbs the sound, you might be in business…

    • Chiel / last year / 1

      Many sonar sensors use 40khz as it’s working frequency and yeah that is in within hearing range of animals, But the pulses created by sonar sensors are very short and not at all powerfull. It is not harmfull and none of my cats have ever responded even remotely to any of my sonar sensors, not even a twitch in the ear.

  • Can this detect the distance to a surface of water? Thinking of mounting it above a fish tank to measure the water level.

    • Measuring tanks, grain silos and the like is a major use of ultrasonic sensors. The ones used in industry cost about $30 (just for the transducer) and have longer range but this hobby grade device would work for smaller tank. these have a wide angle of vie and might detect the tank rim. They trigger on the closest object. Somount it low and near the tank’s center might

  • possible to generally detect rocks couple inches under the ground?

  • Not surprised these things sold out so soon. They’re incredibly popular and useful. Good job SparkFun on making these available in your store.

  • Works well, but is inaccurate below 20 cm and on non-flat surfaces (such as hands), if powered with 3V3. I suggest to take the average of several values to get a more precise measurement The example code didn’t work on a teensy, as the echo pin is not explicitly declared as input. Hope this may help someone else

  • FYI, at 5v I get garbage readings and lots of OUT OF RANGE from the sample code, but at 3.3v all is smooth and accurate.

  • I just read over the datasheet. Somebody please get the maker to correct the errors! Lots of technical errors and even more language errors. That said, this is sure cheap - hope it works.

  • Sort of the opposite of member #114323’s comment - I noticed this is about 1/10 the price of the Parallax PING Ultrasonic sensor which I usually see retail for around $30 (e.g. Jameco Electronics p/n 282861). Does Parallax just have an insane markup, or is there some quality/accuracy difference that explains the huge price gap?

    • Chiel / last year / 1

      Sonar sensors have gotten pretty cheap over the past decade. I remember each costing atleast 15$ as a minimum and the Ping))) costing 30$ back then aswell. Now you can get sensors for a few bucks a piece. So i would guess that the Ping is just a older more expensive sensor.

      To be fair tough looking at the back of the ping it is a little more complicated in design and probably a little bit more complicated. The SR04 is pretty simplistic. can’t say for certain tough.

    • bfesser / last year / 0

      Parallax makes (or made?) huge profits by selling to schools. Hence, product names like “Board of Education”. They don’t really focus on individual customers (makers). Because of this, their prices have always been ridiculously high. I remember buying a BS2 rev. B from them back in the day for $50! I don’t know if Arduino existed yet or if I just wasn’t aware of it.

      • Matix / last year / 10

        Hi, I work at Parallax and yes, we do sell the PING))) for much more than the HC-SR04. Quite a bit is happening in the micro on the PING))), allowing it to work in noisier environments more accurately with high resolution.

        As much as I wish we did, we don’t make huge profits - We cater to schools, and schools need durable, reliable parts and in-depth, thorough documentation and support. All of our revenue gets reinvested in making open-source curriculum materials for schools and R&D on future products that support maker education. Hobbyists are comfortable digging around the web to find what they need to get a project of the ground, but students and teachers don’t usually have the patience or the time, so we work hard to get everything they need in one place and as user-friendly as possible.

        I know Sparkfun is working on supporting maker education too, and I know that when you purchase from Sparkfun, Adafruit, and Parallax, you’re supporting American manufacturing, jobs, and the work we all do with and for schools.

        • bfesser / last year / 0

          Thank you for that explanation, Matix. I stand corrected. :)

  • I’m sincerely curious about how business for this module (and similar components) works. You can get one of these on ebay for a dollar, if you need one. And you can get 10 of them for about 78 cents each. They work great.

    I’ve got faith in the quality of the design and manufacturing of SparkFun’s products, but this costs about 4 times as much. Why go through the effort of offering this, when you can’t compete on price?

    And lest anyone think I’m trolling or being rude, I mean no disrespect. I’ve got a side-hustle as a freelance electrical engineer doing embedded systems and PCB layouts and would like to learn more about how U.S. & European businesses can compete with cheap Chinese manufacturing in this space.

    • Jess2 / last year / 3

      I understand and agree what you are saying about the price disparity to a degree; with that being said much of the time the quality of the 78 cent sensor can certainly be suspect. I ordered 2 last month, both came in crushed after waiting 3 weeks so I can’t comment on the quality of those. One of my friends gave me one purchased from amazon for a couple dollars last weekend to play with, turns out it was DOA (the receiver side operated intermittently.) I ordered 5 more early this week from amazon with the hopes that at least a couple will turn out problem free. If I would have been able to purchase one from Sparkfun originally, there would have been a working distance sensor on my quad 3 weeks ago; also I would have enjoyed the added benefit of less lost hair. To summarize, I have found Sparkfuns quality to far exceed the quality of their cheap Chinese competitors on more than one occasion; if you have a pressing project in mind you just want to work, it’s certainly (to me at least) worth the few extra bucks. If you just want to play with a sensor and don’t mind the wait or potential problems, get the 88 cent one; in fact there is valuable learning experience available troubleshooting suspect parts. Please don’t take this the wrong way though, there are plenty of perfectly functional, high value parts available on the extreme cheap that certainly represent an excellent value! Who knows, if the original box didn’t come in crushed, I may have been able to crush them on my quad-copter and would be saying “Why would I pay 5x as much for a sensor I’m just going to destroy in a rough landing anyway.”

    • I have young kids in my house, so I try to buy lead-free whenever possible. I love that SparkFun marks so many components as RoHS (and I’m bummed that Adafruit has been doing it less).

      The cheap sensors and Arduino knock-offs you get on eBay are never lead-free, as far as I can tell. It’s worth the extra few bucks for me.

    • kg6hxm / last year / 2

      Sparkfun is relying on the community and support they offer to keep you coming back for more parts and assistance. Sure you can buy 10 of them for super cheap on Ebay, but that comes with no support. Sparkfun has guides and people to help you learn and when you have issues. Very few places have that.

      For me, they are just down the road, so I get my parts reliably, and much quicker than I would with Ebay.

      • rsp / last year / 2

        Sparkfun support of their products is great, no doubt. But this is not a Sparkfun product. There’s no schematic and the datasheet is from an eBay version of the HC-SR04. I’m guessing this is not a Sparkfun engineered or manufactured product, rather it’s a cheap Chinese import with a beefy markup by Sparkfun. Like maybe this one? https://korean.alibaba.com/product-detail/ultrasonic-transmitter-and-receiver-sensor-hc-sr04-40khz-ultrasonic-sensor-60126024326.html

    • For me, it’s the reliability and consistent quality, the support site, and often times the speed to get it to me.. I buy my fair share of “cheap stuff” off of the internet when I see something interesting, but dont have a particlar project in mind, but if I know I need something specific, I try to go to sparkfun.

  • Just curious, is there any reason this wasn’t designed with copper pours?

Customer Reviews

No reviews yet.