Going crazy on making a circuit board and MCP23017

Hello friends,

I am getting desperate because i am self-learning arduino and electronics and at some point guidance is needed for that someone with experience can help a guy out in a blink of an eye and save some time.
Keep in mind that my knowledge is very limited and based on reading stuff from forums and tutorials and videos.

Here's my problem, i appreciate in advance your kindness to help out:

I am trying to do something that i thought that should be simple. Expanding input to the arduino mega via MCP23017. First i tried to do all by myself. Bought some chips and wired 4 of them serially using I2C. The idea is to have a panel with 40 input buttons, and for what i've read i left 2 inputs on each MCP23017 unused because i've read that they don't work correctly as inputs. The result of my home made board was that I2C hung up at some time and point in time, like when it "heated up" from working 2 minutes(without the chip getting hot) and had some misreadings when working, so i figured out to design a board with some free board cad software. At this time i kept in mind that the problem could also be about having flux laying all around making small shorts because it spread everywhere and i could not clean it better than using alcohol and a tooth brush, leaving the solder dark and some white residue.

Back to the boards i designed, since the panel is too long for cheap production i had to make 2 separate boards that i will unite later on. And to make it even more fail-proof i bought a centipede shield from macetech which works correctly if i test the input pins with some jumper wire.
I could not find some assembly service so i just tried to solder it by myself. I'm not the best solderer but normally i get things done correctly. I also buy some circuits in kit form that i solder by myself with the same flux and iron and they work correctly.

When i received my board i started soldering the buttons and board connectors right away and did not test for resistance before, just took an eye-check and everything seemed fine.

Arduino is running those basic standard I2C sketches just for input detection, which is all ok.

But then when i connect the board to the Centipede i have almost all inputs LOW, and since i'm using its internal pull-ups, i should have 5V before pressing the button for it to work correctly. I can read it on the Centipede pins but not when i connect to my board. I measured with a DMM and i have in some pins around 0,5V, really depends. But always far from the expected 5V. And some times i have one or two buttons that signal correctly but at some time they stop working right, and voltage is never 5V when open circuit.
Also used an external 5V source with 5A to power the centipede from aux source and the behaviour is the same.

So i also have the other half of the board, and i just pushed the buttons onto the board and connected it to the centipede just by contact for testing and it is working as expected. And this is what i don't understand. They obey the same design rules, i mean, i didn't do anything differently.

Here are the design rules:
Trace width: 0,5mm
Min trace width: 0,01mm
Max width: 100mm
Clearance: 0,33mm
Via Diameter: 1mm
Outer Diameter: 1,5mm

Here is the Layout for the board that does not work: Notice the red circle is in a design flaw that i have corrected by not connecting that button pin and since there is a copper pour that button is connected to ground and i spotted it right away when i was soldering the buttons. I just cut that pin. Even if it was connected i guess it should only read badly on that input.

And the real board with copper pour and soldered:

Now the one that works if i connect directly to the centipede without being soldered :

Centipede datasheet: centipede_shield [macetech documentation]

Why is this happening? Can it be the solder flux? i tried to clean with water, acetone and still i have gooey thing in my board. I looked for solder shorts and could not find any. At the time i took the photos i was already de-soldering, trying to look for problems and try to measure the resistance on one circuit without the switch. i guess its fairly low, i should expect high resistance, right?
You can also see some papel leftovers on pins from cleaning on the pics.

The board was made in eurocircuits, and its a proto board, that's why it has this not-pro look.
I know mcp23017 is picky with interference from another current sources, thats why i made the cooper pour. Can it be creating my problem?

I'm out of ideas, sorry for the long post.

and for what i've read i left 2 inputs on each MCP23017 unused because i've read that they don't work correctly as inputs.

That is rubbish, all the inputs work correctly.

Why have you not posted your schematics? Have you got pull up resistors on the I2C lines?

Thank you for the reply,

About mcp23017 pins, maybe yes maybe no, i really don't know. but since using 4 MCP chips gave me enough pins i chose to skip those pins.

I can give some schematics but i didn't feel the need to because basically its just the centipede shield and the arduino mega. And those two work fine because i already tested it with some switches directly attached to the pins on it.

But i have 5v and gnd from arduino mega to centipede 5v and gnd respectively and pins 5 from centipede to mega's 21 (SCL) and pin 4 from centipede to mega's 20. That's it.
The rest is just a bunch of omron's B3F-1020 Tactile Switch, Non Illuminated, 0.98 N, 24 V, 50 mA connected to ground and on each pin of the centipede.
As far as the board goes, if anyone uses DIPTRACE i can provide the files as it is easier to take a look at the connections.

Centipede shield has pull up resistors on the I2C lines, yes. I'm not sure how many ohms because the datasheet does not specify and i don't know this color code.

Here is the pic if it helps.

About mcp23017 pins, maybe yes maybe no, i really don't know.

Yes but I do know, and they all work. I have used them in many projects.

Centipede shield has pull up resistors on the I2C lines, yes.

But so does the Mega, so you are getting a double dose.

Here is the pic if it helps.

Sorry no.

If you don't want to / can't supply a schematic then I will duck out of this thread.

But so does the Mega, so you are getting a double dose.

This is totally new to me. Thanks for that. For what i've read i can't disable it via software. Is that true?
Maybe i should unsolder the centipede resistors on the pic?

Yes but I do know, and they all work. I have used them in many projects.

I don't doubt that for a second. I just mean that as i had spare i used the spare and left those out because i didn't want to crash into more problems redesigning if they were actually bad. Did not want to find out by myself.

If you don't want to / can't supply a schematic then I will duck out of this thread.

I don't know if i am making myself clear that i don't have any problem doing that i just don't know how to make one since i'm using centipede.

But here is my take on it:

There’s a lot of stuff here, let me see if I can summarize it properly.

TL;DR version of your circuit seems to be this:

Arduiono → Centipede Shield → custom board with ton of switches

The custom board only has the tact switches and connectors. Each switch has an individual connection to the shield, they aren’t multiplexed or in a matrix.

The boards look way too shiny. Is there no soldermask on them?

try to measure the resistance on one circuit without the switch. i guess its fairly low, i should expect high resistance, right?

If it’s just the switches and no resistors on the board, you should be maxing out a typical multimeter. If you’re getting any kind of number you’ve got a problem. Something’s providing a low resistance (relatively speaking) path between points on your circuit that shouldn’t be connected.

The internal pullups on that MCP are weak. Typical value is about 70k, but they can be anywhere between 44k or 125k. Microamp level leakage currents is all it takes to screw them up.

It has to be the gunk. Cleaning it up is the only option if you want to use those boards.

The boards look way too shiny. Is there no soldermask on them?

It's a proto board made by this company that sells proto boards like these. For easy correcting the circuits and at an accessible price.

The custom board only has the tact switches and connectors. Each switch has an individual connection to the shield, they aren't multiplexed or in a matrix.

Thats my intention, exactly. There is also a 2nd circuit that's for displays ssd1306 . The pads on the right of the board and green connectors.

If it's just the switches and no resistors on the board, you should be maxing out a typical multimeter. If you're getting any kind of number you've got a problem. Something's providing a low resistance (relatively speaking) path between points on your circuit that shouldn't be connected.

The internal pullups on that MCP are weak. Typical value is about 70k, but they can be anywhere between 44k or 125k. Microamp level leakage currents is all it takes to screw them up.

It has to be the gunk. Cleaning it up is the only option if you want to use those boards.

I suspected that also and desoldered all the board with a heat gun. it was not easy as the copper pour and lack of mask makes it melt evenly. And now i cant suck all the holes right.

But check out the state of the connectors after i clean them with alcohol:

then i tested again one lane with the DMM and it maxes out. Centipede also checks out good.

So i seem to be on the right path. Just don't know how to clean this up now.

THANK YOU! i'll be posting evolution as i can

Bought some chips and wired 4 of them serially using I2C.

Read the SPI version datasheet

I2C version

Are you sure you have the I2C version and not the SPI version ?

Did you breadboard the chips using the SPI interface ?

Post your code.