Tag Archives: HC-SR04

Portable Distance Measurement Project With HC-SR04 Ultrasonic Sensor

In this video lesson we explore creating a portable distance measurement widget using the Raspberry Pi Pico W, the HC-SR04 Ultrasonic Sensor, and the SSD1306 OLED display.

The schematic we use for this project is as follows:

Ultrasonic Sensor
Schematic for Portable Distance Sensor Project

In this work, we use the State Machines on the Pi Pico to ensure precise timing. Below, we include the code developed in the lesson above:

 

Precision Ultrasonic Distance Measurement With PIO State Machines on Raspberry Pi Pico W

In this video lesson we will show you how to get precise distance measurements with the HC-SR04 Ultrasonic sensor. We show how measurement stability and accuracy can be improved by using the Raspberry Pi Pico PIO State Machines to trigger and monitor the sensor. For your convenience, the code is presented below.

 

Arduino Project for a Portable Ultrasonic Distance Sensor

Distance Sensor Project
Distance Sensor Project Build

In this video lesson we create a portable distance measuring prototype, using an Arduino Uno R4 WiFi. This project incorporates a HC-SR04 Ultrasonic Sensor, a ‘Go’ button, and the SSD1306 OLED Display. The project is powered by the Sunfounder Breadboard power bank. The arduino is powered by the power bank as well, so the project can operate totally portable. When the device is turned on, the OLED prompts the user to position the device. When the ‘Go’ button is pushed, the device measures the distance to the target, then displays the distance on the OLED display.

The video above gives all the details of the project, with step-by-step instructions.

Distance Sensor
Portable Distance Sensor with HC-SR04 and SSD1306 OLED Display

For your convenience, the code developed in the video is presented below. Enjoy!

 

 

Measure Distance Using the HC-SR04 Ultrasonic Sensor on the Raspberry Pi Pico

In this Video Lesson I will teach you how to use echolocation to measure distances. We will use the HC-SR04 Ultrasonic Sensor, and will use the Raspberry Pi Pico W. We will explain how echolocation works, and show you how the sensor works. We will do the math, and then create the code for making measurements.

 

Robotics Training LESSON 17: Measuring Distance to Obstacle using the HC-SR04


In this video lesson we show how to use the HC-SR04 ultrasonic sensor to detect the distance to obstacles in a robotic application. We use the sensor to measure the time it takes for a ping to travel from the sensor, to the target, and then back. We use this measured time, and the known speed of sound to calculate the distance to the target. This will be used in future lessons to keep the robot from running into an obstacle.