Buffer for DC voltage

Started by kurtlives, March 12, 2014, 04:04:08 PM

Previous topic - Next topic

kurtlives

I have a DC source that puts out 20V max
I have an Ardunio micro controller that needs to read this source voltage. The Ardunio can only handle 5V input max though.

I am going to put a 1/4 voltage divider between the two so even when the source maxes out at 20V the Ardunio will only see 5V. 25K in series, 100K to ground.

Not that 100K to ground is going to be in parallel with the Ardunio's input impedance. Can I use a simple op-amp buffer with no in/out caps and a bipolar supply and be fine or am I missing something?
My DIY site:
www.pdfelectronics.com

kingswayguitar

not sure overall, but your ratio is a bit off anyway.
25/125=1/5

GGBB

#2
^+1 and inverted.

Can't answer your question either, but 20V IN -> 25K ->100K -> ground will give you 16V at the 25K-100K junction.  Close to 5V would be 100K-33K.
  • SUPPORTER

ashcat_lt

The buffer only needs bipolar supply if the DC source is "bipolar" in that it will at some point be sending a negative voltage.  Or, I suppose, if you need it to go all the way to 0V, and don't want to use an opamp that can actually swing to the negative rail.  An opamp buffer on a bipolar supply doesn't really need coupling caps except if the source or load will be running a DC offset that you don't want messing with the opamp.  Either way, it'll work fine.

Edit, was ninja'd by two other folks, so this part is redundant:
What's the impedance of the controller?  25K over 100K by itself is 4/5.  You want the bigger resistor as the series R, and you need different values so that it comes out 1/4.  100K/33K works, or 75K/25K.  Though, if the microcontroller input-Z is less than about 300K you'll have to actually work it into the calculations.

kurtlives

Opps! Yes I meant the other way around for the resistors. Good catch

So ashcat_lt you are saying I can use a standard uni-polar supply and bias the op-amp to half of Vcc and be fine? That would put 4.5V on both the input and output of my buffer. I want to read the voltage source voltage on both the input and output of the buffer (of course with different impedances).
My DIY site:
www.pdfelectronics.com

PRR

What is the Arundo's input impedance?

I suspect the ADC mode input is darn near infinite.

Where did you get 100K? Can your 20V source support more loading?

If you manage to compute the perfect 1:0.250000 divider, put in 20.0000V, but the Arundo's power is 4.95V, will it work right? Or if the 5V is 5.000V but the "20V" is 22V?

Generally if you want to measure something, you pick a ruler significantly longer than you need. Pressure gauges usually 2X (200psi gauge for 100psi air). I'd ask what happens if you divide the 20V to 2.5V. You lose resolution, but the Arundo surely has 128 levels and maybe 256. You can get 1.5% resolution which is often close-enough for government work.
  • SUPPORTER

ashcat_lt

#6
Quote from: kurtlives on March 12, 2014, 04:40:25 PMSo ashcat_lt you are saying I can use a standard uni-polar supply and bias the op-amp to half of Vcc and be fine? That would put 4.5V on both the input and output of my buffer. I want to read the voltage source voltage on both the input and output of the buffer (of course with different impedances).

Then don't bias it!  I think you answered your own question in a way.  The DC voltage at the input will equal the DC voltage at the output assuming that it is somewhere within the range of the opamp's power supply.  So, a 9V unipolar supply will allow you to reproduce any input voltage between 0 and 9V...

...Except that many of our "usual suspects" won't actually go all the way to their power supply rails.  A TL07x type will get to within about a diode drop of either rail - so will go from about 0.6V to 8.4V or so.  So, you'll never get 0V out no matter what you put in.  Other opamps will swing closer.  Some are called "rail to rail" and designed to go all the way to the rails.  Some - like the LM324 - will go all the way to the negative rail, but not all the way to the positive.  If you really need it to go all the way to 0V, and can't or won't use an opamp that actually swings to the negative rail, then you need to set the negative rail somewhere below 0V.  And, of course, if you want it to pass negative voltages...

Edit - Or, I suppose, you could bias up (to some voltage that won't put the highest input over the top rail!  4.5V is too much), add the control voltage, buffer, and then read the output as referenced against the bias voltage, but that's more messing around than it's probably worth. 

knutolai

wouldn't it be so much easier and and more reliable using a 5 volt regulator like the 7805/78L05?

kurtlives

Quote from: ashcat_lt on March 12, 2014, 05:21:37 PM
Quote from: kurtlives on March 12, 2014, 04:40:25 PMSo ashcat_lt you are saying I can use a standard uni-polar supply and bias the op-amp to half of Vcc and be fine? That would put 4.5V on both the input and output of my buffer. I want to read the voltage source voltage on both the input and output of the buffer (of course with different impedances).

Then don't bias it!  I think you answered your own question in a way.  The DC voltage at the input will equal the DC voltage at the output assuming that it is somewhere within the range of the opamp's power supply.  So, a 9V unipolar supply will allow you to reproduce any input voltage between 0 and 9V...

...Except that many of our "usual suspects" won't actually go all the way to their power supply rails.  A TL07x type will get to within about a diode drop of either rail - so will go from about 0.6V to 8.4V or so.  So, you'll never get 0V out no matter what you put in.  Other opamps will swing closer.  Some are called "rail to rail" and designed to go all the way to the rails.  Some - like the LM324 - will go all the way to the negative rail, but not all the way to the positive.  If you really need it to go all the way to 0V, and can't or won't use an opamp that actually swings to the negative rail, then you need to set the negative rail somewhere below 0V.  And, of course, if you want it to pass negative voltages...

Edit - Or, I suppose, you could bias up (to some voltage that won't put the highest input over the top rail!  4.5V is too much), add the control voltage, buffer, and then read the output as referenced against the bias voltage, but that's more messing around than it's probably worth. 
Well that works well.
I used a 100K/33K divider and got ~0.25 the input voltage. Just tried it with a TL062 and it worked quite nicely. My source (which is a renewable energy) is suspectible producing a low output so a rail-to-rail op-amp wouldn't be a bad idea in order to preserve accuracy.



PRR I chose those resistor values a bit at random. I figured since I would be using a dual op-amp I'd buffer before and after the voltage divider. The Ardunio has a section in the code that multiples the analog input value by the reciprocal of the voltage divider. So if voltage divider is a 1/4 the code multiples by 4 to get the original source value. I probably should increase those resistors though.....
My DIY site:
www.pdfelectronics.com

mth5044

Quote from: knutolai on March 12, 2014, 05:59:46 PM
wouldn't it be so much easier and and more reliable using a 5 volt regulator like the 7805/78L05?

+1

kurtlives

The voltage needs to be variable up to 5V.

I don't want to hold the voltage at 5V.

The source has a max output of 20V but it's nominal value is below that.
My DIY site:
www.pdfelectronics.com

ashcat_lt

Quote from: mth5044 on March 12, 2014, 07:28:46 PM
Quote from: knutolai on March 12, 2014, 05:59:46 PM
wouldn't it be so much easier and and more reliable using a 5 volt regulator like the 7805/78L05?

+1
Tell us how that helps?  He has a control voltage which could be anywhere from 0 to 20V.  He wants to drives that down to something proportionate to 5V max so that he can control something.  So, you want him to clamp the original big voltage to exactly 20V (as long as it starts out high enough...).  :/

I think that PRR was trying to point out that if the microcontroller has high enough in-Z, it shouldn't really need a buffer because the little bit of current getting through the big divider Rs should be plenty.  Buffering doesn't hurt any, though.

ashcat_lt

Btw - now that you've got it to the "okay it works" stage, I encourage you to go back and read what PRR said about possibly protecting that chip from over voltages.  It is quite possible that it will permanently cease functioning if hit with much more than exactly 5V input.

kurtlives

Quote from: ashcat_lt on March 12, 2014, 08:15:23 PM
Btw - now that you've got it to the "okay it works" stage, I encourage you to go back and read what PRR said about possibly protecting that chip from over voltages.  It is quite possible that it will permanently cease functioning if hit with much more than exactly 5V input.
Thanks for the input

You're right I probably don't need the buffers (from my research of the Ardunio) but I want to prevent any possible loading. The  Ardunio is getting fed by 4 renewable energy sources (solar, thermal, piezo and wind energy). These are all fairly low voltage, low current sources so I'm certain I won't be getting more than 20V from a single source. The buffers prevent too much current loss, when there isn't much current to start.

I guess I could put a zener right after each source to ensure it can't go past a certain voltage.
My DIY site:
www.pdfelectronics.com

PRR

The buffers also eat power in a power-poor system.

And they probably eat power 24/7, when the generator voltages change only slowly, and a 1/minute or 1/second sampling might be ample.

There is also K.I.S.S.

The Arduino{sp} has a 10-bit ADC. 1024 slices. 5mV per slice using the 5V rail as reference; there is an internal lower reference which seems to offer 1mV steps. I can not imagine needing to know your sun or wind panel to even a tenth-Volt. A 100:1 divider has just-enough resolution. A 4:1 divider risks over-voltage. Split the difference. 20:1? 10:1? I like round numbers so 10:1 is my pick. But if you can wrestle the little brain into doing math for you, 23:1 (220K+10K) is as good as any. 
  • SUPPORTER

mth5044

Quote from: ashcat_lt on March 12, 2014, 07:56:27 PM
Quote from: mth5044 on March 12, 2014, 07:28:46 PM
Quote from: knutolai on March 12, 2014, 05:59:46 PM
wouldn't it be so much easier and and more reliable using a 5 volt regulator like the 7805/78L05?

+1
Tell us how that helps?  He has a control voltage which could be anywhere from 0 to 20V.  He wants to drives that down to something proportionate to 5V max so that he can control something.  So, you want him to clamp the original big voltage to exactly 20V (as long as it starts out high enough...).  :/

I wasn't clear (to me, at least) in the OP that the variable voltage was to be scaled from 0-20V to 0-5V. I read it as applying a constant max 5V source to a pin on the ucontroller.

kurtlives

So I got some LM324....

The buffer output seems very much dependent on my op-amp supply voltage. I was using a 8.22V battery as my "renewable" source so I was expect 2.04V at the buffer output ([33k/(100k+33k)]*8.22V)

I set my bench top PSU to around 12V to power the op-amps. I figured as long as there was enough "headroom" for the op-amps I would be fine. Not the case... Seems that I can vary the buffer output voltage by varying the op-amp supply voltage.

I don't remember this happening with the TL062. What am I missing??
My DIY site:
www.pdfelectronics.com

PRR

> I can vary the buffer output voltage by varying the op-amp supply voltage.

That's just wrong. Show what you did.

  • SUPPORTER