Revo Posted January 31, 2021 Posted January 31, 2021 There are many ways to detect movement and distances with your electronics. In another tutorial, we showed how to use a PIR motion sensor with Raspberry Pi Pico. Used in alarm systems, PIRs employ Infrared light to detect moving bodies in a room and are good for projects where, for example, you want users to wave their hands in front of a device to activate it. Our tutorial on how to build a Raspberry Pi handwashing timer uses a PIR. Ultrasonic sensors, on the other hand, use pulses of sound and a simple calculation to determine the distance between themselves and the objects in front them. They are often used in robots to make sure the bot doesn’t walk or roll into an obstacle. We also used one in our Raspberry Pi Toilet paper reminder to tell when we’re running out of rolls. In this tutorial we will use an ultrasonic distance sensor, an HC-SR04+, to quickly determine the distance of an object from our Raspberry Pi Pico. For this project you will need A Raspberry Pi Pico running MicroPython (see how to set up Raspberry Pi Pico) Thonny installed on your computer An HC-SR04P or HC-SR04+ Ultrasonic Sensor 4 x Male to male jumper wires Half or full-size breadboard Hardware Setup of Ultrasonic Sensor on Raspberry Pi Pico This build exclusively uses an ultrasonic sensor compatible with the 3V logic used on the Raspberry Pi Pico GPIO. The HC-SR04P and HC-SR04+ are compatible with 3V and 5V logic making them ideal for Raspberry Pi Pico, Pi and Arduino projects. 3
Recommended Posts