Problems with using MUX

Thread Starter

NomadAU

Joined Jul 21, 2012
46
Hi all,

I am building a circuit to provide temperature measurements from a number (16 to be precise) sensors. The idea I have is to use an analog MUX to switch between the 16 sensors, and an MCU to control which sensor is being read. In fact, I am using 3 MUX's - 2 x single 8 channel, and 1 x triple 2 channel MUX, the latter switches between the two 8 channel MUX's each of which controls 8 of the 16 sensors.

Anyhow, enough about the overall design - the question is more basic and concerns the behavior of the 8 channel MUX.

What I was expecting was that the voltage applied at the 'input' pin would be passed through unchanged to the 'output' pin of the MUX, providing that the relevant control signals were present, and the 'input' pin was correctly selected. Instead, I am seeing a different voltage presented on the 'output'. I have put together a simpler circuit which demonstrates this, and is representative of the overall circuit. A hand-drawn sketch is provided.

Referring to the sketch, the salient aspects are as follows:
- power is supplied from an Arduino and is 5 volts
- a CMOS MUX (CD4051) is used to switch between the 8 channels...but in the test circuit, I have only connected channel 0.
- there is a simple voltage divider based on a 120Ω resistor and a thermister - the latter varies around 120Ω at room temperature and the output is connected to the MUX channel 0
- the controls (A,B,C) are all set LOW which should select channel 0
- I measure the voltage 'inside' the voltage divider, which changes according to temperature

Now, if I earth the circuit at point A (which is channel 0 on the MUX) I get a reading of 2.42V from the voltage divider. This is what I would expect, around half of the 5V. However, if I then move the earth to point B, which is the output channel of the MUX, then I get a much higher reading of 4.22V.

I thought that the MUX was meant to have almost zero resistance when measured across the connected channels, so why does the MUX appear to be adding a significant resistance to the circuit?
 

Attachments

crutschow

Joined Mar 14, 2008
34,459
Because of the finite ON resistance of the MUX which is plainly stated in the data sheet (as noted by GopherT's post) you can not pass significant current through the mux without it affecting the voltage. The way to use to mux with minimum error is to switch only the measuring point (junction of the resistor and the thermistor to ground) to the high impedance measurement circuit. For that to work, all the measurement circuits must be powered continuously.

Note that you don't need the 2-channel mux to switch between the two 8-channel muxes. You just tie the 8-channel mux outputs in parallel and use the INH (inhibit) input to select which mux is active.
 

WBahn

Joined Mar 31, 2012
30,071
In your diagram you aren't connecting Vee. This is a supply pin and, most likely, should be tied to your ground.

The ON resistance for this device, at least from one manufacturer (TI), is stated to be "low" at 125Ω. That, by itself, would lead to an expected voltage of 3.3V. I don't know what, if any, effect having Vee floating will have. It's possible you are fully able to turn on the NFET (assuming FETs are used) in the transmission gate, which would result in higher resistance.

To get the 4.22V you are seeing, you need an ON resistance of 530Ω. Hold onto your hat. With Vdd=5V, the typical ON resistance is 470Ω (with a max of 1050Ω). I think the behavior is pretty well accounted for.
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
Thanks all for the quick replies - that normally means I've missed something pretty obvious :)
I must admit I got the idea that CMOS devices presented little resistance from another document - and didn't study the MUX device specs closely enough (I've just rapped my own knuckes!).

So now that I can see why the circuit is behaving as it is, the next question is 'How to modify it to suit my purpose?'.

The suggestion to switch the measuring point thru the MUX is a good one, and I can see how that would work. The downside is that all 16 sensors would be powered simultaneously, requiring around 600mA....and that is going to be more than I can provide via my MCU. I could provide an alternative source of power, but just wondered if there were any other ideas out there on how to achieve the aim of the project....which is...

To measure the temperature at a series of points using a thermister at each point. Ideally, only one thermister at a time would be active.

Ideas?
 

crutschow

Joined Mar 14, 2008
34,459
...................................
I thought that the MUX was meant to have almost zero resistance when measured across the connected channels, so why does the MUX appear to be adding a significant resistance to the circuit?
To get a low impedance switch requires low ON-resistance transistors in the MUX. The CD4051 is one of the original CMOS devices (circa 1968) with large feature size transistors that have a relatively high ON resistance. There are some modern MUXes that go as low as 3 ohms of ON resistance typical such as the ADG708 8-channel or the ADG706 16-channel mux.
 

crutschow

Joined Mar 14, 2008
34,459
..........................

So now that I can see why the circuit is behaving as it is, the next question is 'How to modify it to suit my purpose?'.

The suggestion to switch the measuring point thru the MUX is a good one, and I can see how that would work. The downside is that all 16 sensors would be powered simultaneously, requiring around 600mA....and that is going to be more than I can provide via my MCU. I could provide an alternative source of power, but just wondered if there were any other ideas out there on how to achieve the aim of the project....which is...

To measure the temperature at a series of points using a thermister at each point. Ideally, only one thermister at a time would be active.

Ideas?
One way is to switch the power separately with a separate mux. You could use a low ON-resistance MOSFET at each thermistor circuit to turn it on with little effect on the measured voltage.

Another way is to use a constant current source, such as this, to power each sensor through the first multiplexer which replaces the series resistor at each sensor. A good current source will provide the desired current to the thermistor, largely independent of the mux resistance (within the voltage compliance range of the current source). --That may be the simplest way to go.--

Edit: Note that changing to a current source from a resistor source will change the output curve of voltage versus temperature. With a current-source the output is simply the constant-current times the thermistor resistance at temperature.
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
Thanks for the pointer Curmudgeon E. I didn't realise these devices were so old...almost as old as me!

The ADG708/706 MUX has a much better spec, and would be ideal for what I need, the only problem is that the ones I could find here in Oz are SMD...and I need the old chip and pins version. I found those at http://australia.rs-online.com.

Does anyone know of an alternative, low resistance MUX which is packaged as a standard chip (i.e. not an SMD)?
 

crutschow

Joined Mar 14, 2008
34,459
..................

Does anyone know of an alternative, low resistance MUX which is packaged as a standard chip (i.e. not an SMD)?
Don't know of any offhand. DIP packaging is seldom used with modern chips so you may be out of luck.

Have you considered my constant-current approach?
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
It looks like we were both posting at the same time Crutshow :)
I hadn't read your constant current post....will check it out.
Thanks.
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
Just had a quick read - this will take me a bit more time to digest and understand. But it looks like I now have the basis of a modified solution....
I'll post when I get it finalised.

Cheers to all!
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
Another way is to use a constant current source, such as this, to power each sensor through the first multiplexer which replaces the series resistor at each sensor. A good current source will provide the desired current to the thermistor, largely independent of the mux resistance (within the voltage compliance range of the current source). --That may be the simplest way to go.--
I need a bit more of an explanation here Crutschow if you'd be so kind?

I'm trying to figure out how the constant current idea helps here. Is this intended to be a way of restricting the amount of current flowing through the sensors? I did mention that the calculated 600mA was too much for my MCU to provide - if the current flow was reduced to an acceptable level (using a constant current provider circuit), then not only would my MCU be able to provide this, but the (high) resistance exhibited by the MUX would also be reduced. From what I have read, it seems that the ON resistance of the MUX I'm using varies (increases) as the amount of current flowing through it increases.
Am I on the right track here, or have I misunderstood your suggestion regarding the use of a constant current generator?

Thanks for your help.
 

WBahn

Joined Mar 31, 2012
30,071
The ON resistance varies inversely with the power supply associated with the control signals. With a higher voltage, you can effectively turn them on harder. It's not quite that simple, but the gist is there.

What you want to do (at least for one approach) is take a current source (that is good enough for you needs) and connect it to each of the sensors through a high side switch (and the MUX will work fine for that). Only turn on one switch at a time and you know that the current is going through that one sensor.
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
By the way, you are passing 60mA through a thermistor? Wouldn´t that cause significant self-heating?
Not quite.
The circuit I posted had a series resistor (120Ω) and the thermister (which varies around a similar value). With my 5V supply, I would expect around 20mA to pass through the thermister.

I don't know if that is significant (in terms of self-heating) but my concern was that if I had to power all 16 sensors simultaneously, that would place too much of a drain on my MCU. The calculation is the same as calculating resistors in parallel, and would be something like 240/16 = 15Ω. That would require around 330mA from my MCU...which it can't provide.
 

WBahn

Joined Mar 31, 2012
30,071
By the way, you are passing 60mA through a thermistor? Wouldn´t that cause significant self-heating?
I don't think he actually said it was a thermistor (and 120Ω is pretty low for a thermistor, I think), but the point is quite valid none-the-less. Since 60mA through 120Ω is 432mW, that is some pretty significant self-heating.

Also, earlier he was talking about there being 5V across the series connection of the sensor with another 120Ω resistor. That combination would result in a current flow of about 21mA (let's call it 20mA). This gets us down to about 50mW, which is much more likely to be tolerable. While it depends heavily on the thermal properties of the medium being sensed, I wouldn't be surprised if it should be down below 10mW or even 1mW to avoid unacceptable corruption of the measurement.
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
The ON resistance varies inversely with the power supply associated with the control signals. With a higher voltage, you can effectively turn them on harder. It's not quite that simple, but the gist is there.

What you want to do (at least for one approach) is take a current source (that is good enough for you needs) and connect it to each of the sensors through a high side switch (and the MUX will work fine for that). Only turn on one switch at a time and you know that the current is going through that one sensor.
Thanks for that WBahn.
So here's my very simple sketch based on what I think you are suggesting. We have a constant current source, this is connected to one of the 16 sensors via the MUX.
Question: Where do I take my voltage reading that I can use to measure the temperature of the active thermister?
 

Attachments

WBahn

Joined Mar 31, 2012
30,071
The obvious way it to use a second MUX with the top of each thermistor going to one of the inputs on one side and send the common'ed outputs on the other side to a high impedance measurement device (or buffer it with a voltage follower if necessary). This is what a couple of the prior responders were suggesting.

There may be a more elegant way to arrange things.
 

JMac3108

Joined Aug 16, 2010
348
With my 5V supply, I would expect around 20mA to pass through the thermister.
20mA is lot to pass through a thermistor.

A more typical way to handle a thermistor is to use low current to prevent self-heating, use a current source instead of a resistor, and add a resistor in parallel with the thermistor to linearize the output.
 

Thread Starter

NomadAU

Joined Jul 21, 2012
46
I've now built a simple constant current source (using op-amp and PNP). I've calibrated this to generate a constant 2.0mA. Continuing the experiment, I then connected this to a thermistor and measured the voltage at the thermistor input.

By varying the temperature from cool (using a bag of frozen peas) through to room temperature and them warm (using my hand), I got the following measurements.

Cool - 300mV
Normal - 220mV
Warm - 150mV

These reading show around 150mV of variation which would be ok for passing to my MCU as a voltage level (analogRead on Arduino).

However, when I then connect the thermistor to one of my MUX inputs and the MUX output to earth (so I now have the MUX channel in series), the readings change to the following.

Cool - 780mV
Normal - 760mV
Warm - 730mV

Clearly the additional ON resistance from the MUX causes the increase in voltage levels, however, what is also obvious from the figures is that the range of change is now much smaller....just 50mV. I'd prefer a wider range if there is some way of modifying my circuit to do this.

So it seems that my circuit is almost functional, but would be improved if I could get the output to present a wider range of voltages.

Any ideas?
 
Top