Go Down

Topic: Reading 8 Rotary Encoders with MEGA 2560 and Multiplexer (Read 1 time) previous topic - next topic


Can't see any extra interrupt processing here apart from the MIDI library.
That is a rough tutorial, it is wrong. The capacitor should not be on the latch pin. This is an ongoing problem with these official tutorials. Many people have pointed out the problem but nothing gets done. Each chip should also have a 0.1Uf ceramic capacitor placed between the power pin and ground, as close to the chip as possible and with as short a lead length on the capacitor as possible.

What does the (x24 meters) bit mean?

I didn't know this... Note taken. x24 means I took this shift out circuit and made 24 of them.

Thanks DrDiettrich... So this is a good starting point?


x24 means I took this shift out circuit and made 24 of them.
So the meters bit is a typo then.

with 24 shift registers you have 192 outputs, is that correct? Do you need that many? Using that many shift registers I would buffer the clock and latch pins into two groups using some 74HCT04 inverts or similar.
Also the shift out function will be slow for this many registers, I would use the SPI interface to drive this at the maximum speed.


May 17, 2016, 04:14 pm Last Edit: May 17, 2016, 04:19 pm by ibanman555
192 is correct. Each LED needs to respond to a specific 3 byte message. I'll look at the T04. Not worried about it much though. It's actually working great. My only concern now are the rotary encoders and how to apply them to my existing sketch and circuit.


I'm working on a similar project. I was wondering what your conclusion was for the eight encoders on the mega board.

 In thinking through this problem I had an idea about using capacitive sensitive knobs on the encoders. This way you will know which one (or two) encoders are being touched and then you can switch the address lines of one (or two) multiplexers to select the touched encoders.  You'll need two multiplexers per encoder (A & B lines) for a total of four multiplexers. But then you can  route the output of the multiplexers to four interrupt lines on the mega to guarantee pulse counting.   To conserve I/O you can even use a 5th multiplexer, in a "standard mux input configuration", for the capacitive touch sensors on the eight encoders.

But I'm hoping you tell me that you stuck all eight encoders (16 wires) on non-interrupt digital pins and everything worked fine. :-)



Feb 16, 2017, 04:48 pm Last Edit: Feb 16, 2017, 04:53 pm by arduinoaleman
If you do not want to miss pulses on your eight rotary encoders you will need eight interrups - 8 different pins.

Interrupt sharing does not work with rotary encoders. They do not store if the just sent an interrupt or not.
If your questions are not precise, nobody can help you.

Go Up