Using Zynaptik module for encoders [SOLVED!]


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

Great! Welcome to the OZINE club (One Zynthian Is Not Enough) :grin:

Anyway, i will add some code to ease the use of zynaptic MCP23017 for controllers (zyncoder library), so no “radical” solutions are needed in the future :wink:

Thanks!

1 Like

@jofemodo - thanks !

OZINE - I like that ! Sounds not so far from insane… :grin:

Btw @dhrupadia_dad has also two zynthians by accident, one based on RPi3 and the other on RPi4.

Well, actually when you isolate A0 pin on mcp23017 and connect it to the ground - it automatically detects on 0x20 address without any extra changes in configuration. I guess will be a bit more difficult with a few mcp units (there can be up to 8 of them :wink:

BTW - Audioinjector zero is a nice card, completely satisfied with it’s signal/noise level. Audio input is quiet too.

1 Like

Yes I think it’s pretty acceptable. You can squeeze it in to some interesting places. .
It just does what it does, and it’s all making recording guitar for instant playback very slick . . .

I wonder how many of them you could string in a chain … ? :smiley: :studio_microphone:

Now your talking :-D. It’s understandable that having a 3B & 4 Zynth is a situation that people could easily end up in, how do people wire it together or is it now possible to play with some else … ? :smiley:

Could the 3B run as a good controller for the 4 located off stage talking only Ethernet ?
I have something similar and it’s having the appropriate patch loaded on both machines that is the only really missing feature ( Oh my piano has got sustain on, how do I clear it from onstage…?), so controllers must match up… How easily could a layer be marked as virtual? ( i.e. elsewhere), and how much data would we need to throw around to keep that agile?

Sorry just thinking out load. :smiley:

:face_with_monocle: really can’t wait for this one … :heart_eyes:

2 Likes

Hopefully, when we will have working midi sequencer or looper, the 2nd zynthian could be controlled from the first one via MIDI cable or in future via lan. This kind of chain would give more options for arrangement and even complete music pieces (16 extra midi channels, more instruments simultaneously).

For me the best reason not to destroy or upgrade 3b zynth is because I got used to it too much — can’t just kill it as it is so stable and working great. It’s like favorite pet, tamagochi, kind of friend :slight_smile: ! Wouldn’t sell it ever too !

Regarding Audioingector zero, it has some wierd setting in alsamixer (EDITED: “Output Mixer HiFi” something, will write correct name later), that makes input signal mixed and phased in a strange way by default. Turning it off (muting it - press F5 to see all settings in alsamixer and then “m” whe you reach HIFI setting with your lest-right arrows) gives clean undistorted signal (in my case it was 3b audio playback with fx on 4b). More than satisfactory for me !

@wyleu, agree with you, this card can fit into very narrow space and still be great :slight_smile:

1 Like

where is it possible to buy the flat cable with 4 connectors?

You can connect the encoders to the GPIO pins but it is becoming increasingly involved as various pins get low level functionality. Personally I don’t do it any more as I’ve had to reallocate specific pins for the reason I outlined above and it canbe quite an involved process detecting this when your natural first suspicion is you’ve got a hardware fault somewhere… There is a handy chart on zynth discourse somewhere. if you do want to give it a try…

ciao Chris
I have an unused Raspberry 3B, LCD 3,5", and a HIFIDAC
I would like to build my 2nd Zynthian.
How to do it?
First problem: I would like to connect LCD and HIFIDAC but I cannot do it without a GPIO duplicator. Could you suggest me a good ready solution?
Second the problem of encoders: is there a 3rd part board with connectors or maybe is possible to use a menu on touch screen?

How do you want it?

I happened to want a 60W Midi piano for easy use at events.

Depends on what you will genuinely use it for. The problems you describe are precisely those of the ongoing development but it is surprising what you can do with GPIO to power encoders. What you also loose is the s1-s4 switches which serve as a very useful control midpoint between the encoder world of znthian GUI parameter displays and the free for all world of MIDI devices. . .
I’ve not seen a GPIO implemetation of the the S1-S4 switches which indicates that 12c zynaptik type connections are a way forward.
If the application you have in your head involves use of these switches then this is something to consider. I use them for Record,Playback for MIDI and audio configured as toggled.

LCD screens are a hell all of their own. The closest I got was another Pi3 build with a Waveshare touchscreen which ws a saga all of it’s own…

https://discourse.zynthian.org/search?expanded=true&q=%40wyleu%20Waveshare

Not sure what you mean by this.

There is the zynaprik card

and I’m sure @jofemodo would be happy to supply encoders as well! But you can certainly run a zynth without encoders. A mouse and HDMI will provide a working solution.

1 Like

let me study carefully your answer :slight_smile:

Take your time!
Most of the stories are out in this forum. It’s really a matter of getting the correct search string.