I am using a channels 0,1,2 on a CD4051B multiplexer to switch the 3 inputs from an analog accelerometer. I control which channel is on with a raspberry pi, through inputs A,B,C. A,B,C are pulled down to 0 for normal meaning channel 0 is normally on. The output of the multiplexer is connected to the input of a 12-bit ADC.
The problem I am having is this:
When channel 0 of the accelerometer is connected directly to the ADC the raspberry pi is reading the correct voltage but when channel 0(or any other channel is connected through the multiplexer the pi is measuring a lower voltage. There is a voltage drop depending on what channel is turned on. So it can't be something with the ADC because when connected directly my program is measuring the correct voltage. I have tested this by commenting out the code in my program that switches channels and even when the output is continuously channel 0 I still get a voltage drop in my readout.
The weird thing is that when I measure the output of the multiplexer with a voltmeter it reads the correct voltage. Also it reads the correct voltage when the ADC is connected directly to the accelerometer. Maybe it is fluctuating when connected through the multiplexer so the computer is getting a different value.
How do I get rid of this noise through the multiplexer?
The problem I am having is this:
When channel 0 of the accelerometer is connected directly to the ADC the raspberry pi is reading the correct voltage but when channel 0(or any other channel is connected through the multiplexer the pi is measuring a lower voltage. There is a voltage drop depending on what channel is turned on. So it can't be something with the ADC because when connected directly my program is measuring the correct voltage. I have tested this by commenting out the code in my program that switches channels and even when the output is continuously channel 0 I still get a voltage drop in my readout.
The weird thing is that when I measure the output of the multiplexer with a voltmeter it reads the correct voltage. Also it reads the correct voltage when the ADC is connected directly to the accelerometer. Maybe it is fluctuating when connected through the multiplexer so the computer is getting a different value.
How do I get rid of this noise through the multiplexer?