Simple ultrasonic sensor module HC-SR04 and 1602 LCD display were combined into useable digital yardstick.
Two versions of the sensor module from different suppliers worked similar way. The right one sometimes (name printed in the middle) had sometimes tendency to keep once entered “out of range” state forever. Simple transistor to switch on/off VCC did the trick – if the “out of range” state was longer than 1 second the module was switched off and switched on back.
The sensor is ooperated by standard Arduino commands, and the display is controlled by the object from LiquidCrystal_I2C library https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/LiquidCrystal_V1.2.1.zip