Thursday, 3 January 2019

microcontroller - How do I get a position from an encoder?



I have a motor that drives a rail which I need to know the position of.


I have an AM102 encoder attached to the motor. But am unsure how to get a position from it.


I have powered it up and attached the two outputs to my Teensy 3.0. In my program I can see the value changing as I manually move the motor. (Either 1023 or 0 if I recall correctly).


I am wondering how I can use this to determine position. I'm guessing that I can determine position by counting how many times the value changes from 1024 to 0 and then multiplying that number by a distance (not sure how to get that value). But when the system is first turned on, how will it know the initial position? Is there a way to get this from the encoder or some other device/method?


n.b. I also have an Atmega328P which I've been told may how me determine position how would I use this?


Question summary:



  1. How do I get the distance multiplier?

  2. How do I get initial position?





No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...