What's the easiest way for encoders?

Hello you busy builders, musicians and coders!

I’m planning to build a zynthian with a big screen and a custom case.
But my brain is about to be fried when I try to follow the several discussions about how to setup encoders in an alternative manner…

So here is my question:
What is the easiest way to connect encoders to the raspi including configuring it?

@jofemodo There wouldn’t be a standard Zynaptik-3 module left? I don’t know if I’ll be able to solder the smd parts onto the midi version…

Cheers
Phil

Hi @Fresh030 welcome.

I would say:

  • a mcp23017 breakout board from Ali,
  • 4 rotary encoders,
  • 4 switches,
  • some wires

and you’re in for doing a kind of Zynthian v4.x clone :smile:
at least for the controls.

Zynthian webconf tool lets you customize/adapt your wiring.

1 Like

I’d agree with that. Go with a similar circuit to the current kits. You can use io pins directly but you run out of function keys and also expansion connections like leds and you are also beholden to changes imposed by the pi itself. I’ve built enough of them to know the gpio route is a dead end.

@le51
@wyleu
Thank you. Breakout board ist ordered.
I’m gonna give it a try.

Thank you!

Hello

Does this board work for this purpose?

image

I believe it should be ok if you can configure the address for 0x20 and the interrupt pins are wired correctly.

root@zynthian-rack:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: 20 – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –
root@zynthian-rack:~#

Actually, you can configure Zynthian to use any I2C address in webconf:


but it is probably worth configuring to 0x20 if you have that option. I see there are three address configuration bridges. The docs should describe what they do. At a guess I would imagine the default is 0x20 but do check. Of course you could just connect it to the RPi’s I2C bus and then run:

i2cdetect -y 1

to see what addresses are occupied.

@ Jeremias Where is that 23017 PCB from?
If this is to be successful, and I can think of no reason why it shouldn’t, it would be a good idea to have the details of a first choice source so there is some consistency.

Hi @le51!

Would you provide a detailed scheme of the suggested implementation?
That might mean the succesful ending of my Zynthian project!
Best regards,

1 Like

WOW!! Thank you so much @le51!!
Now only need to interpret it correctly. Anyway, I think I will need a helping hand near me :grinning:

1 Like

Good luck :wink:

Now I have no excuse, it has to be done. I use those bad encoder modules wired directly to GPIOs for years, but I can use only the rotary encoders, not the switches, you know why… I already bought all the parts to build the correct wiring with MCP23017, but I couldn’t find an exact scheme like this. Thank you very much!

One question: why do you use capacitors with the S_1-S_4 switches, but not with the S_5-S_8 switches?

Hi again @le51 !
Yesterday, and after receiving the attached pcb

I put my hands on over the project one more time.
Initially I could locate easily the wire controls A_1 to A_4 and B_1 to B_4 correspondence, however I´m confused when it comes to 5_1 to 5_8. I cannot see them, nor in my pcb nor in your scheme.
May this be a kind of convention beyond my knowledge?

Moreover, when you correlate GPB0-1-108, GBP1-2-109, GPB2-3-110, and say “labelled 100 to 115” I cannot understand where those numbers (100 to 115) arise.

Finally, I have found “zynthian_allinone.sch.pdf” (attached at the end) in which I can find an easy correspondence among encoders and buttons wiring with MCP23017, so: is this a valid guide to apply on your scheme?

If yes, when you speak of encoders –A,C,B,S1,S2– parts, such scheme speaks of –1GND, 2, 3, 4–. Probably for all of you that are engineers is a minor detail but for me is a nightmare :upside_down_face: :rofl:

Best regards

zynthian_allinone.sch.pdf (51.4 KB)

Hi @erasmo

S_1 to S_4 are encoder’s switches

while S_5 to S_8 are for push buttons.

In fact you can bridge any of A_x, B_x, S_x pin to any GPAx or GPBx pin because you can configure the wiring through Webconf with the numbers labelled 100 to 115 in the schematic.

Yes you can allocate the pins anyway you wish using the mechanism in webconf. But do make very careful notes about what you do connect to what and at the very least grab a screenshot of the webconf display and keep it in an easily accessible place. It is amazing how quickly you forget these details once it works and you will find yourself scrabbling around for the details when you come to reconfigure things… Some disreputable characters have even been known to post screenshot of the settings on this very board along side machine names to provide easily accessed backups whilst maliciously claiming such images are really for the overall community good.

Copy one of the official mappings if you can.

Thank you very much for your fast response @le51 !

You have clarified the panorama in front of me, specially the webconf part.
I was in trouble because of a little bit pixelating scheme, where I was reading S (letter) instead of 5 (number) or viceversa.

Please tell me if I understood in a proper way: I can connect so the encoders as the buttons in the MCP23017 GPIO positions that I want, but, observing the correspondence with 100 to 115 numbers of webconf. Is it so?

Thank you so much @wyleu !
I will observe carefully your insights and, definitely, will start copying one of the official mappings.

Excellent advice from @wyleu.

I would add

  • For clarity use different wire colors, one for A pins, one for B pins, one for S pins and one for ground pins.
  • Invest in a cheap multimeter to check if you did not create some shorts circuits during soldering.

Yes. Imagine you’ve wired pin A of controller 3 to PA2 => in webconf, for Encoder B GPIO’s config : X,Y,102,Z where X,Y,Z are B pins config for controllers 1,2,4

Thanks a lot @le51
I´ll give you more info on the progress :wink: