I finally assembled my distance meter based on rotary optical encoder and precision wheel. But still I have problem with math and precision.
For example, wheel circumference is 157mm, and when I take a 30 revs the result must be 4710mm, but the MCU calculates only 4708,1mm which is 1,9mm difference. Is there a way to improve the precision?
I use Richard's math:
157/1440 = .109 mm per encoder tick
.109 * 256 * 10 = 279
distance * 10 = (counts * 279)/256
Code:
counter = enc_counter */ 279
lcdout Dec counter/10 ,".", dec counter//10 ; display counter value on LCD
The precision 0,1mm is enough for me, the max. measurable distance want be 6000mm. I try some change, if I improve the precision to 0.01mm then the max. measurable distance shortened to 600mm and this not enough.
Bookmarks