I'm working on a project where I'll be having and device rolling across the floor. What I want to do is use an ultrasonic sensor to detect a gap in the devices path. When the gap is detected I want the device to trigger a relay that turn the motor off so that the device will stop. I've got the code to get the pi to turn on the sensor, emit a pulse & calculate the distance. It then will display the distance on the screen. What it like to do is if the pi detects a sudden change in distance that it sends a signal to one of the gpio pins. That way I can use that gpio pin to trigger a relay to cut the power to the device. I'm pretty good with physical electronics. Relay, resistor, diodes etc... but I'm not the greatest with coding. Can somebody help me figure out how to accomplish this?
Thank you,
Ray
Return to “HATs and other add-ons”
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- The MagPi
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Code Club
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Gaming
- Media centres
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Foundation Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Raspberry Pi 400
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Operating system distributions
- Raspberry Pi OS
- Raspberry Pi Desktop for PC and Mac
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion