View Single Post
  #121  
Old 12-01-2010, 10:00 PM
hikerbob's Avatar
hikerbob (Bob)
Registered User

hikerbob is offline
 
Join Date: Jan 2008
Location: Redlands, Australia
Posts: 253
On the subject of encoders I've found the page for US digital encoders http://www.usdigital.com/products/en...tary/shaft/s6/

The S6-2500-250-I-S-D (2500 CPR) is $75.87US and I think you can get 10K out of that by sensing changes of state in both channels. I don't know how that would work with the Bartel's circuit's.

I've done some play with the predecessor to that encoder and a damaged Arduino which only had one external interrupt working and could read off 5k positions per rev with a simple piece of code. I think that if I ran interrupts on both channels for a change in state 10K resolution could be achieved.

These also come with an index line but I've only played with that briefly and with limited success but I suspect that if I triggered an interrupt from a change in state in the index line it would be work well.

The Arduino code snippet I used to handle an interrupt on channel A from the encoder and alter a step count is as follows.

void StateChange() {
Ch_a_state = digitalRead(Channel_a);
Ch_b_state = digitalRead(Channel_b);
if ( Ch_a_state == Ch_b_state ) ++StepCount;
else --StepCount;
}

Reply With Quote