CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Buck boost regulator
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MAKInnovation



Joined: 16 Nov 2010
Posts: 61

View user's profile Send private message

Buck boost regulator
PostPosted: Fri Jul 29, 2011 6:03 am     Reply with quote

Buck boost regulator generate negative output voltage.
How could I interface it with my adc to control my pwm signal?

Suggest me with appropriate circuit and sample program.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jul 29, 2011 7:30 am     Reply with quote

You don't say the range of the negative output, but a simple opamp circuit to invert the signal will work. Depending on the range you'll have to set the gain to give a 0-5 volt signal to the PIC.
Simple, basic 'opamp101' stuff.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Buck-Boost Regulator
PostPosted: Sat Jul 30, 2011 4:59 am     Reply with quote

You don't say, but I'm assuming, that you're using the PWM signal to drive the buck-boost regulator and thereby achieve some form of closed loop control.

You could simply use a pot. divider with one end connected to the negative voltage, the other to the positve rail, and the tap to your analogue input. Or you could offset the negative voltage with a zener. Either way you need to be careful not to drive the analogue input beyond the PIC's supply rails.

If you go down the OPAmp route it would be easier to use a device with rail to rail output. That way you can use the PIC's supply as the power rail for your OPAmp, with no danger of the OPAmp output going beyond the PIC's supply rails. Most common OPAmps do not produce output close to the supply rails. In order to get a rail to rail signal for your analogue input you may need to have a power supply for your OPAmp which exceeds the supply for your PIC.

Mike Walne
MAKInnovation



Joined: 16 Nov 2010
Posts: 61

View user's profile Send private message

PostPosted: Sat Jul 30, 2011 10:17 am     Reply with quote

range of the negative output is -18 volts
and the input voltage would be 12.

Yes the buck boost will be control with PWM signal

Now can you please draw the opamp circuit for -18V?

Would opamp circuit at output (-18V) for voltage sensing, affect the load parameters (i.e. load current or voltage)?
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jul 30, 2011 10:46 am     Reply with quote

This really isn't an analog design board, rather CCS C compiler but...
sounds like you need to input -18 to 0 volts into the ADC and output 0 to +12 to control the regulator circuit.
There are prpbably 10,000 + sites that will show you how to create the 2 simple circuits you need.
The 'input' circuit take -18 to 0 volts and inverts then reduces to 0 to 5 for the ADC section of the PIC. A simple divider of 3.6 then invert should work.
The 'output' section takes 0 to +5 PWM output and amplifies it to 0 to +12.
A simple opamp with a gain of 2.4( 12/5) should work.

This is basic 'opamp101' stuff, google 'Forrest Mims Opamp collection' or look for Natioanl Semiconductor's Op Amp pages or Microchip analog tech stuff.

If you use a voltage divider or the -18 input first, you can use regular rail to rail opamps at +-12VDC and not special 'high voltage' versions($$$).
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Jul 30, 2011 7:54 pm     Reply with quote

temtronic wrote:

This is basic 'opamp101' stuff, google 'Forrest Mims Opamp collection' or look for Natioanl Semiconductor's Op Amp pages or Microchip analog tech stuff.



I have the "IC Op-Amp CookBook" - it's kind of nice too.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
MAKInnovation



Joined: 16 Nov 2010
Posts: 61

View user's profile Send private message

PostPosted: Mon Aug 01, 2011 1:37 am     Reply with quote

Thanks every one
Inverting amplifier will do the job for me.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

analogue circuits
PostPosted: Mon Aug 01, 2011 4:19 pm     Reply with quote

So you've got a +12 rail, 0V to -18V output from the buck boost, and presumably a 12V to 5V regulator.

You then convert from the variable -18V to +5V with an inverting OPAmp, and drive the PWM with a level shifter (NOT another OPAmp).

Since you already have a +12 supply you can use a lower cost OPAmp. A device such as a CA3140 has input and output capability down to its negative rail. You connect as follows:-

Input resistor (say 36k) from variable -18V to OPAmp inverting input.
Feedback resistor (say 10k) from OPAmp inverting input to OPAmp output.
OPAmp non-inverting input and negative supply to 0V.
OPAmp positive supply to +12V.

You may need to protect the PIC analogue input from excess OPAmp output voltage.

Since the buck boost output is bound to have some ripple on it you may need to slightly filter it. This can be done with a capacitor in parallel with the 10k resistor. The value depends on the level of performance you're after. Too small and ripple gets into your control loop, too large and you get loop stability issues.

I'm assuming the switch for your buck boost is in the +12V supply lead.

You then level shift the PWM output from +5V to the +12V supply.

There are 1001 level shifters you could use. Again it depends on what you can afford and the performance needed.

The output from the buck boost behaves in two different ways as the load changes. The output is not usually affected by the light loading of your OPAmp input circuit. At light loading the output voltage is dependent on both the load and the PWM duty ratio. At heavier loading the output voltage is controlled by the PWM duty ratio only, (it's essentially independant of the loading). This transition occurs when the current in your buck boost choke changes from being continuous to discontinuous. You may then have to control the loop in one or both modes.

Mike Walne
MAKInnovation



Joined: 16 Nov 2010
Posts: 61

View user's profile Send private message

PostPosted: Mon Aug 01, 2011 11:33 pm     Reply with quote

Thanks Mike;

I am using 18f452 pic microcontroller.

I am able to generate PWM output signal for buck boost regulator without any feedback.

Now I have two input signals from buck boost regulator.

One: output load voltage which is sensing at AN0
Second: output current which is sensing at AN1

What will I need to do is to implement PID algo in my programming.

How could I do it in simple way ?

Thanks every one again, who have replied me.
Waiting for quick and productive response.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Buck boost regulator closed loop control
PostPosted: Wed Aug 03, 2011 4:44 pm     Reply with quote

To be certain that we have not got crossed wires. I mentioned feedback in relation to the voltage measuring circuit ONLY. The PWM to the switching device drive has no feedback, its an open loop voltage level shifter. The PIC PWM output is digital, either 0 or 5V. When the PWM output is 0V the buck boost switch can be either ON or OFF, the switch toggles to the other state when PWM output is 5V. The buck boost switch can be either polarity bipolar transistor or MOSFET.

More Questions:-

1. Are you wanting a fixed or variable output?
2. Is -18V the maximum regulated output or transient peak?
3. How are you measuring output current?
4. Why are you measuring output current?

Which parameter(s) is/are most important:-

1. Resolution.
2. Regulation.
3. Transient response.
4. Output ripple.
5. Component size.
6. Efficiency.
7. Switching frequency.
8. Current limit.
9. Freedom from overshoot / undershoot?

You can't have everything, it's a compromise.

If you look at conventional switch mode systems you will see that there are several ways to achieve closed loop control. Look at Unitrode, now Texas, Micro-Semi, Fairchild, ST etc.

The control methods include:-

1. Voltage mode.
2. Peak current mode.
3. Average current mode.
4. Hysteric.

Each method has advantages and drawbacks. With digital control you can emulate one of the above, with the benefit of being able to change time constants etc. on the fly to suit changing conditions, or even create new forms of control. The only exception is that peak current mode control would be rather difficult with a PIC.

Mike Walne
MAKInnovation



Joined: 16 Nov 2010
Posts: 61

View user's profile Send private message

PostPosted: Fri Aug 05, 2011 1:30 am     Reply with quote

Thanks Mike
& really sorry for the late reply.

I have uploaded my schematic at the below link.

http://www.4shared.com/photo/aiLLCAwC/FP_online.html?

This schematic will answer many of your questions.

PWM output will be at CCP2.
There would be three inputs.
1- voltage sense at PIN2 RA0
2- current sense at PIN3 RA1
3- and a 0-5 variable voltage at PIN4 RA2

* output may vary as per variation in potentiometer reading at PIN4 RA2.
* Current and voltage measurement circuit are in my schematic.

Other details of projects are:

* Input Voltage = 12V
* Swicthing frequency = 25kHz.
* Average Output Voltage = Va = -18V
* load is 1.2R

I just want to regulate output voltage with precision using PID control.
Other parameters are not so important.
Kindly revise my schematic and suggest me with simple PID control code compatible with my schematic.


Ashraf
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Power Stage
PostPosted: Fri Aug 05, 2011 3:30 am     Reply with quote

There are numerous errors on your schematic and you have not answered some important questions.

Your schematic.

You're quoting load as 1R2.
18V / 1R2 = 15A.
Total output power 15A * 18V = 270W.

Assuming 100% efficiency.
Input current = 270W / 12V = 22A5.

You are entering the world of power electronics.

Your power circuit will probably not survive the stress.
I don't recognise your Q3, but it will need to be on a BIG heatsink.
Your drive circuit to Q3 is totally inadequate for the power level you envisage.
You are showing an N-channel part for Q3.
You are not going to be turning Q3 on and off properly.

C3 is the wrong way up.

Selection of D3 is not trivial. You need a fast diode.

You are going to generate loads of RFI.

Q1 will put a near short circuit on CCP2 as soon as it starts to PWM.

I suspect your voltage amplifier gain is too small.
I can't clearly read the values R9, R10 on the schematic.
Most 741's don't work well down to the negative power rail.
Half of a 358 or similar may be OK.

Your current sense amplifier won't work.
Your current sense resistor is in the wrong place and the wrong value.
15A passing through 0R2 gives 3V0.
You are intending to amplify by 10 to 30V.
YOur sense resistor dissipates 3V0 * 15A = 45W.

Before you even think about building this project you need to sort out the power stage.

Use a square wave signal generator to drive your proposed power stage open loop.
If you don't have a generator use your potentiometer input to control the PWM output on a PIC.
Don't worry about current or voltage sense.
Keep it as simple as possible.
Just work on the power bits only and see what happens as you vary your PWM duty ratio and loading.
Watch what is going on with an oscilloscope.


Mike Walne
MAKInnovation



Joined: 16 Nov 2010
Posts: 61

View user's profile Send private message

PostPosted: Fri Aug 05, 2011 4:40 am     Reply with quote

There are numerous errors on your schematic and you have not answered some important questions.

Your schematic.

You're quoting load as 1R2.
18V / 1R2 = 15A.
Total output power 15A * 18V = 270W.

Assuming 100% efficiency.
Input current = 270W / 12V = 22A5.


Change 1R2 to 12R resistor
it will change values to
18V/12R = 1.5A
Total output power 1.5A * 18V = 27W.

Assuming 100% efficiency.
Input current = 27W / 12V = 2A25.



You are entering the world of power electronics.

Your power circuit will probably not survive the stress.
I don't recognise your Q3, but it will need to be on a BIG heatsink.
Your drive circuit to Q3 is totally inadequate for the power level you envisage.
You are showing an N-channel part for Q3.
You are not going to be turning Q3 on and off properly.



The value of Q3 is 75N75

C3 is the wrong way up.

I will correct it

Selection of D3 is not trivial. You need a fast diode.

There is no D3 in schematic

You are going to generate loads of RFI.

Q1 will put a near short circuit on CCP2 as soon as it starts to PWM.

Correct this portion of circuit with the right method

I suspect your voltage amplifier gain is too small.
I can't clearly read the values R9, R10 on the schematic.
Most 741's don't work well down to the negative power rail.
Half of a 358 or similar may be OK.

The value of R9 is 10K
and the Value of R10 is 36K


Your current sense amplifier won't work.
Your current sense resistor is in the wrong place and the wrong value.
15A passing through 0R2 gives 3V0.
You are intending to amplify by 10 to 30V.
YOur sense resistor dissipates 3V0 * 15A = 45W.

With 12R output load the value of ampere drop to 1.5A
0.3 volt would be the output and it will be amplify to 3 to 5volt easily
it will dessipate the power of 0.45W


Before you even think about building this project you need to sort out the power stage.

Use a square wave signal generator to drive your proposed power stage open loop.
If you don't have a generator use your potentiometer input to control the PWM output on a PIC.
Don't worry about current or voltage sense.
Keep it as simple as possible.
Just work on the power bits only and see what happens as you vary your PWM duty ratio and loading.
Watch what is going on with an oscilloscope.

ok i will start my working with your kind suggestions
thanks Mike again


Mike Walne
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Power circuit considerations
PostPosted: Sat Aug 06, 2011 1:42 pm     Reply with quote

Sorry. I meant D1 should be a fast recovery diode. You can't use a standard rectifier in this position. A 1N5401 will simply not do the job, it won't turn on or off fast enough.

[You've shown an N channel part on your schematic for Q3. I am therfore assuming that you intended to use a 75V/75A N channel device.]

Your schematic is NOT configured to drive an N channel power MOSFET in this application. You've set it up as a source follower. (It could drive a P channel MOSFET badly in common source mode.) In practice you need to turn your switching device (Q3) on and off reasonably quickly.

As it stands, your switch drive circuit will neither turn an N channel MOSFET hard on or off nor at speed. In the ON state you haven't enough gate voltage drive. (For an N channel part, the gate voltage needs to be taken above the +12 rail by 5 to 15V, depending on the device's threshold voltage). In the OFF state you need to take the gate voltage down to your negative output. (Your gate drive is clamped at 0V in the OFF state by Q2.)

It's simpler to use a P channel part for the switching device Q3. The down side is cost of the P channel part. You connect the gate to the place shown, the source to the +12V rail, and the drain to the D1/L1 junction. In the ON state, the gate-source voltage is then -12V (OK). In the OFF state, the gate-source voltage is 0V (also OK).

A reasonable size power MOSFET has inter-electrode capacitances of the order of nF. Combined with your 1k pull up resistor R1, you have a time constant in the micro-second region (1kohm * 1nF). This is far too slow. (Try a some sort of totem-pole drive. You need a low impedance.)

Mike Walne.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Loop Control
PostPosted: Sun Aug 07, 2011 4:25 am     Reply with quote

I asked why are you measuring output current. You are better off measuring input current, or more specifically choke / power switch current. The input current gives an earlier warning that you are in an over-current situation. It can also be usefully employed for loop control.

There are two PID loop controls you could sensibly try for starters.

1. Voltage mode.
2. Average current mode.

1. Voltage mode. You monitor the output voltage, compare to a reference, apply PID terms to create the PWM duty ratio. The PWM applied to the switch creates a new output voltage, and you go round the loop again. There's a problem. Each element of the loop creates a delay. There is inevitably a ripple on the output voltage. Filtering the ripple (either by analogue means or digitally) creates delay. When you change the PWM ratio there is a delay before the choke current reaches a steady state value, and a similar delay before the output capacitor reaches steady state. I referred you to the analogue methods. From these you will see that most of them use two D terms to create high performance closed loop control. The method of control is therefore PIDD rather then PID. In loop control speak you've got a too many poles.

2. Current mode. In this method you have two loops, an inner current mode loop and an outer voltage loop. The outer loop monitors the output voltage and creates a current demand signal. The current loop uses this signal to set the PWM and compares the choke current to the demand signal. The choke current does eventually produce an output voltage. The effect of using current mode control is to give you fewer poles in your voltage control loop and you can then do PID control more easily.

Voltage mode looks simpler, but is the devil's own to control. Current mode is more complex, but easier. To achieve current mode control you first get your current loop stable then work on the voltage loop. You can monitor choke current in the 0V lead with a low value resistor then amplify it. Or you can use a current transformer in the switch, you then don't need to amplify, but you have to deduce the choke current because you only get a signal when the switch is ON.

Whichever control mode you choose your choke will change from discontinuous to continuous current at some loading. With your design parameters of +12V in, -18V out, 200uH choke and 25kHz switching, the loading will be about 0A72. When the change occurs the number of poles in voltage mode control also changes and with it stability criteria.

Again I refer you to switch mode control chips. You will notice that they usually clamp PWM duty ratio at around 90%. I suggest you do something similar. A peak of 90% duty will give you at least -108V for +12V input. Your +12V input / -18V output will need a minimum 60% duty ratio. You require more than that for proper loop control. A limit between 80% to 90% is probably a good compromise.

You pays your money and takes your choice. You're on your own now.

Best of luck.

Mike Walne
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group