Ultrasonic Sensor Breakout SRF04

From LinkSprite Playgound
Jump to: navigation, search

Introduction

Ultrasonic sensor is non-contact distance measurement module, which is also compatible with electronic brick. It’s designed for easy modular project usage with industrial performance.

Ultrasonic B 1.jpg

Ultrasonic B 2.jpg

Features

  • Detecting range: 3cm-4m
  • Best in 30 degree angle
  • Electronic brick compatible interface
  • 5VDC power supply
  • Breadboard friendly
  • Dual transducer
  • Arduino library ready

Specification

Supply voltage 5V
Global Current Consumption 15 mA
Ultrasonic Frequency 40k Hz
Maximal Range 400 cm
Minimal Range 3 cm
Resolution 1 cm
Trigger Pulse Width 10 μs
Outline Dimension 43x20x15 mm

Usage

Ultra Sonic Timing Diagram

Ultra Timing.jpg

Programming

const int pingPin = 7;
const int start_signal = 8;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  long duration, inches, cm;
  pinMode(pingPin, OUTPUT);
  pinMode(start_signal, OUTPUT);
  digitalWrite(start_signal, HIGH);
  delayMicroseconds(20);
  digitalWrite(start_signal, LOW);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);  
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println(); 
  delay(80);
}
long microsecondsToInches(long microseconds)
{
  return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

How to buy

Here to buy Ultrasonic Sensor Breakout SRF04 on store