Society of Robots - Robot Forum
Software => Software => Topic started by: SuperMiguel on June 07, 2012, 11:26:06 PM
-
So im trying to read the values from my encoder using an arduino mega.. This is the encoder i got:
(http://www.dfrobot.com/wiki/index.php?title=File:Encoder_Connection_(new_Version)(Web).jpg)
The motors i have are these: http://www.specamotor.com/en/Faulhaber/motors/2342-012CR/datasheet_motor.html (http://www.specamotor.com/en/Faulhaber/motors/2342-012CR/datasheet_motor.html)
-
Hey Super:
I don't see any encoder info up there - looks like you forgot to post it? In terms of the motor - it looks like the manufacturer has a lot of data - which is always a good sign.
You might want to read this introductory info about encoders here:
http://www.robotappstore.com/Robopedia/Rotary-Encoder (http://www.robotappstore.com/Robopedia/Rotary-Encoder)
It goes over how some rotary encoders work - which could help you out. Generally, most quadrature encoders have two channels (A and B). You could either poll the pins, or better (if you have the option) I would recommend using interrupts tied to your pin state change. A brief blurb about interrupts can be read here:
http://www.robotappstore.com/Robopedia/Interrupt (http://www.robotappstore.com/Robopedia/Interrupt)
Hope this helps, and if you have any questions feel free to let me know!
Robotman_24