www.webx.dk Start page

OZ2CPU Radioamateur mainpage

Homemade electronics Stuff old and new

Sonic ultra sound distance sensor aray test mockup, HC-SR04
Foreword:
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
delayMicroseconds(100);
digitalWrite(4,LOW); // end of trig pulse
pinMode(4, INPUT); // now let make the same pin input
delay(1);
timeout=0;
while ((digitalRead(4)==HIGH)&&(timeout<250))
{
delayMicroseconds(30);
timeout++;
}
pinMode(4, OUTPUT); //now we are done reading, lets make the pin output again
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.