Adding encoders to a home built zynthian

sorry, “nc”. To many letters for late evening.

But it’s connected to 5V in the diagram? Also, what’s the purpose of the 100nF cap to ground? If debouncing, read above I should mount them to each of the A* and B* pins?

Everything else seems a bit more clear now, thanks.

Thank you for your tip. I originally intended to go that route. I have two reasons not to do it thought: 1.) Some people strongly recommended using the mcp, 2.) Using the exactly 12 needed unused gpio needs also investigation to make that work. If I only need one single input in the future (for example a push button for self destruction) I have to start investigating the other (mcp) route, that’s why i try to unterstand that in the first place.

But I strongly appreciate every helping hand, so thanks.

For now, there are really only few questions left I think. 1.) which of my above mentioned guessings burn my setup 2) which will conflict with the hifiberry (voltage, SCL/SDA)

By the way, I managed to fire up the Hifiberry with a female->male 40-pin header.

You can always connect everything to the GPIO and if in the future you want to increase the number of buttons, insert an MCP and just put the extra buttons on it. If you see my configuration, I have the encoders on the GPIO and the buttons on the MCP… For the voltage, I had connected the MCP to 5Volts, then Jofemodo told me that the raspberry requires 3.3V, but honestly the MCP is still connected to 5V. probably the board already reduces the voltage…

Below is my setup without MCP. You can follow it and it should work… :

Remember that the pin number to enter on WebConf is the one in bold on this diagram.

I genuinely wouldn’t use the Rpi pins.
1/ These change at the behest of the Pi organisation and we have no control of that
2/ The zynthian has moved beyond the 4 encoder model and this is about as far as you can go with the Pi GPIO’s

Here’s a link to the zynaptik board schematic on the zynthian git hub repository.

There are also other relevant files up there.

I hope not @wyleu… My Zynthian encoders are connected to the GPIO and I’m using Vangelis and I do an update every time I turn it on… that is, every day… :grimacing:

I’ve had gpio pins stop functioning on GPIO pins when Pi have changed something down in the guts. It’s a way of getting going and I have machines that work this way, but i2c is really the way forwar.

Cool, but I’ll definitely will use the mcp, so my numbers to enter in webconf will be between 100 and 115, right? Except when defining the Int-A/B Pins. I think I understand the webconf, so, what I really would appreciate if somebody would just take my fear away answering these questions:

From MCP:

  • MCPs Vin and Rst to RPi 3.3V/5V?
  • MCPs SCL/SDA to the respective RPi 3/5 pins?
  • MCPs GND, D0-2 to RPi GND?
  • MCPs IA/IB to RPi Pin 36/37 as free GPIOs
  • MCPs A0-B7 corresponding debouncing cap to GND

From Encoders:

  • Encoders CLK, DT, SW to A0-B7 and set in webconf accordingly
  • Encoders GND to MCP GND
  • Encoders + to nowhere (I read this several times in this forum)

I really ask you to just tell me how to di this. I think I’ll give up if some more people tell me I am on the wrong route and should use completely another way. :pray:

Thank you for all your kindness and patience!

Otherwise: If you really think I am completely on the wrong path, please tell me, because I have about one week to return all the stuff I bought. (Btw, I originally went the “let’s try diy” route because I thought I would stay under the costs of the official kit. Well…)

We all had these doubts… don’t worry… I’ll tell you how I connected my homemade MCP (I made the pcb with my cnc…).
I connected the CLK pins to A0, A1, A2, A3, of the MCP. I selected the INT A on pin 7 (you can choose it on the drop-down menu).
I connected the DT pins to B0, B1, B2, B3, of the MCP. I selected the INT B on the other WebConf drop-down menu.
In the remaining pins I connected the switches…
My MCP is connected to +5 V and GND (here you will have confirmation from someone… but mine is connected like this.)

Yes, because the MCP’s GND is connected to the Raspberry’s GND.

Exactly!

Matching the zynaptik is really the way to go.

This is an open source hardware project so there are no hidden eproms or other such lock ins at work.

To be honest this is an excercsie in the early days, more of soldering than anything else.

First make sure you can talk to the 23017. To do this you use the command line

i2cdetect -y 1

(venv) root@zynthian-rack6:~# 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: – – – – – – – –
(venv) root@zynthian-rack6:~#

This is from the unit I phot’d up above ( rack6 to the train spotters amongst us)

It show’s the address the 23017 is registering which in the case of the zynaptik is select-able on the board with a bit of soldering.

To 20 …

There’s no point in proceeding any further down the ribbon cables till you get this bit working.
Because this is the first step in the chain.

You need the i2c connection on the Pi and the two Interrupts. To cut a long story short, you can either have the zynth take regular looks at your 23017 and check for change, or have the edge of consiousness, 23017, do this and attracts the attention of the Pi that it has something worth saying.
So we have two different Interrupt stories to tell in zynth world.
Someone might even mention what they are . . .

Transfering this bit of front end GUI interoperability out to a bit of dumb hardware ( sorry, 23017) is precisely the way to get a little bit more audio doing goodery out of a Pi.

That’s probably your best reason for going non GPIO.

Have a look at the config page for the wiring when in custom mode and see how it starts to line up.

So get your 23017 saying 20, and think about how it is to all be ruggedly mounted

As for the anti-bounce capacitors, I mounted them on Vangelis only but @jofemodo created a software anti-bounce that I tested and it works… so I would try without, then if you see that it doesn’t work well you can always put them…

Go with the schematic…

Thanks.

As far as I can read the schematic, A0 (D0 on my mcp) goes to 5V, and as far as I understand the mcp behavour this would define adress 0x21, or am I wrong?

The 100n capacitor from + to - seems to be right then.

You’ve got me reading the datasheet now!

I couldn’t entirely comment without getting the multimeter out and starting some surgery on rack6 to see what voltages are actually present on the Pins. The nice thing about i2cdetect is it displays ANY i2C connection it sees so it doesn’t really start to matter until you are adding other devices, if the device talks decent i2c you will see it there and since you only need enter the appropriate answer into webconf.

But mine shows up as 0x20.

Interesting, I will collect a breadboard tonight (I thought until yesterday I could prototype on a adafruit perma-protoboard) and try it.

I binged a mcp23017 youtube tutorial (in german language) and it seemed like the adress pins d0, d1, d2 (a0-2 sometimes) seem to configure the mcp adress like 20 + binary (000, 001, 010 and so on) to realize adress 0x20 (000) to 0x27 (111).

Needless to say I don’t even know what that means, but I’ll thankfully type that into my webconf tonight.

I was wondering if the schematic misordered the pins.

indeed it is. Putting all three of them to GND, you should have address 0x20.

By the way I got promoted by the discogod to novice trust level, so I’m afraid I lost the right to ask dumb questions forever.

1 Like

We all get fed too much soup round here…

It’s a great leveller.

2 Likes

… if you now ask other “stupid” questions you will be in good company … at least mine … I have asked so many … I won’t comment on the others … :rofl:

2 Likes

My worry is that if you haven’t figured out how to connect multiplexer to zynthian even though v5 and MINi and many previous versions have schematics on zynthian-hw GitHub which are very clear how to do that you will need to go back to basic and get something working first by connecting encoders directly. It is a big learning curve to connect and configure everything if you don’t have experience with multiplexer and zynthian config. Trust me, I went through it myself - started simple with no multiplexer and get them working and learn how config works then moved to adding one multiplexer and then two.