Author Topic: Switchable Voltage Divider  (Read 15391 times)

0 Members and 1 Guest are viewing this topic.

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Switchable Voltage Divider
« on: February 08, 2015, 06:14:13 pm »
For my next project, I want to measure voltages up to ~60V with a 12bit ADC, but to get reasonable resolution also for lower voltage values, I'd like to implement some kind of switchable voltage divider.
The µC I'm gonna use has built in voltage comparators with hysteresis and all, so the main challenge is to actually find a proper way to switch the divider.
The following two ways seem to be most promising:
1) Use separate ADC-channels in parallel, each with a specific voltage divider and switch on/off the patch from the divider to the ADC input.
2) Use multiple resistors in parallel in the lower side of the voltage divider and use switches to ground to activate one or more resistors.

Now for the 2nd approach I did some simulations with N-FET transistors (IRLML2502PBF) as lowside switches, but this doesn't seem feasible, as the leakage current of a few microampere influences the voltage divider too much for high resistance values.
And obviously I want to use resistors in the MOhm range to not influence the measurement too much.
I would suppose I could use analog switches, but I figure their resistance is temperature dependent.
The only other alternative that comes to mind would be (reed) relais, but they are rather expensive and slow. More or less the same is true for miniature solid state relays.

For the 1st approach, a P-FET could be used per range/channel. Problem is that at least for the low voltage ranges, even behind the voltage divider, the typical VDS of -20V for most small P-FETs is exceeded. There are -60V types, yet with higher RDSon. E.g. BSS83P: -60V, 2Ohm. With a divider in the MOhm range, I guess the 2Ohm should be ok.
Drawback is the use of multiple ADC inputs, but this is most probably not a problem.

[EDIT]
After some thinking about it, I found the p-FET approach isn't working out either. For low input voltages, VGS is too low to switch through, for high voltages it gets too high even for the 60V types...

This should be a common problem, but I didn't find really much information on standard solutions. I found only references to reed relays or analog switches, but without really talking about the drawbacks or naming an certain part. So any hint?
« Last Edit: February 08, 2015, 11:23:01 pm by 0xdeadbeef »
Trying is the first step towards failure - Homer J. Simpson
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #1 on: February 09, 2015, 07:46:21 pm »
To continue my monologue, it seems that analog switches are still my best choice. Until I find something better, I tried a simulation with a 74HC4066.
Looks kinda promising...
Trying is the first step towards failure - Homer J. Simpson
 

Offline JohnnyBerg

  • Frequent Contributor
  • **
  • Posts: 474
  • Country: de
Re: Switchable Voltage Divider
« Reply #2 on: February 09, 2015, 08:00:40 pm »
It look like you are building some kind of auto ranging. Why not have a look in some DMM's on how they tackle this problem?
 

Offline bugs

  • Contributor
  • Posts: 31
  • Country: 00
Re: Switchable Voltage Divider
« Reply #3 on: February 09, 2015, 08:18:19 pm »
You could try to use a programmable gain amplifier like the PGA112/PGA113. They are not that expensive, but maybe it does not have the precision you want.
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #4 on: February 09, 2015, 08:43:54 pm »
Well, letting aside that the 74HC4066 is not really 3.3V compatible, I guess the above circuit should work, shouldn't it?
I guess I can find a switch better suited for low voltage operation, e.g. TS3A4751 or MAX4751
Trying is the first step towards failure - Homer J. Simpson
 

Offline cosmicray

  • Frequent Contributor
  • **
  • Posts: 299
  • Country: us
Re: Switchable Voltage Divider
« Reply #5 on: February 09, 2015, 08:56:16 pm »
An I2C controlled potentiometer is effectively a remote controlled resistor ladder. You could use it to get a stepped voltage, albeit with only a small available current draw. Various devices offer steps of 64, 100, 128 and 256.

The only restriction there is that the top of the resistor ladder has a maximum voltage close to Vdd.
it's only funny until someone gets hurt, then it's hilarious - R. Rabbit
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #6 on: February 09, 2015, 09:33:33 pm »
Interesting devices for sure, but I don't think I can use them for this purpose. Firstly, they seem to come only in the 10k to 100k range. I'd prefer the MOhm range to not change the current too much.
Secondly, the idea is to protect the ADC from too high voltages for too long. With comparators I can switch the voltage divider fast enough to protect the ADC. With any ADC/software based approach, the time for switching ranges would dramatically increase which is not what I aim for.
Trying is the first step towards failure - Homer J. Simpson
 

Offline Mr.B

  • Supporter
  • ****
  • Posts: 1237
  • Country: nz
Re: Switchable Voltage Divider
« Reply #7 on: February 09, 2015, 09:40:54 pm »
This is what I did on my Homebrew DC Load.
Ranges are 2vdc, 20vdc, 200vdc (My load isn't rated to 200vdc, it was just a convenient range)

I approach the thinking of all of my posts using AI in the first instance. (Awkward Irregularity)
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #8 on: February 09, 2015, 10:45:17 pm »
As I said, I experimented with N-FETs as lowside switches as well, but found that the drain leakage current made it necessary to use relatively low values for the voltage dividers.
While the off state drain current of your FET seems to be lower than the one of mine, it seems you also chose 100k instead of 10M for the upper resistor to work around this.
The problem with this is that a relatively high current is flowing into the voltage divider which kinda influences the measurement more than I would like.
Besides, your approach seems to be SW controlled, so you need a low pass filter to not damage the ADC in case of voltage jumps. This is also something I try to avoid.
Trying is the first step towards failure - Homer J. Simpson
 

Offline Mr.B

  • Supporter
  • ****
  • Posts: 1237
  • Country: nz
Re: Switchable Voltage Divider
« Reply #9 on: February 09, 2015, 10:52:03 pm »
...it seems you also chose 100k instead of 10M for the upper resistor to work around this...
Yes, basically.
And in my particular case I am not too concerned about the ~1mA @ 100vdc.
I approach the thinking of all of my posts using AI in the first instance. (Awkward Irregularity)
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #10 on: February 09, 2015, 11:07:56 pm »
As a side note: when I look at the datasheet, it doesn't really look like the Si2366DS fully switches through at 3.3V. Indeed the lowest Vgs value with a specified RDSon seems to be 4.5V.
The 30mOhm seem somewhat optimistic as this is the typical value specified for 10V Vgs. Not that it would matter much, as RDSon is most probably still below 0.5Ohm, but to me this doesn't really look like an N-FET meant for 3.3V levels.
Trying is the first step towards failure - Homer J. Simpson
 

Offline Mr.B

  • Supporter
  • ****
  • Posts: 1237
  • Country: nz
Re: Switchable Voltage Divider
« Reply #11 on: February 09, 2015, 11:42:11 pm »
I hope I don't have a fundamental design fault there...
Still laying up the PCB.

My datasheet says Gate-Source Threshold Voltage - 1.2 to 2.5
Am I misreading the datasheet?
(But you are right about the RDSon)
Datasheet attached.
« Last Edit: February 09, 2015, 11:44:06 pm by Mr.B »
I approach the thinking of all of my posts using AI in the first instance. (Awkward Irregularity)
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: Switchable Voltage Divider
« Reply #12 on: February 10, 2015, 12:13:32 am »
You can also control the ADC vref by feeding it from a DAC.
This allows you to control the ADC full range value in code.
It can be useful to get full resolution at say 5v but also be able to measure 25v at full resolution.  You might use a 5/1 voltage divisor on the input so 5v input is 1v on adc and 25v input is 5v  etc.

First adc sample you do at 5v vref then reduce vref and resample.

A disadvantage is the extra time you have to wait when changing ADC vref for it to stabilize before sampling again.

If you really want to get fancy you can repeatedly scan the adc bit boundary and try to extract a few extra bits from the range. (Ive not actually tried but it might be fun)

Also you could try a pwm DAC for vref control but it would need some pretty heavy filtering to be usable

Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #13 on: February 10, 2015, 12:14:30 am »
@Mr.B
Well, the threshold voltage is not the point where the transistor is fully switched on but where it starts to conduct. Below saturation the FET behaves like a voltage controller resistor (linear region).
If I understand the datasheet correctly, ~4-5V is needed to reach a full on state.
So IMHO this is a 5V logic level FET, but not a 3.3V logic level FET.

@Psi
This is for sure an interesting approach, but it also seems a bit over-complicated. Honestly I don't think the trouble is worth it if I can use simple analog switches.
« Last Edit: February 10, 2015, 12:17:16 am by 0xdeadbeef »
Trying is the first step towards failure - Homer J. Simpson
 

Offline Mr.B

  • Supporter
  • ****
  • Posts: 1237
  • Country: nz
Re: Switchable Voltage Divider
« Reply #14 on: February 10, 2015, 12:47:23 am »
Thanks for the heads up 0xdeadbeef.

I am still laying up the PCB so I will try to find a more suitable FET.
I approach the thinking of all of my posts using AI in the first instance. (Awkward Irregularity)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Switchable Voltage Divider
« Reply #15 on: February 10, 2015, 10:09:32 am »
The leakage current will be more of a problem than the on resistance.

Use high resistance values and a low leakage MOSFET which is rated to a much higher voltage than necessary.

For example the BSS131 is rated to 240V and has a maximum leakage current of 10nA at the rated voltage and 25oC, at lower voltages it will be less. The on resistance is 14 Ohms but with high resistor values in the divider it won't be a problem.
http://www.farnell.com/datasheets/1680766.pdf
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #16 on: February 10, 2015, 11:15:02 am »
Problem is that the BSS131 also seems to be a 5V logic level type. So for 3.3V, it's not really fully on. Again, Rds_on is specified for 4.5V.
Trying is the first step towards failure - Homer J. Simpson
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Switchable Voltage Divider
« Reply #17 on: February 10, 2015, 11:44:41 am »
Problem is that the BSS131 also seems to be a 5V logic level type. So for 3.3V, it's not really fully on. Again, Rds_on is specified for 4.5V.
I doubt that would be a problem. Don't forget you're using this to switch just over 2uA so I really doubt the voltage drop would be a problem, even with a gate voltage of 3.3V.

Look at graph #5 on the datasheet. Note how when ID is near zero VDS varies very little between VGS = 2.3V and 10V

Graph #8 shows RON will be around 10Ohms when ID is near zero and VGS is 3.3V.
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: fi
    • Electronics blog about whatever I happen to build!
Re: Switchable Voltage Divider
« Reply #18 on: February 10, 2015, 12:26:54 pm »
Interesting devices for sure, but I don't think I can use them for this purpose. Firstly, they seem to come only in the 10k to 100k range. I'd prefer the MOhm range to not change the current too much.
Secondly, the idea is to protect the ADC from too high voltages for too long. With comparators I can switch the voltage divider fast enough to protect the ADC. With any ADC/software based approach, the time for switching ranges would dramatically increase which is not what I aim for.

Notice that ADCs usually require a fairly low source impedance (usually something like <10kohm) so you can't just feed them from some Mohm divider.
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #19 on: February 10, 2015, 03:57:51 pm »
Notice that ADCs usually require a fairly low source impedance (usually something like <10kohm) so you can't just feed them from some Mohm divider.
Well, worst case I'd need another OP as voltage follower.
Trying is the first step towards failure - Homer J. Simpson
 

Offline cosmicray

  • Frequent Contributor
  • **
  • Posts: 299
  • Country: us
Re: Switchable Voltage Divider
« Reply #20 on: February 10, 2015, 08:17:24 pm »
As a side note: when I look at the datasheet, it doesn't really look like the Si2366DS fully switches through at 3.3V. Indeed the lowest Vgs value with a specified RDSon seems to be 4.5V.
The 30mOhm seem somewhat optimistic as this is the typical value specified for 10V Vgs. Not that it would matter much, as RDSon is most probably still below 0.5Ohm, but to me this doesn't really look like an N-FET meant for 3.3V levels.
Take a look at BSD840N, it runs at the lower levels you seek, but the voltage range may not be sufficient. One implementation of a level shifter uses that part to translate between as low as 1.5V to as high as 18V.
it's only funny until someone gets hurt, then it's hilarious - R. Rabbit
 

Offline cosmicray

  • Frequent Contributor
  • **
  • Posts: 299
  • Country: us
Re: Switchable Voltage Divider
« Reply #21 on: February 10, 2015, 08:20:30 pm »
Interesting devices for sure, but I don't think I can use them for this purpose. Firstly, they seem to come only in the 10k to 100k range. I'd prefer the MOhm range to not change the current too much.
Secondly, the idea is to protect the ADC from too high voltages for too long. With comparators I can switch the voltage divider fast enough to protect the ADC. With any ADC/software based approach, the time for switching ranges would dramatically increase which is not what I aim for.

Notice that ADCs usually require a fairly low source impedance (usually something like <10kohm) so you can't just feed them from some Mohm divider.
The MCP4017/18/19 series are all available in 5K, and some pieces in 2.1k.
it's only funny until someone gets hurt, then it's hilarious - R. Rabbit
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #22 on: February 10, 2015, 10:54:16 pm »
Take a look at BSD840N, it runs at the lower levels you seek, but the voltage range may not be sufficient. One implementation of a level shifter uses that part to translate between as low as 1.5V to as high as 18V.
Hm, worst case 400Ohm @2.5V and a maximum of 100µA leakage current. While this is a 3.3V logic level FET, it's worse in any other possible parameter.

The MCP4017/18/19 series are all available in 5K, and some pieces in 2.1k.
Well, much too low values. I want a voltage divider in the MOhm range. And the comment was about this MOhm divider being a too high resistance for an analog input. Which might be true but (as stated before) can be easily overcome by adding a voltage follower.
Trying is the first step towards failure - Homer J. Simpson
 

Offline 0xdeadbeefTopic starter

  • Super Contributor
  • ***
  • Posts: 1570
  • Country: de
Re: Switchable Voltage Divider
« Reply #23 on: February 16, 2015, 12:41:26 am »
Ok, I found some time to rework my circuit a bit more.
The main change is that I use XOR gates to only switch one of the resistors. So no more odd values due to parallel resistors. Furthermore I replaced the 6V->3.3V conversion with a simple division by two and changed the comparator thresholds instead.
I also added voltage followers to make the divider (more or less) unloaded and to make the input to the ADC and comparators low ohmic.

There are still four ranges:
0-6.6V -> divide by 2
6.6V-13.2V -> divide by 4
13.2V-26.4V -> divide by 8
26.4V-52.8V -> divide by 16

Notes:
74HC4066 as analog switch is as dummy. I will most probably use a TS3A4751 instead.
I plan to use 74VHC86M as XOR gates. Didn't find any working spice model though. The XOR gates used in the circuit are ideal/simplified ones with 5V output.
Because of the fixed 5V output of the simplified XOR gates, I needed to use 5V as supply for the analog switches. In the real circuit, I'll most probably use 3.3V (even though I need 5V for the OPs).
The comparators are also dummies. I plan to use internal comparators of a LPC1549 instead where I can set the threshold from 0/31 to 31/31 of a reference voltage. A 1/10 voltage divider is not the ideal choice, so this is also just for this test circuit.
The XOR gate U10 is used only as inverter, simply because it's a 4 gate XOR and one gate is not used.
Trying is the first step towards failure - Homer J. Simpson
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Switchable Voltage Divider
« Reply #24 on: February 16, 2015, 08:56:59 am »
Why are you using 3V? It will make life harder.

Analogue switches don't work if the voltages are outside the supply rails.

HCT logic is compatible with 3V so you could use that to interface with the MCU.

Why are you so bothered about the on resistance?

The potential divider now has a total resistance of 12M at the maximum input voltage of 52.8V so the current is just  4.3583uA.

Even if the switch has a resistance of 400R, the voltage drop will be 1.743mV.

The leakage current is a much more important parameter, 1nA will cause a voltage drop of 3mV across a 3M resistor.

If the ADC is 12-bit, 1 count = 3/2^12 = 3/4096 = 732.421875uV

In order for the switch to drop under 1 count, its on resistance should be < 168R and the leakage current < 244pA.

Of course it may not need to be that good. It should be possible to calibrate the error out to some degree but it puts it into perspective.

EDIT:
I've just tested the old 2N7000 MOSFET. At room temperature the leakage current was difficult to measure, in the order of 500pA at a drain-source voltage of 51V. A higher voltage MOSFET such as the BSS131 will have an even lower leakage current.

What about using a BJT? I tested the BC548 and could only just measure the leakage current (50pA) when the voltage was increased to over 50V: the maximum rating is only 30V, a transistor rated to >50V would be better.

I didn't try to measure the transistor's saturation voltage at 5uA but it should be very low.

I can't be 100% certain of my readings because I don't have an ammeter that sensitive. I measured the current by connecting a Fluke 175 multimeter set to mV in series with the transistor. The meter has an input impedance of roughly 10M so 1mV of voltage drop corresponds to a current of 100pA. The resolution is 0.1mV which is a current of 10pA.

« Last Edit: February 16, 2015, 10:35:31 am by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf