SainSmart HC-SR04 Ranging Detector Mod Distance Sensor (Blue)
We don't know when or if this item will be back in stock.
- Using IO trigger for at least 10us high level signal
- The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back
- IF the signal back, through high level ,time of high output IO duration is the time from sending ultrasonic to returning. Test distance = (high level time velocity of sound (340M/S) /2
- Power supply :5V DC, quiescent current : <2mA,effectualangle: <15 ranging distance : 2cm~400 cm resolution : 0.3 cm
Featured items you may like
From the manufacturer
SainSmart HC-SR04 Ranging Detector Mod Distance Sensor (Blue)

More information please refer to sainsmart website.
SainSmart Ultrasonic Ranging Detector Mod HC-SR04 Distance Sensor (Blue)
Providing 2cm to 400cm of non-contact measurement
- Stable performance, accurate measurement range.
- Using IO trigger for at least 10us high level signal.

Features:
- The ranging accuracy can reach to 3mm.
- The modules includes ultrasonic transmitters, receiver and control circuit.
The basic principle of work:
- The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back.
- IF the signal back, through high level , time of high output IO duration is the time from sending ultrasonic to returning.
Distance = ((Duration of high level)*(Sonic :340m/s))/2.

Specifiction:
- Power supply :5V DC
- Quiescent current : <2mA
- Effectual angle: <15°
- Ranging distance : 2cm �500 cm
- Resolution : 0.3 cm
There are 4 pins out of the module : VCC , Trig, Echo, GND.
So it's a very easy interface for controller to use it ranging.
The all process is :
- Pull the Trig pin to high level for more than 10us impulse
- The module start ranging
- Finish ranging
- If you find an object in front
- Echo pin will be high level
- Based on the different distance,it will take the different duration of high level.
Distance = ((Duration of high level)*(Sonic :340m/s))/2

Finally , look at the back of the module. All of the chip in the module have been burnish , maybe the author want to prevent the designed from plagiarism. But ultrasonic ranging module is nearly the same principle, so it's not hard to speculated that the role of the chip. It's sure at least one 74 series chip on it. It is not a difficult task to crack it. So low price it is, even cheaper than your copy.
Looking for specific info?
Product Description
SainSmart There are 4 pins out of the module: VCC , Trig, Echo, GND . So it's a very easy interface for controller to use it ranging. The all process is : pull the Trig pin to high level for more than 10us impulse , the module start ranging ; finish ranging , If you find an object in front , Echo pin will be high level , and based on the different distance, it will take the different duration of high level. So we can calculated the distance easily : Distance = ((Duration of high level)*(Sonic : 340m/s))/2
Product information
Product Dimensions | 1.3 x 0.4 x 0.05 inches |
---|---|
Item Weight | 0.8 ounces |
ASIN | B004U8TOE6 |
Item model number | HC - SR04 |
Customer Reviews |
4.5 out of 5 stars |
Best Sellers Rank | #12,767 in Security & Surveillance Equipment |
Is Discontinued By Manufacturer | No |
Other display features | Wireless |
Color | Blue |
Manufacturer | SainStore Inc. |
Date First Available | March 29, 2011 |
Feedback

SainSmart HC-SR04 Ranging Detector Mod Distance Sensor (Blue)
Share:
Found a lower price? Let us know. Although we can't match every price reported, we'll use your feedback to ensure that our prices remain competitive.
Where did you see a lower price?
Fields with an asterisk * are required
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Customers find the ultrasonic sensor works well with Arduino Uno and is very simple to use, with coding being straightforward. The sensor is accurate, measuring distances to a cm, and customers consider it good value for money, with one noting it performs as well as more expensive alternatives. They describe it as a great mini ultrasonic sensor that's fun for experimentation, though opinions on build quality are mixed, with some finding it well-made while others report poor quality. Measurement accuracy receives mixed feedback - while it fits easily into breadboards, measurements between 40cm and 100cm are inaccurate.
AI-generated from the text of customer reviews
Customers report that the sensor works well with Arduino Uno and provides good value for money.
"Does exactly as promised. Very accurate. I had to slightly modify the Ping sketch that came with Ardiuno software, so here it is...." Read more
"This is a great toy. See sketch below. in about 20 minutes of receiving it i had a basic "optical piano" working! /*..." Read more
"...It works without a hassle, so it's good in my book...." Read more
"...exactly! It worked perfectly every time...." Read more
Customers find the distance sensor accurate, measuring up to a centimeter and providing precise readings on solid surfaces.
"Does exactly as promised. Very accurate. I had to slightly modify the Ping sketch that came with Ardiuno software, so here it is...." Read more
"...tell you it works, both with Leonardo and mega, and is very accurate in measuring distances. Up to 30' is how far I went, down to 3 inches...." Read more
"...It works without a hassle, so it's good in my book. It's accuracy is pretty decent, but sometimes it doesn't bounce the signal properly on smaller..." Read more
"...Upsides: very cheap!, super precise!!! I measured with the tape distance it sends to computer - very accurate, almost to millimeters...." Read more
Customers find the distance sensor easy to use, with simple coding and quick setup, and one customer mentions it integrates well with micro-controller platforms.
"...Anyways, I highly recommend for a beginner/hobby project. Beats getting some of the $20 variants out there if you're just starting." Read more
"...It's a good introduction to this type of device, especially if you intend to implement it into a robotics project." Read more
"Bought two of these. They easily hook into the Arduino. Sketch/code is out there to easily program it...." Read more
"This is better quality and easier to use than the price would suggest. It was easy to setup and use and seems accurate...." Read more
Customers find the distance sensor to be good value for money, describing it as an inexpensive ultrasonic range finder that performs as accurately as more expensive alternatives.
"...Overall I find this well built, great price and I plane on getting more of the same before price goes up." Read more
"...Upsides: very cheap!, super precise!!! I measured with the tape distance it sends to computer - very accurate, almost to millimeters...." Read more
"...detectors are common for many robotic designs and the price was very reasonable so I ordered this one...." Read more
"...At $6 though, its cheap, and worth experimenting with if your building something where the range limitation isn't an issue." Read more
Customers praise the sensor's quality, describing it as a great mini ultrasonic sensor, with one customer noting it performs as well as the Parallax Ping sensor.
"This is an extremely useful ultrasonic distance sensor. Here's what I've learned in a few hours of playing with it:..." Read more
"These are fantastic little sensors...." Read more
"...soft fabric or wool absorbs the beam and sensor does not see the obstacle...." Read more
"...It also allows you to communicate with multiple sensors without slowing down your sketch...." Read more
Customers find the distance sensor fun to use, particularly for experimentation, and one customer mentions it works well for finding and avoiding obstacles.
"This thing is so much fun! It is very accurate and I was able to get it to sense things out to about 16 feet...." Read more
"...many other possibilities with this sensor such as with use in robotics to avoid obstacles...." Read more
"...This is a fun little module. There is more to it than simply reading a switch or sending out a digital High/Low voltage...." Read more
"...are also quite a few examples of code that are very useful in learning how the sensor operates...." Read more
Customers have mixed opinions about the build quality of the distance sensor, with some finding it well made and reliable, while others report receiving defective units.
"...Overall I find this well built, great price and I plane on getting more of the same before price goes up." Read more
"Not the best quality sensor out there, but honestly... for under $6, can't complain. It works without a hassle, so it's good in my book...." Read more
"...getting started with them, but once I got things going they're very reliable and accurate...." Read more
"This is better quality and easier to use than the price would suggest. It was easy to setup and use and seems accurate...." Read more
Customers have mixed experiences with the sensor's measurement accuracy, with some finding it small and easy to fit into breadboards, while others report that measurements between 40cm and 100cm are inaccurate.
"...with the tape distance it sends to computer - very accurate, almost to millimeters. The maximum distance is 6 meters...." Read more
"...It fit easily into my breadboard and worked well with my Uno. I was able to find some open-source programs that work with this specific detector...." Read more
"Measurements were all over the place w/some materials and azimuths. With some noise filtering in software, these things are more useful...." Read more
"I like the size of the ranging detector. I will need to get an electronic technician to help me finish wiring it for use with my water tank...." Read more
Reviews with images

Accurately Measures Distance to Water
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on January 28, 2013Does exactly as promised. Very accurate. I had to slightly modify the Ping sketch that came with Ardiuno software, so here it is. Look at the constants for the correct pin placement.
/* Ping))) Sensor
This sketch reads a PING))) ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return. The length of the returning pulse is proportional to
the distance of the object from the sensor.
The circuit:
* +V connection of the PING))) attached to +5V
* GND connection of the PING))) attached to ground
[...]
created 3 Nov 2008
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
*/
// Pin number constants
const int triggerPin = 5;
const int echoPin = 6;
void setup() {
// initialize serial communication:
Serial.begin(9600);
}
void loop()
{
// establish variables for duration of the ping,
// and the distance result in inches and centimeters:
long duration, feet, inches, cm;
// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(5);
digitalWrite(triggerPin, LOW);
// The echo pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
// convert the time into a distance
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
feet = microsecondsToFeet(duration);
Serial.print(feet);
Serial.print("feet, ");
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}
long microsecondsToInches(long microseconds)
{
// According to Parallax's datasheet for the PING))), there are
// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
// second). This gives the distance travelled by the ping, outbound
// and return, so we divide by 2 to get the distance of the obstacle.
// See:[...]
}
long microsecondsToFeet(long microseconds)
{
// According to Parallax's datasheet for the PING))), there are
// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
// second). This gives the distance travelled by the ping, outbound
// and return, so we multiply by 12 to convert to feet and then by 2 to get the distance of the obstacle.
// See: [...]
}
long microsecondsToCentimeters(long microseconds)
{
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;
}
- Reviewed in the United States on August 4, 2013This is a great toy.
See sketch below. in about 20 minutes of receiving it i had a basic "optical piano" working!
/*
The circuit:
* ultrasonic sensor:
* +V connection of the PING))) attached to +5V
* GND connection of the PING))) attached to ground
* trigger and echo pin: see constants.
*
*A buzzer
* GND to ground
* "+": see constants
*/
// Pin number constants
const int triggerPin = 5;
const int echoPin = 6;
const int speakerPin=7;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playNote(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };
// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
void setup() {
// initialize serial communication:
Serial.begin(9600);
pinMode(speakerPin, OUTPUT);
}
void loop()
{
long duration, cm;
// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(5);
digitalWrite(triggerPin, LOW);
// The echo pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
// convert the time into a distance
cm = microsecondsToCentimeters(duration);
Serial.print(cm);
Serial.print("cm");
Serial.println();
if ( cm > 100){
delay (300);
}else if (cm >60){
playNote('d', 300);
}else if (cm >50){
playNote('e', 300);
}else if (cm >40){
playNote('f', 300);
}else if (cm >30){
playNote('g', 300);
}else if (cm >20){
playNote('a', 300);
}else if (cm >10){
playNote('b', 300);
}else {
playNote('C', 300);
}
delay (200);
}
long microsecondsToCentimeters(long microseconds)
{
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;
}
- Reviewed in the United States on February 19, 2015I don't have a project for this yet, but I did test it. Being the only one of these I have ever used, I can't compare it to other companies. I can tell you it works, both with Leonardo and mega, and is very accurate in measuring distances. Up to 30' is how far I went, down to 3 inches. it does get a little confused under 10 inches, but I'm sure, better code would fix that up. I did not use much math in my code, and I think timing delays would solve the close proximity confusion. IE (under a foot it reads all over the place 1 inch to 10' etc) I try to be as honest and accurate as I can. I use comments like this to make buying decisions. If you see a bad review from me and buy anyway you will kick yourself. If you do one please use more words than "good deal" or "great" It helps us all. Overall I find this well built, great price and I plane on getting more of the same before price goes up.
- Reviewed in the United States on June 8, 2014Not the best quality sensor out there, but honestly... for under $6, can't complain. It works without a hassle, so it's good in my book. It's accuracy is pretty decent, but sometimes it doesn't bounce the signal properly on smaller objects. Anyways, I highly recommend for a beginner/hobby project. Beats getting some of the $20 variants out there if you're just starting.
Top reviews from other countries
- B. I. LordReviewed in the United Kingdom on January 24, 2021
4.0 out of 5 stars Satisfactory, but you're left to search for information on how to use it.
Satisfactory, but there is no link to information on the interface signals or anything else resembling a specification.
-
くまむんReviewed in Japan on October 16, 2014
5.0 out of 5 stars 超安価!超簡単!発展性!
【その他購入準備費は10以上倍!?】
超音波距離センサーを楽しむ為に、arduino MEGA
400Cブレッドボード 1.8インチの液晶シールド:今回未使用
ジャンパーワイヤーを購入又は準備してチャレンジしました。
よくあることです、センサーの10倍以上の費用です。
【配線は超簡単】
センサー本体の足は4本、400コンタクトのブレッドボードにピッタリと差し込むことができます。
VCC・Trig・Echo・GNDの文字が小さいので確実にメモしておくこと
VCCは5Vに、GNDはGNDに、Trigは8番に、Echoは9番にジャンパーワイヤーで差す。
「指差し確認、ヨシ」以上配線終わり!!
【HC-SR04リンクデータの解凍】
問題は紹介文の「http//***」「.rar」拡張子のファイルでした。
ネットで さまよう事10分フリーソフトがあります。
答は結果簡単なのですが、行き着くまでは、半信半疑でダウンロードした
「Lhaplus」です。
【スケッチはそのままOK】
上記で解凍ができればサンプルスケッチをarduinoに読み込み検証・MEGAボードに書き込む。
【シリアルモニタ】
arduinoのIDEの日本語メニューの「ツール」「シリアルモニタ」を選択し「送信」を押すと
12.45cmとか次々とパソコンに表示されます。
元々精度は「0.3cm」と表示されています。サンプルスケッチの計算式の桁数が
少数点二桁です。 次のチャレンジは1.8インチ液晶への表示ですが今回はここまで。
【超安価かつ良好】
価格の割には大変良く出来た超音波測距センサーです。
空気中の音速は、気温・気圧・水蒸気圧ほかで変化しますが、温度センサーのデータで計算させると
より精度が向上する筈です。あららまた新たなチャレンジ事項発生です。
- JayReviewed in Canada on August 5, 2013
5.0 out of 5 stars Great module for the price
Product arrived fast and worked as expected. These are a great, inexpensive ultrasonic range finder for those who don't need high precision. We found for our teaching project with Node.js they worked great. Great for wall tracking robots, but not if you need to detect something further than 4 feet away. If you want more range, you're probably going to have to spend more money.
-
speedlanderReviewed in Japan on October 27, 2016
5.0 out of 5 stars ドローンで使っています
激安価格なのにArduinoで測定した結果も大変安定し良好でした
価格性能共に満足しております
- No_SparkReviewed in Canada on September 8, 2014
5.0 out of 5 stars HC - SR04
This one was worked right out of the box and was quite fun to play with!
In fact, it sparked a friends interest in the Arduino when he started playing with it.
A bit of a commodity module that works as advertised and at a good price.