Author Topic: MCU controlled voltage divider input – is this correct?  (Read 9390 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
MCU controlled voltage divider input – is this correct?
« on: November 30, 2014, 07:22:42 pm »
Hi all,
I am wanting to measure voltage using an ADC and also wanting decade range control.
The circuit below is intended to be able to facilitate the following:
FET1 and FET2 on: 200vdc input yields 2vdc to the ADC.
FET1 off and FET2 on: 20vdc input yields 2vdc to the ADC.
Both FETs off: 2vdc input yields 2vdc to the ADC.

Maximum input voltage in the actual application will not exceed 120vdc.

Is this design correct or even sane?

Thanks in advance for your advice.


Where are we going, and why are we in a handbasket?
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: MCU controlled voltage divider input – is this correct?
« Reply #1 on: November 30, 2014, 07:59:30 pm »
Add another Zener facing GND for reverse polarity protection and, at the very least, add a precision Op-Amp set to unity gain at the input to the ADC. (You could also use a PGA instead so you can boost sub-2V signals up.)


Sent from my Tablet
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #2 on: November 30, 2014, 08:20:49 pm »
That zener diode there is a f-word design failure. Have you ever considered the reverse current through the diode and its voltage and temperature dependencies?
You cannot simply use a zener diode for clamping in high impedance circuit like this. It instantly kills the linearity and accuracy.

The only proper method is to use low leakage clamping diode PAIR between supply rails, OR to use a reverse biased  BE junction of a smallsignal NPN transistor. (It will open around 6-7 volts and also has almost negligible reverse current. Around 2 volts we might talk about <nA.)
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #3 on: November 30, 2014, 08:22:16 pm »
Thanks timb,

I don't quite follow "Add another Zener facing GND for reverse polarity protection".
Do you mean in series with the existing Zener?

I had inadvertently omitted the fact that I will be using a Texas Instruments OPA4188AID for unity gain before the ADC.
I don't have much need to boost sub 2v signals. The ADC is 12bit and will provide more than enough accuracy for the application.

Thanks,
Where are we going, and why are we in a handbasket?
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #4 on: November 30, 2014, 08:36:54 pm »
Thanks for your advice Yansi,
I was planning to use the ON Semiconductor MMSZ4680T1G as it has a maximum reverse leakage current of 4uA.

I will do some more research on the BE junction method as I don't quite understand the configuration.
The other issue may be that the ADC has a max input of VDD, which will be 5vdc.
Where are we going, and why are we in a handbasket?
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #5 on: November 30, 2014, 08:41:24 pm »
4 microamp current at 1kiloohm impedance circuit makes 4mV change. That equals error of almost 0,2%.  As MCP3204 is 12bit A/D converter, you get a nonlinear temperature dependent error of 8 LSBs. Man... that sucks like a bitch. It is also common design fail.

BE junction protection is only applicable IF the ADC input can withstand voltage of about 7V.  MCP3204 inputs can tolerate only voltage levels up to Vdd+0,6. It clearly tells you, that the input is CMOS with protection diodes. If you try to pass there more voltage that Vdd+0,6 through some resistance, it will clamp the voltage by its internal protection diodes. But the diodes are the last protection, you should make better protection before the ADC input. So obviously you cannot use BE protection. Usually by taking a doublediode package (like SOT23) with tw small signal diodes connected in SERIES (not common cathode) to make external clamp. Two diodes in series between Vdd and ground will mostly compensate for their leakage, because both diodes in the same package will have almost same leakages and V/T dependent characteristics.

Note: The BE protection is pretty simple, take a NPN like BC547C. Connect BASE to the ground, EMITTER to the voltage to be clamped and leave colletor floating.  If you have access to some better test and measuring equipment, you can proof yourself the leakages by measuring reverse VA characteristics of the fucking zener diode  and then tha reverse biased BE junction. The difference shoud be obvious.

Some time ago, I made a coarse measurement, just for simple comparison to be sure theory is the same as practice. Also note that the Y axis is logarithmic.
« Last Edit: November 30, 2014, 08:54:19 pm by Yansi »
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #6 on: November 30, 2014, 08:52:18 pm »
Man... that sucks like a bitch.

Yeah, got that...

As I said, I will research the BE junction method further.

Thanks,
Where are we going, and why are we in a handbasket?
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #7 on: November 30, 2014, 08:55:03 pm »
I just updated my message,  more info added.
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #8 on: November 30, 2014, 09:26:59 pm »
Like this?

Where are we going, and why are we in a handbasket?
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #9 on: November 30, 2014, 09:44:18 pm »
If the ADC is powered by 5 volts, than yes. 

C2 shoud be enough when only about single nanofarad to speedup ADC's sampling capacitor chargeup.

I think it would also be nice to split the wire between diodes and C2 and insert there small value resistance, maybe few hundreds ohms. This because now you have physicaly two diodes in parellel - one is D1 and second matching diode is inside the ADC. But the internal is/might be weak and you want most of the error curent to flow through the diodes you added externally. But it might do without that resistor aswell.

The doublediode doesn't have to be in SOT23 package, but usually it is hard to find suitable double diode in such package as TO92 (through hole). But it is easier to find some in surface mount, like SOT23 package.  It might also work well with two separate matched diodes like 1N4148, but  a doublediode device will have almost perfect match.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU controlled voltage divider input – is this correct?
« Reply #10 on: November 30, 2014, 09:49:48 pm »
Quote
Like this?

Whether you need those two diodes will depend on the voltage you think may be present before the 100K resistor.

The adc pin will likely have a couple clamp diodes. They are typically good up to 2ma. That means that it is ok to rely on those until the input gets to 2ma * 100k = 200v.

If you do expect more than 200v, you want to put in those two diodes, so that they clamp the input, rather than the clamp diodes in the adc. To do that, you need to insert a serial resistor between the two diodes and the C2. 1Kohm would be sufficient. That resistor ensures that the external diodes kick in before the internal ones.
================================
https://dannyelectronics.wordpress.com/
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: MCU controlled voltage divider input – is this correct?
« Reply #11 on: November 30, 2014, 09:58:34 pm »
If absolute precision isn't key, a Zener pair would work fine as the leakage can be calibrated in software. However, if you can afford the matched pair of signal diodes, it will offer better precision.


Sent from my Tablet
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #12 on: November 30, 2014, 10:25:09 pm »
Many thanks to all for all your help.

@Yansi
Yes, the ADC is powered from the 5 volt rail.
No problems inserting a couple of hundred ohms between C2 and the diodes. (dannyf is suggesting 1Kohms...)
I will find a suitable SOT23 device. All components in the design are SMD.

@dannyf
The application should not see more than 120vdc, however I guess it is better to be safe than sorry considering the cost of the ADC and the pain to replace it.

@timb
I will use a matched pair of signal diodes. The cost of that is not too much of a consideration.


Where are we going, and why are we in a handbasket?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU controlled voltage divider input – is this correct?
« Reply #13 on: November 30, 2014, 10:45:13 pm »
Those two external diodes offer NO additional protection over and above what the internal clamp diodes do, unless they kick in before the internal clamp diodes - the two sets of diodes are parallel to each other.

The internal diodes typically kick in at around 0.3v. So using a 1n4148 there does absolutely nothing for you.
================================
https://dannyelectronics.wordpress.com/
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #14 on: November 30, 2014, 11:23:38 pm »
As was said, resistor between them !

Or just forget that completely.  :palm:
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #15 on: December 01, 2014, 12:29:57 am »
The MCP3204 datasheet says the maximum input voltage is VDD + 0.6v.
Minimum is -0.6v
This would indicate that the internal clamping diodes are 0.6v.
If I was to use an external Schottky pair, namely BAT240A, the datasheet specifies Vforward as 0.325v @ 100v
This would be "mission accomplished" yes?
Datasheets below.


Where are we going, and why are we in a handbasket?
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
MCU controlled voltage divider input – is this correct?
« Reply #16 on: December 01, 2014, 12:45:17 am »
NM, won't work with your setup. Ignore!
« Last Edit: December 01, 2014, 12:47:09 am by timb »
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #17 on: December 01, 2014, 12:52:13 am »
Mr.B: That Vdd+0,6V does not say anything about where the internal clamp begins conducting some (serious) current. 0,6V is absolute maximum voltage across the clamp, at unspecified current which might damage the device, if over 0,6V + over Vdd (or 0,6V less than gnd).

I wouldn't recommend schottky clamp, because schottky diodes are notorious for bigger leakage than Si diodes. (But I am not sure about this when using small signal schottky).

So that is the reason, why to use external Si clamping and the separation resistance beteen ext and int clamping diodes. If the internal ones starts to open at 0,3V (as dannyf said), the external Si will fully open at around 0,7 (heavy current clamping). This is 0,4V difference voltage and if you want to let only (randomly selected number) 2mA to pass through int clamp, the required series separation resistor will be around 200 ohms. (or more). The resistance calculation is only very informative, but I think will be enough accurate to make the stuff bombproof.

timb, what is NM and what will not work? Did I miss something?
« Last Edit: December 01, 2014, 12:54:06 am by Yansi »
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #18 on: December 01, 2014, 01:07:03 am »
Thanks Yansi,

I will go back to the BAS31.
Leakage @ 100nA
The Schottky was 1uA
Where are we going, and why are we in a handbasket?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU controlled voltage divider input – is this correct?
« Reply #19 on: December 01, 2014, 01:11:19 am »
Quote
namely BAT240A

BAT54S is often used - it has two diodes in serial so easy to work into the circuit. Designed primarily for clamping.
================================
https://dannyelectronics.wordpress.com/
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: MCU controlled voltage divider input – is this correct?
« Reply #20 on: December 01, 2014, 01:20:10 am »
maybe just one another thing we overlooked - the mosfets. I've tried to look for thir leakage, and didn't see taht in the datasheet. Well.. these wweren't obviously meant for signal switching.

The leakage will never be (close to) zero, but you must at least know the range where it could exist (if nanoamps or microamps, ...), calculate the worst case effect on your circuit and then decide if the device is usable.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: MCU controlled voltage divider input – is this correct?
« Reply #21 on: December 01, 2014, 01:22:11 am »
Somewhat offtopic: do you truly need such accurate resistors? The signal is going to a microcontroller - a computer, you can do math in it, and adjust the value to the correct level. You just need them reasonably accurate to avoid going outside the ADC range (or too far inside).
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline Mr.BTopic starter

  • Supporter
  • ****
  • Posts: 1263
  • Country: nz
Re: MCU controlled voltage divider input – is this correct?
« Reply #22 on: December 01, 2014, 01:43:54 am »
@dannyf
They have a peak reverse voltage of 30v.  (very good Vforward charastics though).
If the input voltage suddenly swings to 100v my MCU is going to take a little bit of time to react and switch in the voltage divider resistors.
Will this not fry the diode between signal and GND?

@Yansi
I had designed in the Si2366DS simply because I have half a reel in stock.
I will track down a more suitable FET.
Thanks.

@c4757p
You are right. The tolerance is probably overkill.
I will probably just use 1% as they are quite a bit cheaper than 0.05%
« Last Edit: December 01, 2014, 01:47:46 am by Mr.B »
Where are we going, and why are we in a handbasket?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf