reading 3-axis analog accelerometer with multiplexer and ADC

Thread Starter

simplexity

Joined Jul 27, 2013
4
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?
 

crutschow

Joined Mar 14, 2008
34,408
Post a schematic of your circuit.

What control and supply voltages are you applying to the multiplexer?

Have you grounded all unused inputs?

Trying connecting a small capacitor (say 1nF) between the ADC input and ground and see if that makes a difference.
 

Thread Starter

simplexity

Joined Jul 27, 2013
4
Post a schematic of your circuit.

What control and supply voltages are you applying to the multiplexer?

Have you grounded all unused inputs?

Trying connecting a small capacitor (say 1nF) between the ADC input and ground and see if that makes a difference.
Supply voltage is 2.62 volts. Control voltages are either 0 volts or 3.62V for high. I did not have a 1nF but used a .1uF and it seemed to meld all the channel outputs into 1 and raised the output voltage to 1.7 when it should be around 1.61 for channel 0. I have connected all unused inputs to ground through 10K pull-down resistors. Will get a schematic uploaded soon.
 

GopherT

Joined Nov 23, 2012
8,009
Is your software allowing adequate delay for the ADC on the raspPi to catch a stable reading?

Is the raspPi waiting long enough for the multiplexer to change channels and catch a stable reading?
 

Thread Starter

simplexity

Joined Jul 27, 2013
4
There is adequate delay. Here is something new I discovered. If I have the control pins all grounded and don't write anything to the control pins in my software, the program reads the correct value. As soon as I write anything to the multiplexer control pins is when the issue starts, even if I write all 0's. I have to reboot my raspberry pi to get the correct readings again. Any thoughts?
 

Thread Starter

simplexity

Joined Jul 27, 2013
4
Yes, it works now. Thanks, I didn't see on the datasheet where it says it needs 5V. Everything else on my board requires 3.3V. I knew it was something simple.
 

crutschow

Joined Mar 14, 2008
34,408
Yes, it works now. Thanks, I didn't see on the datasheet where it says it needs 5V. Everything else on my board requires 3.3V. I knew it was something simple.
Yes, it's not real obvious. It's shown in the "Recommended Operating Conditions" section on the first page.
 
Top