Overview
Me Ultrasonic Sensor is an electronic module to measuring distance in the range of 3cm to 400cm. It can be used for the projects to help the handcart avoid obstacles or other relevant distance-measuring and obstacle avoidance projects. Its yellow ID means that it has a single-digital port and needs to be connected to the port with yellow ID on Makeblock Orion.
Technical specifications
● Operating voltage: 5V DC
● Measurement angle: 30 degree
● Measurement range: 3-400cm (with error less than 1cm)
● Ultrasonic frequency: 42 KHz
● Control mode: Single-digital port control
● Module size: 56 x 36 x 31 mm (L x W x H)
Functional characteristics
● Anti-reverse protection – connecting the power supply inversely will not damage IC
● White area of module is the reference area to contact metal beams
● Support mBlock GUI programming, and applicable to users of all ages
● Adopt RJ25 port for easy connection
● Provide pin-type of port to support most development boards including Arduino series
Pin definition
The port of Me Ultrasonic Sensor has three pins, and their functions are as follows:
Wiring mode
● Connecting with RJ25
Since the port of Me Ultrasonic Sensor has yellow ID, you need to connect to the port with yellow ID on Makeblock Orion when using RJ25 port. Taking Makeblock Orion as example, you can connect to ports No. 3, 4, 5, 6, 7, and 8 as follows:
● Connecting with Dupont wire
When the Dupont wire is used to connect the module to the Arduino UNO Baseboard, its SIG pin should be connected to digital port as follows:
Guide to programming
● Arduino programming
If you use Arduino to write a program, the library Makeblock-Library-master should be invoked to control the Me Ultrasonic Sensor. This is a routine to instruct the module for distance measurement through Arduino programming.
The code segment serves to read the measured distance (cm) and output the result to Arduino IDE serial monitor in the cycle of 100ms. Upload the code to the Makeblock Orion, click the Arduino serial monitor, you will see the running result as follows:
● mBlock programming
Me Ultrasonic Sensor supports the mBlock programming environment and its instructions are introduced as follows:
This example will show you how to use mBlock to control the Me Ultrasonic Sensor.
This program can make the panda speak out the distance detected by Me Ultrasonic Sensor. Its running result is as follows:
Principle analysis
The Me Ultrasonic Sensor comes with two “eyes”, one of which (marked with T) is an ultrasonic transmitter, the other of which (marked with R) is an ultrasonic receiver. The ultrasonic transmitter launches ultrasonic wave in a direction and start time-keeping at the launch. The ultrasonic wave spreads in the air, returns back immediately when meeting obstacles in the way, and stops time-keeping immediately when the ultrasonic receiver receives the reflected wave. The transmission speed of sonic wave in the air is 340 m/s. Use the time t recorded by the timer to calculate the distance s from the launching point to the obstacle, that is, s=340×t/2.