Rabu, 27 November 2013

Where to Buy SainSmart HC-SR04 Ranging Detector Mod Distance Sensor (Blue)

Product Description

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 Details

  • Color: Blue
  • Brand: SainSmart
  • Model: HC-SR04
  • Dimensions: .5" h x .40" w x 1.30" l, .5 pounds

Features

  • 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~500 cm resolution : 0.3 cm
Customer Reviews

Most helpful customer reviews

39 of 40 people found the following review helpful.
I like it!
By Ratiocrat
This was very easy to set up and use with an Arduino Uno board. (Make the following connections from the HC-SR04 to the Arduino, respectively: VCC to 5V; GND to GND; Trig to any digital output; Echo to any digital input.) It was somewhat unstable using the Arduino 5V when running off USB power (it would fluctuate and even dip to a 0 cm reading for no reason), but this was fixed by using a 9v/650mA adapter, instead. I have only had it for a few hours, so I can't vouch for its reliability, but for 13 bucks, it's looking great so far!

34 of 36 people found the following review helpful.
A bit unintuitive at first, but a a very powerful (non)toy thereafter
By Alexander
In my physics class, there came an experiment that required measuring the speed of a cheap toy car, with post its, rulers, a timer, and the close coordination of three people.

Needless to say, it wasn't working out.

Unsatisfied with our utter lack of experimental rigor, I bought this sensor.

The library written by cnobile ([...]) is the most important step in getting this running. To an electronics newbie, or a * moderately* experienced coder (myself), banging out the protocol would be a HUGE pain.

If arduino throws an error along the lines of "wiring.h does not exist", look for \HCSR04Ultrasonic\Ultrasonic.h in the library folder, open it in a good text editor, and change wiring.h to "Arduino.h". The Arduino IDE changed a few things since this library was released, and this worked for me.

Lastly, if you want to ditch the breadboard (assuming arduino UNO R3), plug Trig into 12 and Echo into 13. Conveniently this puts GND at the digital ground. To power the module, we can call 'pinMode(11, OUTPUT);' followed by 'digitalWrite(11, HIGH);' in our setup method, which will configure pin 11 to act as a low current source!

If you want to see my source code, throw me an email: alexander@riccio.com

26 of 27 people found the following review helpful.
Very cool and easy to use
By iltl32
Does 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;
}

See all 114 customer reviews...

Tidak ada komentar:

Posting Komentar