Discussion in 'The Projects Forum' started by simplexity, Jul 27, 2013.

1. ### simplexity Thread Starter New Member

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

2. ### crutschow Expert

Mar 14, 2008
20,481
5,797
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.

3. ### simplexity Thread Starter New Member

Jul 27, 2013
4
0
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.

4. ### GopherT AAC Fanatic!

Nov 23, 2012
8,025
6,788

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

5. ### simplexity Thread Starter New Member

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

6. ### crutschow Expert

Mar 14, 2008
20,481
5,797
The CD4051 needs a minimum supply voltage of 5V for proper operation. Why do you have only 2.62V?

7. ### simplexity Thread Starter New Member

Jul 27, 2013
4
0
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.

8. ### crutschow Expert

Mar 14, 2008
20,481
5,797
Yes, it's not real obvious. It's shown in the "Recommended Operating Conditions" section on the first page.

9. ### GopherT AAC Fanatic!

Nov 23, 2012
8,025
6,788
Wow, you are unusually Curmudgeonly today

10. ### crutschow Expert

Mar 14, 2008
20,481
5,797
Actually I was not trying to be sarcastic in this case, but I guess it sounded that way.