Interfacing Arduino with Grove Ultrasonic Ranger

Using Arduino and Seeed Studio Grove ultrasonic ranger we can easily build a distance meter. This project shows how to do that where distance value is printed (in centimeters and inches) on Grove LCD (I2C 1602 LCD display) and Arduino IDE serial monitor.

To see how to interface the Arduino with Grove I2C LCD, visit this post:
Interfacing Arduino with Seeed Studio Grove LCD

About Grove Ultrasonic Ranger:
The Grove ultrasonic ranger (ultrasonic distance sensor) is an ultrasonic transducer that uses ultrasonic waves to measure the distance. This sensor can measure distances from 3cm to 350cm with an accuracy up to 2mm.

Compared with traditional ultrasonic sensor module HC-SR04, the Grove ultrasonic distance sensor has an integrated single-chip microcomputer, it requires only one I/O pin. Another difference is that HC-SR04 only supports 5V systems, while the Grove ultrasonic distance sensor supports both 5V and 3.3V systems. This means it can be directly connected to any Raspberry pi I/O pin.

Grove Ultrasonic ranger features:

  • 3.3V/5V compatible, wide supply voltage range: 3.2v~5.2v
  • One I/O pin is required
  • Wide measurement range: 3cm ~ 350cm
  • Low cost and easy to use through Grove connector (cable), plug and play

Grove Ultrasonic ranger hardware overview:
The following image shows a basic hardware overview of the Grove ultrasonic ranger module.

Seeed Studio Grove Ultrasonic ranger pinout
Grove Ultrasonic ranger pinout

Hardware Required:

  • Arduino/Genuino UNO board
  • Grove base shield           —> official page
  • Grove ultrasonic ranger   —> official page
  • Grove LCD screen (1602 I2C LCD)
  • 2 x Grove 4-pin cable

Arduino with Grove ultrasonic ranger and 1602 LCD circuit:
The following image shows the connection of the 3 Grove modules (base shield, 16×2 LCD and ultrasonic ranger module) using 4-pin Grove cables.
Note that the base shield is directly mounted to the Arduino UNO board.

Arduino Grove ultrasonic ranger 16x2 LCD circuit

The Grove 1602 LCD display is connected to base shield I2C port where:
GND pin is connected to Arduino GND,
VCC pin is connected to Arduino +5V pin,
SDA is connected to Arduino analog pin 4 (A4),
SCL is connected to Arduino analog pin 5 (A5).

The Grove ultrasonic ranger (ultrasonic distance sensor) is connected to base shield port D2, internally it’s connected as follows:
GND pin is connected to Arduino GND,
VCC pin is connected to Arduino +5V pin,
NC is a not connected pin (it looks as it is connected to pin D3),
SIG (signal) pin is connected to Arduino digital pin 2.

Arduino with Grove ultrasonic ranger and 1602 LCD code:
Seeed Studio provides a nice open source library for their LCD module which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “grove lcd” and install the one from Seeed Studio).

Or it can be installed manually, first download library compressed file from the following link:
Grove LCD display Library   —> direct link

They also provides a library for the Grove ultrasonic distance sensor which can be installed also through library manager (in the search box write “grove ultrasonic” ) or manually, download links are below:
Seeed Studio ultrasonic ranger library   —>   direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the 2nd library file.

In the Arduino code there are 3 libraries which are included as shown below:

Definition of the Grove ultrasonic ranger data pin connection and the initialization of its library:

Rest of code is described through comments.

Full Arduino code:

Arduino with Grove ultrasonic ranger and I2C LCD

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.