Stability of values on LCD using UltraSonic Sensor

Good Day. We have a trouble about the display of the values (in centimeter and with 2 places after the decimal point. e.i. 33.64 cm) on the LCD. We are using a 4-pin UltraSonic Sensor for measuring a distance. The LCD displays unstable values even it bounces on a flat surface, values appear to have a range of 0.8 cm. One example of display is 33.64 cm (min.val) - 34.44 cm (max.val) without changing the actual distance. The problem is that we need a stable display of values or if imposible, at least a maximum of 0.2 cm range. We need your help. ThankYou.

P.S. 4th year students here.

Do a running average of 5..10 values and skip 1 decimal

How was that please? I'm a total newbie. Can you please explain further. ThankYou.

When printing: LCD.print(value,1); // additional parameter ~ nbr of decimals

the 'value' would be the distance right? and '1' would be the decimal places?

correctly understood

thank you sir. :slight_smile:

you can also use the mean or mode of the unstable values, let say in 5 seconds you would have the values then for the sixth second the mean or the mode. hope this idea helps, but about he program I'm sorry, I'm a newbie. I think someone would show up and help.