As reported in the last post on this topic, I soldered headers onto the two 16 channel MUX and started testing. Since then I have spent a bit more time trying to get it all to work. The major change was simplifying the code not to use Port manipulation on the arduino. It all looked good, but just would not work for me.
Next problem, two MUX would not work together, so I separated them on the breadboard, and connected +ve to one and -ve to the other. I was still testing with one cell at this point, so it was not an issue.
With just one cell attached anywhere on the MUX, the correct voltage was reading for that cell, but subsequent cells read incorrectly, not randomly – each cell was slightly less than the one before it, to if the cell attached was 3.33v, the next was 3.21, the next 3.13, the next 3.04 and so on, wrapping round at the end of the 16 cells and continuing from the first cell. I thought the MUX had there own pull down resistors, so I am not sure what is happening here, but it could be internal shorting as described below.
Finally, I connected up 3 cells to make a test rig, put the two mux together on the breadboard and attached the 3 cells. Switching on and no cells were being read correctly, and the MUX switching the -ve sides was getting very hot. I had noticed this before during other testing, and it started to become apparent what the issue was.
It is back to the original problem of the common ground. the MUX is switching the -ves of the 3 cells to ground in turn, but internal shorting through the MUX is allowing the -ve of the highest cell to connect directly to the -ve of the lowest cell, with a 6v difference! Hence very hot and not working.
So MUX are not the answer either, and it looks like I may have to build 16 switches using transistors. However, the MUX also operates as a DEMUX, so I can control the 16 switches with the output from the DEMUX, using the same control pins as the MUX on the +ve side is using. A little annoying, as it may still not work. Maybe just try it with a couple first. I have some optical isolators that I haven’t used yet, maybe they can finally get used.