The Setup
I'm using a 74HC4051N multiplexer to interface with several analog sensors. I'm using a Wemos D1 Mini to read Z (output from the mux) using the Wemos ADC.
I've only illustrated one (of 4) TMP36 temperature sensors. I'm also monitoring the 12 V line from the battery. I use a 1.6 M ohm resistor to bring the 12 V down to 3.3 V at A0 in conjunction with the internal potential divider of the Wemos.
The Problem
If I disconnect all sensors (y0-y7) and iterate through all mux addresses, reading off values I get something like the following:
Address 0: Val 12
Address 1: Val 8
Address 2: Val 9
Address 3: Val 13
Address 4: Val 12
Address 5: Val 15
Address 6: Val 10
Address 7: Val 8
The low values are expected, the Wemos ADC is a bit noisy.
If I now connect the 12 V sense line only to say y1, the readings look like this:
Address 0: Val 476
Address 1: Val 802
Address 2: Val 436
Address 3: Val 410
Address 4: Val 469
Address 5: Val 398
Address 6: Val 401
Address 7: Val 451
The 12 V reading (value of 802) on address 1 looks to be correct. The Mux chip appears to be fine as using the TMP36 sensors on their own I see the expected output:
Address 0: Val 240
Address 1: Val 920
Address 2: Val 786
Address 3: Val 870
Address 4: Val 12
Address 5: Val 15
Address 6: Val 10
Address 7: Val 8
What am I missing? Why does it appear to raise the ground level of the ADC?