I am trying to choose a wire encoder for my project. So far, I found this wire encoder (see link). Assuming the measurement range of my cylinder is 1 m. Then, with a 10 bit ADC converter of my Arduino Mega2560, I would have a resolution of 0.09cm (= 100cm/1024). But, lets say some cylinder only have a measurement range of 0.5m. Then the resolution would be 0.048 (=50cm/1024).

I can see that I am missing something here, because the resolution of the later case should be worse than the case with the full measurement range 1m. I would be appreciate for any tipps.


  • Cylinder's movement range 0~1m enter image description here
  • Wire encoder's measurement range 0~1.25m enter image description here
  • Wire encoder's analog output 0~10v
  • ADC resolution 10 bit
  • I guess with "range of my cylinder" you mean its circumference. Then your calculation is right and logical. The ADC has a fixed resolution of 1024 steps. If you distribute these steps onto a smaller range, then it means, that the steps are closer together, thus you are getting a better resolution. Basically you are trading the distance, which is covered by one rotation, for resolution. Higher distance gives a lower resolution and vice versa. I don't see, why this should be different. If this argument didn't convince you, can you explain further, why you think it should be worse?
    – chrisl
    Apr 30, 2021 at 7:56
  • I meant with "range of my cylinder" the movement range of my cylinder. I added more information. But still not sure, how one should map the encoder movement to the cylinder movement...Could you guide me here a little bit?
    – Joe
    Apr 30, 2021 at 8:24
  • Ok, now I don't understand your application. What actually is that cylinder? What are you trying to achieve? What is your project setup? I need a more detailed description to understand, what you are trying to do.
    – chrisl
    Apr 30, 2021 at 8:30
  • I added some picture to clarify further. Basically, I want to measure the cylinder movement with a wire encoder and since the output of my encoder is voltage, I would like to read in the value using an ADC converter of Arduino Mega2560. And I would like to estimate the resolution in this case...
    – Joe
    Apr 30, 2021 at 8:44
  • Ah, ok, with cylinder you mean hydraulic cylinder. Haven't thought of that.
    – chrisl
    Apr 30, 2021 at 8:46

1 Answer 1


Your calculation is not correct. The encoder has its 0 to 10V output voltage distributed over the whole distance, that the cable can reach, so 1.25m. And that gives you the resolution: 1.25m/1024 = 1.22mm. The resolution doesn't change, if you use less than the maximum length. It's still the same resolution of about 1.22mm. The encoder doesn't care, if you are only using 1m of its range.

  • But if you try to write the code: 1) with full range 1.25m cylinder_pos = map( analogRead(A0), 0, 1023, 0, 1.25 ) 2) with only 0.5m range cylinder_pos = map( analogRead(A0), 0, 1023, 0, 0.5 ). It matters right?
    – Joe
    Apr 30, 2021 at 8:55
  • 1
    Only, if you speak about a different encode, that has the range 0.5m. If you are using the encode with 1.25m range you need to use that value for the calculation
    – chrisl
    Apr 30, 2021 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.