Hi All,
My project needs to utilize several encoders, lets say eight for now. Most of the posts I've come across on encoders revolve around using individual Arduino pins, as well as interrupts in the software. Because I plan on having so many encoders, not only is using individual Arduino pins out of the question (I have an UNO), but so is using so many interrupts to make them accurate enough. I tried reading the encoders without interrupts, feeding the two channels of each through shift registers, and as you can imagine it misses a lot of pulses. I really need accuracy, even if that means at the expense of slight delay. What I mean is I don't need to know when the encoder is being turned to the closest microsecond, but if there was an IC that did the counting of pulses and output the number of rotations + direction to my Arduino every 1 ms to let it know what to do, that'd be perfect. I found the chip 74HC4020 on one post, which is a binary pulse counter, along the lines of something I'd need, but was unable to find info regarding it's use with encoders. Just wondering if anyone has any experience or knowledge on how one would be able to accomplish something like this, or if the 74HC4020 would be suitable? My knowledge on encoders is very limited, so I'm all ears to suggestions. Thanks in advance!
Pat
One such chip is the LS7366R. It has an SPI interface so you need a Slave Select pin for each one. If that is too many pins you can use a shift register to get more outputs.
Thanks for the reply! I'll check that IC out... Another solution I thought of is, since it seems like I'm needing a separate IC to do the counting, I figured I may as well have slave microprocessors to do the job. I'm looking to see if an ATtiny85 would do the trick, although I'm not familiar with them at all. I'll compare that option between the LS7366R.
Pat
Looks like the ATtiny85 would work. You can use it as an I2C slave and poll it from the main processor. That would use only two data pins on the maiin processor (SDA and SCL). It has Pin Change interrupts for all of the data pins. You would need to assign a different I2C address to each chip but that wouldn't be too hard.
To program the ATtiny 84 with the Arduino IDE you need a third-party 'core' (use Google to find one) and an ISP device. You can use ArduinoISP on an Arduino as the ISP device but it's a bit tricky. You can get a USBasp from eBay for under $4. Order early because they can take a few weeks to get here from China. They come with a 10-pin ICSP connector and you need to adapt that to whatever you have on the ATtiny. The Arduino uses the 6-Pin version so I recommend using that and getting an adapter (another $4 or so).
cui.com sells encoders (absolute/incremental) that use SPI communication. digikey sells them around $40/each.