PDA

View Full Version : Driving a Voltage Regulator with PWM



flotulopex
- 26th June 2007, 21:36
Hello,

Does anyone have a very simple example on how to drive (adjust) a Voltage Regulator with PWM?

I have a +5V LM340 VR and don't know how to connect it to make it Current driven.

This is what I built (simplified here) and this won't work for sure.
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1793&stc=1&d=1182890099">

How do I do this a correct way?

BrianT
- 27th June 2007, 00:12
I assume the PIC pin joining the 12F683 to the junction of the 10k, 2k2 and 100nF is the PWM out of the PIC.

What you need from the PIC HPWM is a series resistor - say 1K, then a large cap to ground, say 100 uF. This time constant is 100 mSecs so the HPWM frequency should be at least 1 kHz. The junction of the 1k/100uF then goes to the ground pin on the regulator.

HTH
Brian

flotulopex
- 27th June 2007, 07:15
Thanks BrianT,

Yes, I use the CCP1 pin for HWPM.

So, it would look like this:
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1803&stc=1&d=1182923648">
Brian, may I kindly ask to you to explain the time constant calculation and relation to the PWM frequency? This is not clear to me as I do this usually on the "thumb" (= au pifomètre).

In fact, I made this circuit already (had a 47u cap) and could not vary the output voltage very well. But I thought this was because I adjusted the VR in "voltage" instead of "current" mode.

The voltage would change only from around 120 to 240 dutycycle (CPP1RL) and I would read between 3V and 4V.

I also corrected the output voltage on the schema...

sayzer
- 27th June 2007, 07:28
1. Why not using a digital POT?

2. Also, in the schema above, there should be a resistor parallel to C1 cap.



--------------------------------

flotulopex
- 27th June 2007, 08:47
Hi Sayzer,

To me, HPWM looks simple. But, as you say, why not another way?

Never used a Digital pot before. What "resolution" (roughtly voltage step) will I get?

Any suggestion of values I should use in this case and what the schema would then look like?

If I stick to the HPWM, what value should I use for the resistor to be put parallel to the cap?

Thank you in advance

Ioannis
- 27th June 2007, 09:30
I think that the PIC is in danger by that connection. If your supply is 12V and the output around 2, the rest 10 volts should be between regulators ground pin and ground. So the output of the PIC is at high voltage point through the resistor.

What exactly are the specs? What do you want to produce at the output?

My suggestion could be something like this:

1. PIC HPWM to a filter.

2. Filter to an Opamp for DC voltage amplifying.

3. Power output Transistor to give the appropriate current to the load.

You can produce a 0-12 output that way.

If you want controlled Current source then the Pass transistor could be at the feed back loop of the opamp. I'll try to scetch and scan if needed.

Ioannis

flotulopex
- 27th June 2007, 10:32
Hi Ioannis,

I am making a lead-batteries charger.

In my opinion, it is not necessary to control the full voltage range of the batteries that need to be charged.

Important is to control the charging voltage (2,35V/element), the floating voltage (2,26V/element) and, of course, the timing (n hours for charging -depending on battery capacity- and then go to "float" or "trickle" mode).

So, if you have i.e. a 12V lead-battery (= 6 elements), the charging voltage will be 6x2,35V=14,1V and the floating voltage will be 6x2,26V=13,56V.

Roughtly, the voltage range to control is quite narrow: less than 1 volt. Thus. this should avoid the use of an OP-Amp. The current is limited by the transformer's capacity.

So this is what I would like to achieve now. It could look like this:
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1806&stc=1&d=1182936471">

Ioannis
- 27th June 2007, 11:07
On the schematic you have to power with more that 15Volts. 2950-5 needs at least 0.45 volts at the input above from 5V. If your battery is discharged and request more current, the transformer might drop the voltage bellow 15V.

The circuit is quite economical but I am afraid that is quite a compromise too.

I have attached my idea in a hand schetch (sorry, no CAD here!).

Ioannis

flotulopex
- 27th June 2007, 13:14
CAD is not necessary - your drawing is well done ;)

You're right, the Zener is going to be an 8,7V since I don't have another under my hand...

Maybe I'll go for your solution.

Have to make some trials.

Thanks a lot.