Find a Retailer SHOP PRODUCT MENU BLOG find products, tutorials, etc... HOME / P R O D U C T C A T E G O R I E S LEARN 0 SUPPORT LOG IN EDUCATION Need Help? REGISTER FORUM / PROXIMITY / ULTRASONIC SENSOR - HC-SR04 Ultrasonic Sensor - HC-SR04 S E N - 1 3 9 5 9 ROHS DESCRIPTION FEATURES DOCUMENTS 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! images are CC BY 2.0 SHARE Ultrasonic Sensor - HC-SR04 Product Help and Resources VIDEOS SUPPORT TIPS SKILLS NEEDED SparkFun Simple Sketches - Ultrasonic Sensor HC SR04 PUBLISHED ON AUGUST 11, 2016 COMMENTS 32 REVIEWS 0 Customer Comments Log in or register to post comments. Member #484945 / about a year ago * / 4 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. Member #187451 / about a year ago * / 2 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. ping example hc-sr04 example user guide Valen / about a year ago / 2 This one seems significantly different from other HC-SR04 modules. It seems to lack the 3rd chip, a MAX232like 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. Member #360077 / about a year ago / 2 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. 172pilot / about a year ago / 1 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?! Member #501584 / last year / 4 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! Member #5515 / about a year ago * / 1 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 / about a year ago / 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. Jorge P. / about 2 weeks ago / 1 Code for Parallax Propeller is on the Parallax Forums use at least a 1K resistor between the propeller (3.3V) and the Echo Pin(5v). Measurements are accurate from the surface of the PCB! My code can be cleaned up a bit, but it works great. Sparkfun can use the code to make available on GitHub at their discretion. Member #909211 / about 3 weeks ago / 1 Would this board be suitable for measuring speed of a 3.5cm (1-3/8") ball coming at it? Working range would need to be from 0 to ~15-20cm (6-8") and an horizonal angle of about 90* and same vertical plane. Jordan Tallent / last month / What size are the mounting holes? 1 Member #1148635 / about 5 months ago / 1 Hello, I have this Ultrasonic Sensor - HC-SR04 and SparkFun RedBot Mainboard. How does the sensor assembled? Thanks Andrea Member #959091 / about 10 months ago / 1 Can this detect the distance to a surface of water? Thinking of mounting it above a fish tank to measure the water level. Member #845958 / about 9 months ago / 1 Measuring tanks, grain silos and the like is a major use of ultrasonic sensors. The ones used in industry cost about (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 Member #149813 / last year / 1 possible to generally detect rocks couple inches under the ground? CF / last year / 2 Not underground. If they are above ground, then yes. OHoilett / about a year ago / 1 Not surprised these things sold out so soon. They're incredibly popular and useful. Good job SparkFun on making these available in your store. Member #829327 / about a year ago / 1 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 Member #367420 / about a year ago / 1 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. tpobrienjr / about a year ago / 1 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. Member #367806 / about a year ago / 1 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 (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 / about a year ago / 1 Sonar sensors have gotten pretty cheap over the past decade. I remember each costing atleast as a minimum and the Ping))) costing 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 / about a year ago / 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 ! I don't know if Arduino existed yet or if I just wasn't aware of it. Matix / about a year ago / 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 / about a year ago / 0 Thank you for that explanation, Matix. I stand corrected. :) Member #114323 / about a year ago / 1 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 / about a year ago / 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." Member #623105 / about a year ago / 2 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 / about a year ago / 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 / about a year ago / 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/ultrasonictransmitter-and-receiver-sensor-hc-sr04-40khz-ultrasonic-sensor-60126024326.html 172pilot / about a year ago / 1 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. Lefty4000 / about a year ago / 1 Just curious, is there any reason this wasn't designed with copper pours? START SOMETHING. SUBSCRIBE TO NEWSLETTER In 2003, CU student Nate Seidle blew a power supply in his dorm room and, in lieu of a way to order easy replacements, decided to start his own company. Since then, SparkFun has been committed to sustainably helping our world achieve electronics literacy from our headquarters in Boulder, Colorado. No matter your vision, SparkFun's products and resources are designed to make the world of electronics more accessible. In addition to over 2,000 open source components and widgets, SparkFun offers curriculum, training and online tutorials designed to help demystify the wonderful world of embedded electronics. We're here to help you start something. About Us About SparkFun SparkFun Education Feeds Jobs Contact Help Customer Service Shipping Return Policy FAQ Chat With Us Programs Become a Community Partner Community Stories Custom Kit Requests Tell Us About Your Project Sell Your Widget on SparkFun Become a SparkFun Distributor Large Volume Sales Community Forum SparkFun IRC Channel Take the SparkFun Quiz SparkFun Kickstarter Projects Distributors What's on your mind? For which department? General Please include your email address if you'd like us to respond to a specific question. email address SUBMIT SparkFun Electronics (R) / Niwot, Colorado / Customer Service / Site Map / Terms of Service / Privacy Policy