www.webx.dk Start page
OZ2CPU Radioamateur mainpage
Homemade electronics Stuff old and new
Sonic ultra sound distance sensor aray test mockup, HC-SR04

Just a quick and dirty mockup, to test the angle and resolution, i wanted to use them for a biger robot project.
Also a test of single pin mode, very usefull way to save pins in case many sensors needed.

2k2 between trig and echo makes it possible to use only one pin pr sensor, and not two as intended originally
here is how it is done in arduino code:

digitalWrite(4,HIGH); // trig pulse to start
digitalWrite(4,LOW); // end of trig pulse
pinMode(4, INPUT);  // now let make the same pin input
while ((digitalRead(4)==HIGH)&&(timeout<250))
pinMode(4, OUTPUT); //now we are done reading, lets make the pin output again

the result is in timeout variable, simply check if it is 250, then you know it timed out
else you got the distance in cm

VIMEO short prof of concept video, using only 3 of the sensors in about 45 deg.


Thomas Scherrer OZ2CPU 2018
If you found this page usefull, why not consider donate a bit.. see my contact page please.