Difference between revisions of "Non Blind Zone Ultrasonic Module SDM-IO 5pin"
m |
m (→User Guide) |
||
| Line 86: | Line 86: | ||
</pre> | </pre> | ||
| + | |||
| + | *Open serial port monitor to check the distance. | ||
| + | |||
| + | [[File:IM120628006pic3.png|400px]] | ||
Latest revision as of 08:08, 17 March 2015
Overview
Non Blind Zone Ultrasonic Module SDM-IO is a stable and measuring the distance accurately ultrasonic module which provides 0cm - 1500mm non-contact measurement function,the ranging accuracy can reach to 3mm. Its performance can compare with SRF05/SRF02 ultrasonic distance measuring module, also it has non-blind (From 0-1cm the measurement results are not accurate when we test, but more than 1cm are accurate) design and fast response.
Go shopping Non Blind Zone Ultrasonic Module SDM-IO (IM120628006)
Specification
- Operation Voltage DC 3 - 5.5 V
- Global Current Consumption 8 mA
- Ultrasonic Frequency 40k Hz
- Maximal Range 3000 mm
- Minimal Range 0 cm
- Resolution 1 mm
- Trigger Pulse Width 10 μs
- Sensor Angle 15 degrees
- TTL level output
User Guide
There are 5 pins in this Non Blind Zone Ultrasonic Module SDM-IO. 1-2cm can't be measured. For now, Oc pin still needs to be hacked.
Work with Iteaduino UNO (Arduino UNO)
- Connection: VCC->3.3/5V Echo->D2 Trig->D3 GND->GND
- Upload the following code to Iteaduino UNO (Arduino UNO)
const int TrigPin = 3; // connect TrigPin to D3
const int EchoPin = 2; // connect EchoPin to D2
unsigned long time;
float cm;
boolean result=true;
void setup()
{
Serial.begin(9600);
pinMode(TrigPin, OUTPUT);
pinMode(EchoPin, INPUT);
}
void loop()
{
digitalWrite(TrigPin, HIGH); //output a at least 10us low pulse to triger the ultrasonic wave
delayMicroseconds(100);
digitalWrite(TrigPin, LOW);
delayMicroseconds(10);
digitalWrite(TrigPin, HIGH);
time = micros();
attachInterrupt(0, echo, FALLING);
while(result==false)
{
if((micros()-time)>=50000)
break;
}
if(result == true)
{
cm = time / 58.0; //turn echo time into unit cm
cm = (int(cm * 100.0)) / 100.0; //reserves two decimal fractions
if(cm>=(3.8+2.0)) //calibration
{cm-=3.8;}
else
{cm=0.0;}
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(1000);
result=false;
}
}
void echo() //test the echo time from trig=1 to echo=0
{
result=true;
time=micros()-time;
detachInterrupt(0);
}
- Open serial port monitor to check the distance.
Notice