Go Down

Topic: Reading Rotary Encoders - Ideas??? (Read 1 time) previous topic - next topic

veeate

Greetings.
I'm trying to read three rotary encoders with an Arduino, and seeing that there are only two interrupts, the Paul Badger method in the playground won't help me - and the Max Wolf sketch is a little too imprecise for my project. I'm looking for a reliable method of reporting increment and decrement from each.

I've got three different encoders on hand to test with, a Bourns PEC12, Avago HRPG-AS32#11R, and an HP/Avago HEDM-5500 B06 - paired with a Diecimila Arduino...

*Any* help would be greatly appreciated.

Cheater

You can either use interrupt or polling mode for stuff like this.
Since you dont have enough interrupts, you need to poll the status of the encoders rapidly.

mrmeval

That seems very hard. You could interrupt the same pin for each of them but you'd also need to feed an address to the uC that would tell which unit triggered it. Sort of a MUX which would also inform the uC that there is data, it's from A/B/C etc

... later SPI I/O Expander with interrupt output.  This should allow you to use plenty. I didn't search for a breadboard compatible version. Maxim isn't the only one out there but I found more i2c ones than SPI ones.

http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3371/t/al



If it was designed by man it can be repaired by man.

follower

Quote
... later SPI I/O Expander with interrupt output.  This should allow you to use plenty. I didn't search for a breadboard compatible version. Maxim isn't the only one out there but I found more i2c ones than SPI ones.

This might be of interest:

  http://code.rancidbacon.com/LearningAboutArduinoMCP23S08

They also have a 16-bit variation.

--Phil.

veeate

Thanks all - these comments have been helpful!
I've ordered samples of both the MPC23S08 as well as the MAX7301 and will report back once I integrate them.
In the meantime, if anyone has any other suggestions, I'm all ears.

Thanks,
Jason

zachrahan

I am also hoping to read several encoders -- I'll have two or three quadrature encoders, which means four or six signals to monitor. Any information about how well these parts work would be very helpful!

I do have one question: the datasheet for the ATmega168 suggests that in addition to the INT0 and INT1 interrupts which can be set to trigger on rising/falling/low (and which appear to be exposed in the Arduino software and covered by the various tutorials), there are PCINT0-23 interrupts that appear to trigger on pin changes for various pins. There are plenty of these: would they be usable for reading encoder signals? I'm (of course) a complete neophyte to this, so it's possible that I've completely misunderstood what the PCINT interrupts can be used for: if so, my apologies.

mrmeval

You hijacked this thread which really doesn't let people see you. I'd suggest putting this as a separate query in the forum.

Quote
I am also hoping to read several encoders -- I'll have two or three quadrature encoders, which means four or six signals to monitor. Any information about how well these parts work would be very helpful!

I do have one question: the datasheet for the ATmega168 suggests that in addition to the INT0 and INT1 interrupts which can be set to trigger on rising/falling/low (and which appear to be exposed in the Arduino software and covered by the various tutorials), there are PCINT0-23 interrupts that appear to trigger on pin changes for various pins. There are plenty of these: would they be usable for reading encoder signals? I'm (of course) a complete neophyte to this, so it's possible that I've completely misunderstood what the PCINT interrupts can be used for: if so, my apologies.

If it was designed by man it can be repaired by man.

Go Up