 Bukit Mertajam, Penang

# Comparison of HC-SR04, LV-MaxSonar-Ez(MB1010) and HRLV-MaxSonar-Ez(MB1013) Ultrasonic Sensors

Ultrasonic sensors applications are everywhere, today, the common application for hobbyists is collision avoidance for quadcopter as shown in figure above. This quadcopter utilizes the LV-MaxSonar-EZ Ultrasonic sensors 😎

Hi there, in this tutorial I would like compare 3 ultrasonic sensors that available in Cytron Technologies! Ultrasonic sensors are transducers that convert ultrasound to electrical signal. So what are the differences of HC-SR04 ,LV-MaxSonar-EZ and HRLV-MaxSonar-Ez? Let check  it out 😀 !

### Software required

• MPLAB X
• PICKIT 2
• HI-Tech C Compiler v9.83

### Principle of Ultrasonic Sensors

Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in the air at the velocity of sound. If they strike an object, they are reflected back as echo signals to the sensor, which computes the distance to the target based on the time-span between emitting the signal and receiving the echo.

Click here to download user manual.

Features and Specifications of HC-SR04 Ultrasonic sensor:

• Ultrasonic signal frequency :40kHz
• Detection Range : 2cm to 200 cm according to datasheet
• Minimum Operation Distance: 2cm, target less than 2 cm will not be detected.
• Output: Digital time base pulse corresponds to distance
• The pulse width(in micro second ) /58 micro second per cm= target distance in cm
• The pulse width(in micro second )/148 micro second per inch= target distance in inch

Figure above shows an oscilloscope with x-axis scale of 500 micro second per division. The pulse width occupied one division. The LCD displayed 9cm. According to equation: Distance in cm=Pulse Width /58 micro second per cm, by substituting 500 micro second in to pulse width, we get 8.62 cm. Since we displaying data using BCD, we get 9 cm in LCD, which is very near to the actual result, GOOD!

Click here to download LV-MaxSonar-EZ datasheet.

The features and specifications of LV-EZ ultrasonic:

• Ultrasonic signal frequency: 42kHz
• Factory calibrated to unit :”inches”
• Detection Range:  0 inches to 254 inches according to datasheet.
• Minimum operation distance: 5 inches, target less than 5 inches typically reported as as 5 inches.
• 3 output format : Analog voltage, Digital Pulse Width and RS-232 Serial
• Can connect multiple LV-MaxSonar-Ez sensors with one micrcontroller
• An inverter circuit is required to obtain serial  data from sensor to microcontroller (UART TTL)
• Pulse width: 147 us/inch
• Analog output voltage: 9.8mV/inch

Range measurement using Analog Output Voltage

Figure above shows the measure of output voltage from LV-MaxSonar-Ez ultrasonic sensor using Digital multimeter. By using equation Vm/Vi= R. Where R is Range. We can know the range of the object using measured voltage. Vm= measured Voltage and Vi=Analog voltage per inch(9.8mV /inch)

From DMM, the measured voltage = 0.14V and analog voltage per inch = 9.8mV / inch. Vm/Vi= 14.28. Since we display value in BCD ,we get get 14 inches in LCD display.

Range measurement using Pulse Width Modulation

Figure above shows Oscilloscope displayed pulse width of 900 micro second. The pulse width output of LV-MaxSonar-EZ is 147 microSecond/ inch. The range of a target can be calculated as equation below

Range =Pulse width correspondence to distance /147 micro second

Range= 900 micro /147 micro per inch=6.12 inches

Since we displaying the data using BCD, the data display 6 inches in LCD

Range measurement using Serial Output(UART)

Image galleries above shows transistor inverter circuit and RS-232 signal. An inverter circuit is required to acquire the serial data from LV-MaxSonar-EZ. The objective of inverter circuit is to achieve the standard voltage level of RS-232.

The second image displayed signal of RS-232 in oscilloscope. The green color signal is output of  sensor TX pin. The range of green signal is from  0 to Vcc. The yellow color signal represent inverted signal of sensors TX pin. The range of yellow signal  is from 0 to  (Vcc-0.7)V.

The signal before undergoing the inverter process is higher then signal after undergoing inverter process. This is because process passes the signal through the PN junction of transistors and the junction voltage value approximately 0.7V. The output of inverter signal thus become (Vcc-0.7)V.

Click here to download datasheet of HRLV-MaxSonar-EZ

• Ultrasonic signal frequency : 42kHz
• Factory calibrated to unit :”cm”
• Detection Range: 0 to 500cm inches according to datasheet.
• Minimum operation distance :30cm,target  that less then 30cm typically range as 30cm
• 3 output format: Analog voltage,pulse width modulation and UART(RS-232 format)
• Standard TTL for serial interface available
• Can connect multiple HRLV-MaxSonar-EZ sensors with one microcontroller
• Can connect HR-MaxTemp series temperature sensor to pin 1 of HRLV-Max-Sonar-EZ.
• Pulse Width output: 10.16 micro second /cm
• Analog voltage output: 8.98mV/cm

The range measurement for analog voltage output and pulse width output is the same as LV-MaxSonar-EZ. The main difference between LV and HRLV is the inverter circuit for UART is not required for HRLV-MaxSonar-EZ. You can connect RX pin of micrcontroller directly to TX pin of HRLV-MaxSonar-EZ

Circuit Diagram:

You can refer to the Fritzing diagrams below for connection of 3 ultrasonic sensor as mentioned above. For this tutorial, SK40C and PIC 16F887 is used.The circuit connection for LV-MaxSonar-EZ and HRLV-MaxSonar-EZ are almost the same but for HRLV-MaxSonar-EZ, you can connect RX pin of microcontroller directly to TX pin of the sensor.

## Fritzing

Video

Come! Click here and i show you how it works ! 🙂

### References

Attachment

Click here to download project sample code

Have fun! 🙂

## Comments (1) eng fms

do they have problem with absorbing sound wave through material likes cloth ?
if yes, how can I detect person ?!