Troubleshooting Encoders with MCP23017

Hi All,

First time builder here. I’ve successfully built a Zynthian using a Raspberry Pi 3B+, Raspberry Pi compatible DAC hat and a Ozzmaker 3.5 screen. I’m currently in the middle of trying to make custom encoders using parts I bought off ebay. The MCP23017 I managed to get hooked up and communicating to the Raspberry Pi however my encoders aren’t working as they should. The encoders I’m using where soldered onto a PCB that had 4 pinouts. The pinouts where GND, VCC, GA and GB. Im assuming that GND goes to ground on the MCP23017, VCC goes to the switch pins and GA and GB go to encoder pins A&B. However, this doesn’t seem to be the case and I have no idea whats happening or how to set custom pins on the Zynthian set up page.

YouTube Video of issue

For reference I am using this as a guide for wiring https://raw.githubusercontent.com/beckdac/zynthian-build/master/case/mcp23017_encoders/mcp23017_encoders.png

Any and all help would be greatly appreciated and yes! I’m planning on writing up a build log especially for other aussies looking to locally as many parts as possible.

Hi @astrosloth123. Welcome to Zynthland. I hope your journey will be enjoyable.

VCC is a supply voltage label and is probable used to bias the encoder switches via pull-up resistors so should go to 3.3V. Ground goes to ground and is used as a common switching level / pulse. GA & GB are your two encoder switch pins A & B. With those wired and configured in webconf you should get rotary encoders working. You haven’t mentioned any other pins so your encoders may not have push switches or maybe they are not presented on a connector. Post some pictures of your encoders and a link to where you bought them.

Hi riban,

thanks for the info! Here’s the [ebay link for the encoders] and below is a photo of the encoder switch. (https://www.ebay.com.au/itm/1PCS-Encoder-Rotary-Encoder-Coding-Switch-Module-NEW-S/172434964618?_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D20160908105057%26meid%3Df6b6c944d2654126beed4abff3bd5d3e%26pid%3D100675%26rk%3D1%26rkt%3D15%26mehot%3Dnone%26sd%3D172434964618%26itm%3D172434964618%26pmt%3D0%26noa%3D1%26pg%3D2380057%26brand%3DUnbranded&_trksid=p2380057.c100675.m4236&_trkparms=pageci%3A115dd4d4-fa49-11ea-b28a-5624003f15de|parentrq%3Aa53f6eb41740ad397f13cf38fff8e7d2|iid%3A1)

Can the ground on rotary PCB be shared between ground and switch on the MCP?

As someone recently said here, “ground is ground, except when it isn’t”! Within a standard (and most custom) Zynthians there is one common ground used for all digital and analogue signals so you can daisy chain or star wire a single ground connection to all points that need it.

It looks like the encoder module does not have it’s switch presented on the connector which is kinda contrary to the eBay description. Check that there is a definite click when you press lightly which would indicate the shaft does have a switch. Also, if it has three pins on one side and two on the other this suggests a switch. (Three pins are encoder A & B plus common (ground) in the centre). Two pins are the switch with one pin usually connected to common (ground).) I can’t see from the stock image the PCB traces so can’t tell what is connected. You could solder wires to the switch pins. If one is already connected to ground via PCB then you just need the one wire to the other pin.

Thanks for the advice. There’s a definite click but I think I might have to solder straight to the switch pins!