Pages: [1]   Go Down
Author Topic: Reading Rotary Encoders - Ideas???  (Read 1355 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



Logged

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

New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

Pages: [1]   Go Up
Jump to: