Wednesday, November 18, 2015

Using an ultrasonic sensor with a Rasberry Pi

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:
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: