MAKER FACTORY 2134052 Ultrasonic Sensor Module Instructions
- June 5, 2024
- MAKER FACTORY
Table of Contents
MAKER FACTORY 2134052 Ultrasonic Sensor Module
Description
The module is an ultrasonic sensor that senses oncoming objects and their distance to the sensor.
Pinout / Pin Map
Pin | Description |
---|---|
VCC | Power supply 5 V/DC |
Trig | Trigger transmit signal |
Echo | Echo signal |
Pin | Description |
GND | GND |
OUT | Possibility to connect to an oscilloscope |
Example Application
In this example we will make the sensor detect an oncoming object and report the measured distance.
The instructions use the Arduino® platform to illustrate product use. You can also use an Arduino derivative or another platform that supports this type of product.
Connection
Make sure you switch resistors between LED/Module and developer board as listed in the connection table or shown in the connection diagram to prevent damaging your com-ponents.
Module | Arduino® |
---|---|
VCC | 5V |
Trig | 12 |
Echo | 13 |
GND | GND |
Code
- define trigPin 12
- define echoPin 13
- define led 11
- define led2 10
void setup
- Serial.begin (9600);
- pinMode(trigPin, OUTPUT)
- pinMode(echoPin, INPUT)
- pinMode(led, OUTPUT)
- pinMode(led2, OUTPUT)
void loop
- long duration, distance;
- digitalWrite(trigPin, LOW);
- delayMicroseconds(2);
- digitalWrite(trigPin, HIGH);
- delayMicroseconds(10);
- digitalWrite(trigPin, LOW);
- duration = pulseIn(echoPin, HIGH);
- distance = (duration/2) / 29.1;
// This is where the LED On/Off happens
if (distance < 4) { // When the Red condition is met, the Green LED should turn off
- digitalWrite(led,HIGH);
- digitalWrite(led2,LOW);
- digitalWrite(led,LOW);
- digitalWrite(led2,HIGH);
if (distance >= 200 || distance <= 0){ Serial.println(“Out of range”); else
- Serial.print(distance);
- Serial.println(” cm”);
- delay(500);
Procedure
- Prepare a sketch with the given code and upload it to your board.
- Connect the module/component to the board as shown in the connection diagram or table.
- Approach the sensor within its range with an object.
- Measurements are output to the Serial Monitor.
Specifications
Operating voltage | +5 V/DC |
---|---|
Quiescent Current | <2 mA |
Working Current | 15 mA |
Measuring Angle | 30° |
Effectual Angle | <15° |
Range | 2 – 400 cm |
--- | --- |
Resolution | 0.3 cm |
Trigger Input Pulse Width | 10 µs |
Dimensions (approx.) | 49 x 22 x 15 mm |
Weight (approx.) | 9 g |
Disposal
Electronic devices are recyclable waste and must not be dis-posed of in the household waste. At the end of its service life, dispose of the product in accordance with applicable regulatory guidelines. You thus fulfill your statutory obligations and contribute to the pro-tection of the environment.
Legal Notice
This is a publication by Conrad Electronic SE, Klaus-Conrad-Str. 1, D-92240 Hirschau (www.conrad.com. All rights including translation reserved. Reproduction by any method, e.g. photocopy, microfilming, or the capture in electronic data pro-cessing systems require the prior written approval by the editor. Reprinting, also in part, is prohibited. This publication represent the technical status at the time of printing. Copyright 2022 by Conrad Electronic SE.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>