u/EmbeddedJourneys

▲ 6 r/raspberryDIY+2 crossposts

Measuring distance with the Raspberry Pi and an HC-SR04 Ultrasonic Distance Sensor - includes signal measurements

Hi, I made an effort to write up how to connect the HC-SR04 to a Raspberry Pi, but besides this, I also took an effort to measure some of the signals like the trigger signal and echo pulse. Gives some insight in what really is going when measuring distances with this ultrasonic sensor.

What surprise me most is how the Trigger pulse was actually 90us whereas I clearly expected I would get a 10us Trigger pulse according to my python code that was running on the Pi. Makes me wonder how much error the python code introduces for the distance measurements, currently this is an open question, I'm hoping to answer in the near future..

embeddedjourneys.com
u/EmbeddedJourneys — 5 days ago

I'm exploring the use of my Raspberry Pico Pi 2 as a rudimentary oscilloscope. Have been looking at the ADC and theoretical sampling rates + USB throughput it would require me to take the data off the chip. Throughput still seems to be a limiting factor, but I got my first measurements off of it! I guess this post is just a part 1 in a couple of posts to come...

Code will be published shortly.

Please let me know if you would have any remarks or questions!

u/EmbeddedJourneys — 10 days ago