Using Zynaptik module for encoders [SOLVED!]

Question to @jofemodo - please share, what kind of wiring should be used with zynaptik module without zynscreen ?

1 Like

Will try to check the soldering once again (and again, and again), maybe I’ve missed the spot somewhere. Of course I can simply replace RPi 3 with 4 in my old case, but isn’t it too simple kind of solution for the people like us :smirk: who like to struggle during the process of creating (or co-creating) something new ?

Also, it will be a pity to tear down working zynth rpi3, make new wholes for ventilation etc.

Here I have a chance to design a new case for a second zynthian…

Just a few thoughts…

Hi @dhrupadiya!

Zynaptik is not designed for connecting the controllers. It’s a digital/analog input/output interface with 3 MIDI ports. It’s a part of v3 kit, designed for working with the zynscreen, that include the primary MCP23017 for connecting the controllers easily. Sorry if you thought a different thing …

You can connect the encoders to the zynaptik 40-pin connector using dupont connectors, but the MCP23017 is in a different address (0x21 instead 0x20) for avoiding conflicts with the zynscreen. This secondary MCP23017 is not implemented in the zyncoder library yet. Of course, you could change the address in the zyncoder code to use the secondary MCP23017 as primary, and then use the “standard” MCP23017 wiring from webconf (the 2 INT pins for the secondary MCP23017 are connected to RBPi’s GPIO 25 & 27, the same used by the AllInOne :wink: )

Regards,

Glad I saw this, I was toying with the idea of doing the same thing.

1 Like

I could change your zynaptik by an All-In-One module, if you want …

@jofemodo, thanks for explaining everything, because I was going a bit crazy. Checked my soldering once again with tester and all contacts seems to be fine (so my soldering skills are not the reason it’s not working ooohfffff :slight_smile:)

Please tell me, where in zyncoder code I can change the address for the secondary mcp23017. Can it be done with text editor like nano or do I need anything else ?

Last question, do I have to apply this change every time after updating zynthian, would it be overwritten by update ?

Honestly I am happy to take more effort and to make more of zynthian on my own this time — it is really interesting to solve all these things. Also knowing it a bit better might be useful as it helps improving it for the best of our community, I had quiet a few ideas for a long time.

p.s. Glad I am not alone with zynaptik struggle - @smiths73v3 had the same ideas (but no struggle, as @jofemodo has explained the solution)

@jofemodo, I have edited zynaptik.c file in zyncoder and changed the address from 0x21 to 0x20, recompiled as mentioned in README.md

Didn’t change a thing (wiring is as you have mentioned - pins are as in AllinOne module).

Am I doing wrong ?

Please tell me how to proceed when you have time.

Thanks !

Did you re-build the zyncoder library after the change? Note that it’s a C library …

Regarding the update, yes It will overwrite your changes, but i will fix It ASAP …

Regards

1 Like

Well, I’ve recompiled build folder inside zyncoder folder after changing the adress in zynatik.c file from 0x21 to 0x20 - according to instructions in README.md in the same folder. Rebooted and still zynaptic’s mcp23017 is not recognized (GPIO pins 25 & 27 are selected in web config). I didn’t apply all the necessary changes after modification and compilation ?

@jofemodo, thank you for your kind and patient support !!!

Send the output of this command:

gpio i2cd

You should see a “21” in the 3th row …

Also, please, show me how you connected the encoders to the Zynaptik …

Regards,


Sorry for the way this test encoder is made…
“This is the way” at least for me right now :slight_smile:

p.s. Doctor, am I alive ? Will I play piano again ? ;)))

Your MCP23017 is alive, so if you:

  • changed the port in zyncoder source code + re-build
  • connected the encoders in the right way
  • choose the right configuration in webconf

It should work :wink:

I suppose you are using this info:

Regards,

1 Like

Bless you, @jofemodo :partying_face: ! So grateful to you !

Will do it tomorrow.

One small lame question for the last, how to rebuild everything properly ?

”cmake …” & “make” after it from new “build” folder (inside zyncoder folder) will do the thing nicely or any other actions are necessary to rebuilding everything ?

The only committed changes I made are to “zynaptik.c” file were I’ve replaced “0x21” with “0x20” and saved the file before compilation.

Correct ?

It’s enough and should work ?

Thanks a lot !

:pray:

Use the “build.sh” script :wink:

Yes … but AFAIK, nobody did it before :wink:

1 Like

@dhrupadiya if you are going custom anyways, I’ve had some luck with Arduino style 5pin header encoders with 2 changes. First, connect V3.3 to the + pin, and then reorder the GPIOs in the webconfig.

1 Like

Blockquote[quote=“jofemodo, post:123, topic:3061”]
Use the “build.sh” script :wink:[/quote]

Great to know - will be my pleasure to use it :slight_smile:

@jofemodo, I always wanted to feel myself “Gagarin” with something done for the first time. If zynthian will fly above the clouds I will tell you :grin:.

Being serious — when it will finally work, it will be a very nice pathway for anyone in the community to follow, because building zynthian in a custom way happend to be a special kind of fun and now I know it :slight_smile:

Without your support, development team and all our experienced fellow zynthianers it wouldn’t be possible - thanks once again !

@smiths73v3, thank you for sharing !

I am using common button infinite encoders now, so not for this time, but it is good to know that Arduino encoders work too !

No luck unfortinately. Rebuilt everything a few times (using build.sh at the end), reverted changes a few times - encoder doesn’t work and webconfig says:
GPIO Expander: Not detected

Inside zynaptik.c file I have changed only the address of MCP23017 (from 0x21 to 0x20).

When it didn’t work, I’ve used some logic and tried to change base pin number to 100 (isn’t it GPB0 on MCP23017 ?) - again no luck. Reverted back.

Tried to connect encoders to as different controls (1, 4) - no luck either.

Somehow MCP23017 seems to be not even initialized.
According to it’s specifications INTA is pin 20 and INTB is pin 19 if I am correct.

Checked all the connections twice with tester - everything seems to be in order.

Tried MCP23017_Extra and MCP23017_Encoders layout for wiring.

Maybe we miss something like extra file include in the code, extra comma or something. Seems to be so close, but yet…

Still looking for solution … :sweat:

UPDATE:

Right now I have discovered, that my MCP23017 on zynaptik is still detected on the address 0x21 even as I have changed it’s address in “/zynthian/zyncoder/zynaptic.c” file to 0x20 (everything compiles and built after changes). Still “i2cdetect -y 1” (same command as ‘gpio i2cd’) shows me it’s address as 21.

Looking for the natural way to change it’s address to 0x20. Some forums says the signal on the pints A0 A1 A2 are respoisible for addressing each MCP23017 if there are several together. Can be up ti eight :slight_smile:

Any ideas how to do it on zynaptik not to burn anything ?

A2 A1 A0 I2c Address
0 0 0 0x20
0 0 1 0x21
0 1 0 0x22
0 1 1 0x23
1 0 0 0x24
1 0 1 0x25
1 1 0 0x26
1 1 1 0x27

p.s. If I connect A0 to the GND it should let it be on address 0x20 technically, but wouldn’t it create short circuit ?

SOLVED !!!

In a very “russian” radical way I might say. There was some current on A0 of MCP23017 (have no idea 5 or 3.3 volts) and I have just cut this contact and immediately webconfig says:

GPIO Expander: MCP23017

I have 2 spare MCP chips so I sacrificed one.

Now zyncoder_test shows activity on connected encoder and I can proceed further.

So for those, who would have similar approach with zynthian to make zynaptik module work as standalone mcp23017 extender as well as analog and digital IO extention, you need to change two things in zynaptik.c:

    #define ZYNAPTIK_MCP23017_I2C_ADDRESS **0x20** (was 0x21) 
    #define ZYNAPTIK_MCP23017_BASE_PIN **100** (was 200)

Then follow the instructions in README.md inside zyncoder folder and rebuild everything (build.sh).

Thanks for great support everyone, especially @jofemodo ! :grinning:

1 Like

Yes, Tying A0 to GND will short out +5V.
Best bet will be to track the trace to A0 back a bit, cut it and tie that pin to GND. Be sure to ohm it out before and after to make sure you got it right…

Here is a link to the zynaptic schematic:
https://github.com/zynthian/zynthian-hw/blob/master/zynthian_zynaptik/doc/zynthian_zynaptik.pdf

1 Like

@jofemodo, thank you very much ! Finally everything works. Now the creation of new enclosure starts.

4 Likes