Spent some time with the Arduino again. Breezed through infrared motion sensors so moved onto the next project which featured an ultrasonic motion sensor called a HC-SR501. This gadget can determine the distance from itself to the nearest non-transparent barrier then print that distance to a terminal. It can determine how far away that barrier is in centimeters. Took me a while to type in the sketch and found a bug in the lesson's version. Really enjoyed analyzing situation, determining the problem and correcting said problem.
![]() |
HC-SR501 |
But even once I had solved the programming problem by getting it to compile and upload, the unit just keeps printing "Out of range." No matter how I try to influence the sensor, nothing happen. So now I have to to determine why that is.
Sidebar: In the lesson I discover that the speed of sound is affected by the ambient temperature. So determining distance accurately has to factor in the temperature. I've already wired up a thermometer in a past project so I should be able to wire one into this distance calculator to that I don't have to insert a software constant when I run it.
No. 1208 Baise Road, Wish Storehouse, Xuhui District, Shanghai, China 200237