Zio Ultrasonic Distance Sensor Qwiic Start Guide
This post is part of our Zio Qwiic Start Guide Blog Series.
The ultrasonic distance sensor is useful for applications that need effective measures to sense nearby objects and distance. Commonly embedded in robots to sense collisions.
Zio Ultrasonic Sensor (HC-SR04) Overview
- Ultrasonic Receiver Module (Echo)
- Ultrasonic Transmitter Module (Trigger)
- Power and Signal Pins
- Power Pins:
- GND - Ground Supply
- 3V3 -3.3V Supply
- Signal Pins:
- Trig- Trigger Input Signal (Transmit Signal)
- Echo - Echo Output Signal (Receive Echo)
- Power Pins:
- STM8L051 MCU:
- 8-bit ultra-low power STM8 MCU Core with I2C and SPI interface
- Qwiic Connector:
- A system to easily connect to other qwiic compatible modules via Qwiic cable
Configuring your Ultrasonic Distance Sensor (HC-SR04)
This qwiic guide has a separate post on our development board guides. Check them out below:
Connection Set up
Hardware & Components
- Zuino M Uno
- Zio Qwiic Ultrasonic Distance Sensor (HC-SR04)
- Zio Qwiic 0.91" OLED Display (Optional)
- Qwiic Cable (100mm)
- Micro USB Cable
- Powerbank (Optional)
Testing Example Codes
We are going to demo our Ultrasonic Distance Sensor using the following example codes. The following examples work with our Zio development boards. Just select the right board and port from the Arduino IDE platform.
1. HC-SR04 I2C Example Code
Step 1 Download and Install the following libraries for OLED display.
Step 2 Download the following example code for Zio Ultrasonic Distance Sensor.
Download the example code from our Github page.
Extract and open the downloaded folder. Go to Arduino > Zio_Ultrasonic_Distance_Sensor_IIC_Test
Step 3 View Results
Open Serial Monitor to view results using a serial monitor.
Results on Zio 0.91" OLED Display