How to use analog multiplexer CD4051

SgtWookie

Joined Jul 17, 2007
22,230
I tried connecting it in series, but i saw that the output was pretty noisy... so, i got confused, if i should connect in series or in shunt it to ground.
I've changed my mind about C1 - it needs to be removed entirely, and the inputs from your foil strips need to be buffered.

About R2-- I saw it in the datasheet... there was this application. on pg.8
That was not an application schematic - that was a parameter measurement information schematic; the test circuit to show how they came up with the specifications.

You do not need or want that kind of loading on your opamps; it will just cause excess heating and power usage.
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
OK, you are using a PIC16F871 with a 4MHz crystal for a clock.

I didn't know they existed. The PIC16F87x goes from PIC16F873 to PIC16F877, and they are obsolete, having been replaced by the PIC16F88x models.

You are trying to scan this thing pretty quickly.
I did try a delay of 5ms after I scan 1 input... however, the aluminum sensors themselves are so slow and cause a delay that, I couldn't capture the entire wave in the mux... the output of mux was such that, it seemed to follow the input wave, but, the amplitude was lesser... hence, i removed the delay in the scanning...
It would help a great deal if you had voltage followers for each input to the 4051's. As a matter of fact, that is probably the only way you are going to be able to fix your problem.


Your strips of tin foil represent a series of very high impedance inputs. As you scan through the mux/demux lines, they are each connected to the same input capacitor, which represents a load.

The way to avoid that is to have each high-impedance input signal buffered to have a low-impedance output - into each 4051 mux/demux. Then, the signal will make it through to your amplifier, and even through the amplifier - providing that you correct C1, and remove R2.

You will need opamps that have rail-to-rail input and output that can operate with a +/-5v supply. Quad versions would save you some board space. You'll have some channel interference and the CMRR will go down, but it doesn't sound like your application is that critical about such things.
Some amps to consider are LM6134, MC33174, MCP6024.

[eta]
After more thought - you're going to have to remove C1 from the amplifier circuit entirely. It doesn't matter whether it's in series or shunt, it will simply load things down too much.

The 4051 and 4052 both have a typical channel resistance of 120 Ohms when the supply is +/-5v - but it could be as high as 400 Ohms per channel.. Since you have two in series, that's roughly 240 Ohms, or possibly up to 800 Ohms.

You simply can't afford to have any capacitance or loading at all on the input of that amplifier.
what is the best possible way to avoid this??
And you will have to use voltage followers/buffer amps on each input to your 4051 mux/demux ICs.
It's not as bad as it sounds - if you use quad opamps, that's only four more IC's. Make absolutely certain that you use 0.1uF bypass caps across each opamp's power rails to ground.
hi.. i have 32 input lines, and 4 of such 32 systems... so that will be like 128 input lines.. Do I need to use input buffer? isn't there any other option?

The reason I am asking is, the input and the output of the mux is just the same.. i.e. the mux kind of follows what's at the input... and this is d same circuit that I have used previously when i had designed 21 sensor systems.. however, it did not have any mux in them....

another thing... even though tl084 is a rail-rail opamp, i observe that the max output voltage is hardly 4.188V
what could be the reason for this???
 

SgtWookie

Joined Jul 17, 2007
22,230
If you want to try to use it unbuffered, go ahead. However, you must remove any capacitance possible from anywhere in the signal path, besides the first input capacitor. You can't leave the inputs to the 4051 mux/demux floating, so you will need some high-value resistor to ground at that point, and you can use a high voltage capacitor (like a 100nF ceramic disk) to isolate the aluminum foil strips from the 4051 inputs.

If you can't reduce the capacitance in the analog signal lines to a very low level, you will have to use voltage followers. In any event, the capacitive and inductive coupling from the address lines will cause problems with the analog signals.

When you can't get it working like you want it to, then try my suggestion. Note that you cannot use a TL07x opamp for the buffer amplifiers, as it is not rail-to-rail.
 

SgtWookie

Joined Jul 17, 2007
22,230
As far as how fast you can scan the mux/demux circuit,

You will need to add up the switching delays of the 4051 and 4052, propagation delay times of a single 4051 mux, the 4052 mux, the four TL072 opamps, and factor in the RC time for the input capacitance of the 4052 vs the resistance of the 4051, and the input capacitance of the TL072 vs the resistance of the 4052, and don't forget to calculate for the effects of parasitic capacitance and inductance. Oh, a piece of straight wire 10mm long has about 15nH inductance.

That is how long you need to wait after sending an address change to the mux/demux array before you can start your ADC. Don't forget that you should have a small cap right at the ADC I/O port so that it has a low impedance to sample from.
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
If you want to try to use it unbuffered, go ahead. However, you must remove any capacitance possible from anywhere in the signal path, besides the first input capacitor. You can't leave the inputs to the 4051 mux/demux floating, so you will need some high-value resistor to ground at that point, and you can use a high voltage capacitor (like a 100nF ceramic disk) to isolate the aluminum foil strips from the 4051 inputs.

If you can't reduce the capacitance in the analog signal lines to a very low level, you will have to use voltage followers. In any event, the capacitive and inductive coupling from the address lines will cause problems with the analog signals.

When you can't get it working like you want it to, then try my suggestion. Note that you cannot use a TL07x opamp for the buffer amplifiers, as it is not rail-to-rail.
Yes sir... I will try all the possible options you suggest.. in fact i do try :)
I m sounding very desperate as i need to get the hell outta university...

Anyway, I shall try connecting high value resistors probably 30M.. i have few of those...

But i have a query, why does this system run excellently w/o the address lines of mux being scanned by a uC... i mean if i give SELECT lines 5V dc, then whole of the system works ... even with loading effect..
 

SgtWookie

Joined Jul 17, 2007
22,230
The reason I am asking is, the input and the output of the mux is just the same.. i.e. the mux kind of follows what's at the input... and this is d same circuit that I have used previously when i had designed 21 sensor systems.. however, it did not have any mux in them....
Sure, it worked OK before you added the MUX/DEMUX. That's what I'm trying to tell you - right now, you are trying to switch high-impedance inputs to a low impedance input, and that's making all of your inputs reflect the average voltage of what is on C1 of the amplifier. You really do need those voltage followers/buffers, and remove C1. Then your problem will go away.

another thing... even though tl084 is a rail-rail opamp, i observe that the max output voltage is hardly 4.188V
what could be the reason for this???
The reason is that a TL084 is NOT a rail-to-rail opamp. It can sense INPUT voltages up to the positive rail, but it can't sense within 3v of the negative rail. With Vcc/Vee being +15v/-15v and a load of 10k Ohms, the outputs have a typical range of +13.5v/-13.5v - or about 1.5v away from the power rails.

If you had read the datasheet, you would know this.
 
Last edited:

Thread Starter

CrackJack

Joined Aug 7, 2009
127
Sure, it worked OK before you added the MUX/DEMUX. That's what I'm trying to tell you - right now, you are trying to switch high-impedance inputs to a low impedance input, and that's making all of your inputs go all over the place. You really do need those voltage followers/buffers. Then your problem will go away.
Alright, I shall try this out tonite...
thanks a lot..
The reason is that a TL084 is NOT a rail-to-rail opamp. It can sense INPUT voltages up to the positive rail, but it can't sense within 3v of the negative rail. With Vcc/Vee being +15v/-15v and a load of 10k Ohms, the outputs have a typical range of +13.5v/-13.5v - or about 1.5v away from the power rails.

If you had read the datasheet, you would know this.
Oh yes... i saw that in the datasheet... i forgot.. sorry...
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
If you're still as in doubt why you're having trouble with this mux/demux thing, try this:



Charge the caps on the left to different voltages.

Then push the buttons, one at a time, in sequence. See what voltages you wind up with on the cap on the right, and the caps on the left. Then push all the buttons in sequence again.

After you do that several times, you'll find that all the caps start to measure just about the same voltage.
 

Attachments

Thread Starter

CrackJack

Joined Aug 7, 2009
127
Hello Sgt.Wookie,
I connected a buffer circuit at the input of the mux. I see sufficient output at the end of the amplifier.
I also removed the capacitor too which is at the input of the amplifier...

And, i connected the micro-controller output to a serial port and saw the output on the hyperterminal... i could see the proper sensors being selected ... so, things are working out.. :) thanks to you all...
however, i have 1 problem, the output wave at the end of the amplifier is pretty noisy... i want to reduce this noise....
should i put an active filter at the input stage of the amplifier???
 

SgtWookie

Joined Jul 17, 2007
22,230
Before you start adding filters, try increasing the time between when you change the address select lines, and when you perform your ADC.

Did you add resistors to the address select line output from the MCU, and caps to ground near the ends of the address bus like I suggested previously?

[eta]
As I said before, you are working with an input that has a very high impedance, and low capacitance. It's going to be very easy for noise to be coupled to your inputs. That is why I suggested for you to put the opamps as buffers on the inputs to the 4051.

You may have a noisy ground bus. If you still have this circuit breadboarded, it's pretty certain that your ground is noisy. Once noise contaminates the analog signal, it will be very difficult to remove.

You need to keep your analog signal paths as short as possible, yet away from the digital signal paths (ie: address bus). You should isolate the address bus from the analog signals with a ground plane between them, otherwise you will get a good bit of inductive and capacitive coupling between them.

If you attempt to add a filter to the input of the amplifier (or anywhere in the signal path for that matter), you will load the signal, and you will also wind up with additional propagation delay/phase shift.
 
Last edited:

Thread Starter

CrackJack

Joined Aug 7, 2009
127
Before you start adding filters, try increasing the time between when you change the address select lines, and when you perform your ADC.

Did you add resistors to the address select line output from the MCU, and caps to ground near the ends of the address bus like I suggested previously?
No, but I introduced a delay of 1ms after each select line selects an input port
[eta]
As I said before, you are working with an input that has a very high impedance, and low capacitance. It's going to be very easy for noise to be coupled to your inputs. That is why I suggested for you to put the opamps as buffers on the inputs to the 4051.

You may have a noisy ground bus. If you still have this circuit breadboarded, it's pretty certain that your ground is noisy. Once noise contaminates the analog signal, it will be very difficult to remove.
Yes, i did put in a buffer stage at the input of the mux... I can see the output signal on the oscilloscope, and soon I shall design a PCB layout as well... so, the amount of noise should reduce...

You need to keep your analog signal paths as short as possible, yet away from the digital signal paths (ie: address bus). You should isolate the address bus from the analog signals with a ground plane between them, otherwise you will get a good bit of inductive and capacitive coupling between them.

If you attempt to add a filter to the input of the amplifier (or anywhere in the signal path for that matter), you will load the signal, and you will also wind up with additional propagation delay/phase shift.
 

SgtWookie

Joined Jul 17, 2007
22,230
I don't know why I neglected to ask this before now, but do you have 0.1uF (100nF) bypass capacitors across the supply pins of each and every IC that you are using? If you do not, you will have big problems with noise.

I suggest that you use metalized poly film capacitors for the best noise suppression. When you design your board, include them not only at each IC, but place them all over the board between the power and ground planes. You are much better off to add them in the schematic and board and NOT need them, than discover later on that you do not have enough, and have to drill holes in order to fix the boards. If you don't have at least one capacitor per every 2 square inches (50mm) then you need to add more.
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
Hi SgtWookie,
I showed the circuit with buffer to my prof.. and he straight away declined the circuit saying that the added buffer will add to more power consumption of the design. Also, I would have 8 more chips in my circuit (since I have 32 inputs)
So, I have to deal with the problem again... He mentioned that I could play around with the input capacitor to the amplifier...
Probably having a capacitor in the feedback loop of the input stage and having unity gain stage with resistors of equal value in the feedback...

Do you think its a vital solution???
Also, are there any multiplexers which come with an in-built buffer stage? That would solve all the issues... :(
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
I don't know why I neglected to ask this before now, but do you have 0.1uF (100nF) bypass capacitors across the supply pins of each and every IC that you are using? If you do not, you will have big problems with noise.

Yes, I do have polarized film capacitors across each and every supply lines...
I suggest that you use metalized poly film capacitors for the best noise suppression. When you design your board, include them not only at each IC, but place them all over the board between the power and ground planes. You are much better off to add them in the schematic and board and NOT need them, than discover later on that you do not have enough, and have to drill holes in order to fix the boards. If you don't have at least one capacitor per every 2 square inches (50mm) then you need to add more.
Yes, I will take care of all the things that you have suggested me :) thanks ..
 

SgtWookie

Joined Jul 17, 2007
22,230
OK then; no input buffer amplifiers.

Instead of the input buffer amplifiers, try using 10nF caps on the input to the multiplexers, and minimizing capacitance from the output of the 4051's (signal path) to the input of the amplifier.

The 10nF caps seemed to work for you before when you had just one aluminum foil strip connected to it. Adding just a 10nF cap to each foil strip input of the 4051 will not change the power consumption, but will decrease the impedance of the foil strip inputs.

The idea is for the inputs of the 4051 to have far less impedance than the output of the 4051. It is very important to reduce the capacitance and inductance of the mux/demux signal path to the input of the amplifier as much as possible.
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
OK then; no input buffer amplifiers.

Instead of the input buffer amplifiers, try using 10nF caps on the input to the multiplexers, and minimizing capacitance from the output of the 4051's (signal path) to the input of the amplifier.

The 10nF caps seemed to work for you before when you had just one aluminum foil strip connected to it. Adding just a 10nF cap to each foil strip input of the 4051 will not change the power consumption, but will decrease the impedance of the foil strip inputs.

The idea is for the inputs of the 4051 to have far less impedance than the output of the 4051. It is very important to reduce the capacitance and inductance of the mux/demux signal path to the input of the amplifier as much as possible.
Ok... trying that now.. do you know any of the multiplexers that have input stage as buffer? because, i observed one more thing here, that the multiplexer itself loads the signal when it is in scan mode... so, i think that there is a limit as to how fast can address lines of multiplexers be switched.. here, even if i include a delay of 2ms before reading the signal, i see loading effect...

I found a good multiplexer which has a buffered input and buffered output.. AD8174... problem is they make only 4:1 mux and not 8:1 mux... :(
 

Thread Starter

CrackJack

Joined Aug 7, 2009
127
OK then; no input buffer amplifiers.

Instead of the input buffer amplifiers, try using 10nF caps on the input to the multiplexers, and minimizing capacitance from the output of the 4051's (signal path) to the input of the amplifier.

The 10nF caps seemed to work for you before when you had just one aluminum foil strip connected to it. Adding just a 10nF cap to each foil strip input of the 4051 will not change the power consumption, but will decrease the impedance of the foil strip inputs.

The idea is for the inputs of the 4051 to have far less impedance than the output of the 4051. It is very important to reduce the capacitance and inductance of the mux/demux signal path to the input of the amplifier as much as possible.
Hi, I did add the 10nF cap at the input to the multiplexer.. however, i observed a weird behavior of the circuit... the output without any inputs connected to it is raised to 2.5V ... I shall take some pictures of it and attach so that things might be clear...
 
Top