MaxSonar EZ0 Ultrasonics Sensor With Arduino

by Gauravkumar5 in Circuits > Arduino

273 Views, 0 Favorites, 0 Comments

MaxSonar EZ0 Ultrasonics Sensor With Arduino

FHX5N04KTYDLWKY.jpeg

 I will show you how we can program/use the MaxSonar EZ0 sensor With Arduino.

The EZ0 Sonar detects objects from 0-inches to 254-inches (6.45-meters) and provides sonar range information from 6-inches out to 254-inches with 1-inch resolution. Objects from 0-inches to 6-inches typically range as 6- inches

For More Detailed:- https://techeonics.com/maxsonar-ultrasonics-sensor-with-arduino/

Website :- https://techeonics.com/

This sensor Has 3 Output formats To interface with:-


1 ) Analog interface.

2) Pulse width Modulation "PW".

3) Serial Interface.

Supplies

Material:-

1) Arduino Board " I used Arduino UNO".

2) Ultrasonic MaxSonar EZ0 .

3) 16*2 LCD With I2C Module

4)Wires and BreadBoard.

Interface the Sensor

MAXSONAR.png

We will use the 'PW' pin on the sensor to interface with Arduino

Pulse width "PW" Is the way to communicate with this sensor.

This pin outputs a pulse-width representation of range. The distance can be calculated using the scale factor of 147uS per inch.

So using Pulse in to calculate the distance.

This code without Library

MaxSonar With SonarEZpw Library

We can also use the SonarEZpw Library to make the code easy and simple.

Download the sonarEZpw Library :- https://github.com/gauravk5/MaxSonar-EZ0-Sensor

MaxSonar EZ0 With Arduino & LCD

maxsonar with lcd.png

Connections

VCC = 5V

GND = GND

SDA = A4

SCL = A5

We can add an LCD Display with I2C Module to Display the output on it .

Analog & Serial Interface

20210215_171228 - Copy.jpg

Analog Interface

The Analog Interface is the easiest way to communicate with this sensor, there is a directly proportional between Distance and Output voltage. Outputs analog voltage with a scaling factor of (Vcc/512) per inch.

For example, a voltage supply of 5V yields ~9.8mV/inch, a voltage supply of 3.3 V yields ~6.4mV/inch.

The analog output voltage is not accurate rather than PW And serial. so I prefer to use PW or serial


Serial Interface

For the Serial interface method, we will use the SoftwareSerial library to write the code for this sensor, 

And we will Connect D4 With BW, Leave it open or hold it low for serial output on the TX output.

The output is an ASCII capital “R” which equal 0x52, followed by three ASCII character digits representing the range in inches up to a maximum of 255, followed by a carriage return (ASCII 13 or 0x0D)


For More Detailed:- https://techeonics.com/maxsonar-ultrasonics-sensor-with-arduino/

Code & Schematic

Video

MaxSonar EZ0 Sensor With Arduino || Detailed Tutorial || Long-Range Ultrasonic | Techeonics