Go Down

Topic: 8 or 16 encoders: wich is the best way to implement? (Read 599 times) previous topic - next topic

Tronky

Hello, I made up to add 8 (16 would be better) rotary encoders to my diy midi controller. I don't know really much about multiplexers and shift registers...
Wich is the best way to implement them? Using less pins would be funny ;)

Please, I'm waiting for suggestions... :)

PaulRB

Post a link to the type of encoder you want to use. Read the "please read" post to find out how to post links.

Tronky

Well I'm considering to use relative rotary encoder with 3 pins (ACB) plus 2 for the switch. I posted here because I tought it's a metter of multiplexer or shift register...

Grumpy_Mike

You need to read the encoders rapidly and then you need some sort of user feedback on each channel you show where each channel is set to.
Have you thought how you are going to do this. You can't use the position of the knob because it is only relitave.

Tronky

what I am trying to realize is a midi controller that allow me to act on 8 (or 16) parameters of a virtual instrument, but I have to switch among virtual instruments, so I just need to send a +1 or -1 CC message. I'll solve this problem later... now I have to find the best way to connect 8 encoders to arduino saving pins for button switches and relative leds. Thanks to who helps :)

Grumpy_Mike

#5
Jul 20, 2017, 05:29 pm Last Edit: Jul 20, 2017, 09:49 pm by Grumpy_Mike
Quote
I just need to send a +1 or -1 CC message.
No you don't, a CC message is any number between 0 and 127.
So you might need to send either 0 or 127 but not -1 and +1.

Quote
I'll solve this problem later..
solve it now and you might find you don't actually need rotary encoders at all and all you need is pots or switches.

PieterP

If you need to switch between instruments, using rotary encoders is much, much easier than potentiometers.

Take a look at the Arduino Due or Teensy 3.1/3.2/3.5/3.6.
They support interrupts on all pins, and have a USB connection that supports MIDI over USB.

Pieter

Grumpy_Mike

Quote
They support interrupts on all pins,
So do all Arduinos, with the pin change interrupt vector.

Tronky

Can you explain with the easiest words how to do this? And please, help me to reduce the number of pins used, because I have to add many buttons and almost every button needs a led to feedback the state...   :smiley-confuse:  

No one?  :'(

MarkT

So do all Arduinos, with the pin change interrupt vector.
All Arduinos except the ones that dont....

The ATmega2560 has 24 pins that can generate pin change interrupts, and only 18 are brought out
to pins on the Arduino Mega.  There are only 3 pin-change enable registers in the map for ATmega architecture
so 24 pins is the max - which happens to be enough for all the Uno pins, but not for the Mega.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

PieterP

Can you explain with the easiest words how to do this? And please, help me to reduce the number of pins used, because I have to add many buttons and almost every button needs a led to feedback the state...   :smiley-confuse:   

No one?  :'(
Saving pins on the encoders is not going to work out very well. But why not use serial in parallel out shift registers (e.g. 74HC595) for your LEDs, and some parallel in serial out shift registers for your buttons, or just multiplex them in one big matrix?

Pieter

MarkT

Some sort of port expander with its own change interrupts might be good.  A quick search
reveale the MCP23017 which has 16 gpio pins which can be configured to interrupt on change
and have internal pull-ups. That should handle 8 rotary encoders with just the SPI bus and one interrupt pin.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Tronky

aving pins on the encoders is not going to work out very well. But why not use serial in parallel out shift registers (e.g. 74HC595) for your LEDs, and some parallel in serial out shift registers for your buttons, or just multiplex them in one big matrix?

Pieter
Yes, I have very poor knowledge in electronics, that's why I'm asking to you! :) can you givr more info about that?


Some sort of port expander with its own change interrupts might be good.  A quick search
reveale the MCP23017 which has 16 gpio pins which can be configured to interrupt on change
and have internal pull-ups. That should handle 8 rotary encoders with just the SPI bus and one interrupt pin.
It sound quite interesting! what is SPI bus? May be this is what I was looking for...

Thank you guys!

PieterP

Yes, I have very poor knowledge in electronics, that's why I'm asking to you! :) can you givr more info about that?
https://www.arduino.cc/en/Tutorial/ShiftIn
https://www.arduino.cc/en/Tutorial/ShiftOut
It sound quite interesting! what is SPI bus? May be this is what I was looking for...
Did you even bother to Google it?

Pieter

Grumpy_Mike

Quote
It sound quite interesting! what is SPI bus?
https://www.arduino.cc/en/Reference/SPI

Did you even bother to Google it?

Go Up