Using an ultrasonic sensor with a Rasberry Pi

2015-11-18 23:48:00 +0000 - Written by Carl Burks

I was helping a friend build a robot the other day and he was having difficulty with the ultra sonic sensor. I offered to test it on my Pi which a “B” model. I followed this guide: http:\images\images\\images\blog\images\2013\images\10\images\13\images\raspberry-pi-ultrasonic-sensor-hc-sr04

and hooked it up using the single 1k resistor. I used a total of 5 DuPont connector wires and put the resistor between two.

I had to alter the timeout of the code to a full 1 second to get valid results. Also I had to adjust the GPIO pins used to the ones that I actually used to hook up.

It worked out nicely: