16x Oleds, 16x encoders and 16x buttons. Best way to connect all of them?

Status
Not open for further replies.

flocked

Active member
Hi,
I’m currently working on a midi controller with 16x OLED displays (128x32), 16 encoders + 16 buttons. I’m planning to use the Teensy 4.1. What’s the best way to connect all of them without having too much delay?

I was thinking of using 2x 74HC4067 as multiplexer for reading the encoders, 1x 74HC4067 for the buttons and to connect the displays via SPI connections (addressing them via multiplexed CS and shared DC + clock)

Would that work or create too much latency? (In writing to the displays and reading the encoders).

thanks!
 
Regarding the encoder part of your project you might be interested in the EncoderTool (https://github.com/luni64/EncoderTool)

  • It supports normally connected as well as multiplexed encoders with or without push buttons.
  • You can choose the readout mode (full, half, quarter and a few variants) to match your encoders (default is quarter, which matches the usual 4 counts/detent encoders)
  • 'Quarter' and 'half' readout modes are fully bounce free. The 'full' readout mode ensures to end up with the correct position but can not prevent quick up/down counts during the bounce time of the switches. This is exactly the same behaviour as for the stock Encoder library (which provides 'full' mode only)
  • You can limit the count range, either hard or cyclic (https://github.com/luni64/EncoderTool/wiki/Quick-start-guide#limiting-encoder-output)
  • Push buttons are debounced using bounce2
  • If you want, you can attach callbacks which are invoked on encoder change and/or push button events (https://github.com/luni64/EncoderTool/wiki/Reference#attaching-callbacks)

The repository also contains information / schematics on how to multiplex encoders using a CD4067 or a HC165 shift register. https://github.com/luni64/EncoderTool/tree/master/extras
Here a simple test setup using the sparkfun 4067 breakout boards (schematic in the link above):
assembly3d.jpg

And here a simple sketch showing how to use it https://github.com/luni64/EncoderTo...s/03_Multiplexed_4067/03_Multiplexed_4067.ino

The documentation (https://github.com/luni64/EncoderTool/wiki) might need a rework but at least the quick start guide and the reference section is pretty complete. Here a thread with some more information: https://forum.pjrc.com/threads/5948...port-expander-What-will-work-with-the-library
 
Last edited:
As for the displays the best way to connect them would be to make use of both SPI buses and have them update using DMA so they don't add any delay, though I'm not sure if anyone has made a DMA library for these displays yet.
 
Thanks for your input.

someone suggested, that I should rather use 74HC165 shift register for reading the encoders and buttons as it's faster.
 
IIRC there is not much difference in the timing, but I can do a quick measurement tomorrow. Please note that the 4067 gets significantly faster if you supply it with a higher VDD (e.g. 15V)

Screenshot 2020-12-03 205043.jpg
 
Thanks. I guess the difference will be so small that it's completely unnoticeable

If I think about it I might continue using the 4076. The pcb will be cleaner as it doesn't require pull up resistors for each button and it's halve as many ICs. 4067 is 16 channel, 165 8 channels.

.
 
Status
Not open for further replies.
Back
Top