Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - PWM output

(you are viewing a thread; or go back to list of threads)

PWM output (by Ian)
Hi ,

I am using a PIC16F877 to implement a variable duty cycle PWM output for a solar MPPT circuit. The problem I have is how to obtain the output because during simulation the duty (ie the PWM output is keeping the value of zero). Any help thanks in advance. If you need more information I can supply the flowchart of the algorithm.

Thanks
Ian
Thu Feb 25 2010, 03:56:10, download attachment pwm-VARIBLE_ian.ld
problem with the maths (by David R)
Hi Ian,
The first thing I see is that your maths can exceed 16 bit which is 32767 or something
and it must not do this, have A read of the manual under maths.
change the maths maybe divide the inputs by 10 before the multiply retry and re post.

Regards
David.
Thu Feb 25 2010, 04:30:19
(no subject) (by Juan)
Hi Ian,

Please supply us the flow chart for more info.
Thu Feb 25 2010, 06:00:34
(no subject) (by Ian)
Hi David,

Thanks for your guidance. I have sorted that out by dividing the ADC values by/8 and the 16-bit integer is not exceeded. Know I replaced other things in program an now it seems to work better. One thing I am noticing is that when powernew is increasing the duty cycle is keeping incrementing by (+5) but when the values form the ADC are decreasing (ie reducition in power)the reduction in the duty cycle is stucked to -5 only not incrementing negatively?

Thanks again
Regards
Ian
Thu Feb 25 2010, 06:21:02, download attachment pwm-VARIBLE_ian.ld
(no subject) (by Ian)
Here is the flow chart algorithm.
Thu Feb 25 2010, 09:01:59, download attachment IMG00280-20100225-1225.jpg
(no subject) (by David R)
Hi Ian,
I cant read the flow chart vary well can you maybe redraw it or screen shot it and post
Regards
David.
Thu Feb 25 2010, 18:56:58
(no subject) (by Ian)
Sorry if it was not clear, here I have reattached the flowchart.

Thanks again
Regards
Ian
Fri Feb 26 2010, 02:22:25, download attachment printscreen_Algorithm.png
(no subject) (by David R)
Hi Ian,
The Algorithm cant work as far as I can see,
the reason is if the power falls A little bit the controller
will lower the duty cycle if the power never reaches the "old power" because the is A cloud over the sun then the controller will ramp the duty all the way to zero making the new power even less than old power and the controller will crash for ever.
the Algorithm will only work when ramping up.

I am working on A new Algorithm so that the controller will keep steeping the duty up and down A little bit so it can work out which way to adjust the duty to maximize the return.

Regards
David.
Fri Feb 26 2010, 03:38:20
(no subject) (by Ian)
Hi David

I tried to solve that problem. Can you please take a look at this program now.

Thanks
Ian
Wed Mar 3 2010, 06:01:57, download attachment pwm-VARIBLE_ian_2.ld
(no subject) (by Ian Busuttil)
Hi David

Here I have attached the new flowchart. Help help is mostly appreciated.

Regarding using pic 16F877A is that compatible with this ldmicro?

Thanks
Ian
Wed Mar 3 2010, 17:00:07, download attachment flowchart_pwm.png
(no subject) (by David R)
Hi Ian,

I don't think you are going about this the right way,

I had A long play with your code and could not get it to function correctly.

I think the best way of doing this would be to step through the program with A counter and an equals to op on each line,
so the program reads the input makes A change and rereads the input to see if it is better or worse, then if worse change the other way the the same amout and check. If both ways are worse then the setting was correct so leave it there or adjust in the direction that makes it better.

One other question is why do you move zero to duity when the
value is above 90 why not let it go to 100% but no more.
Thu Mar 4 2010, 03:57:26
(no subject) (by Ian Busuttil)
Thanks Dav,

Can you please send me a small example of using the counter in this algorithm to get a better picture please. Yes regarding the second question there is nothing to keep that not reaching 100%.
Thu Mar 4 2010, 16:25:38
(no subject) (by Ian Busuttil)
Hi Jaun,

Can you give me an aid in this because I cannot figure out how to make it work properly.

Thanks

Ian
Fri Mar 5 2010, 18:05:40
Delay mpps (by MGP)
A different approach.

The way you do it is not possible because you cannot measure the output.
Sun Mar 7 2010, 11:51:07, download attachment pwm-VARIBLE_mgp3.ld
(no subject) (by Juan)
Hi Ian,
The way I see it a MPPT is no more than a buck converter. Lets say you have a 17V 5A solar array with a power output of 85W at full sunlight. You have a 12V battery that has to charge via a charging circuit capable of giving the maximum power to the battery. E.g. a flat battery of 10.5V charging at the max current the solar panel can deliver, yields 10.5V * 5A = 52.5W that's 85W - 52.5W = 32.5W wasted power. Since you cant change the charging current to the battery directly you will have to bring the solar voltage down to increase the charging current to the battery. Your charging voltage should however be at least 1V above the battery voltage to allow maximum current flow. Thus to charge a 12V battery from flat(10.5V) to full(13.5V) is 11.5V to 14.5V. This is your allowable voltage span to play around with to obtain maximum power transfer to the battery. A flat battery will draw maximum amount of current (in limits). Thus increasing the charging voltage decreases the current(in limits). The power obtained from the V and I will govern the duty cycle. Obviously as your battery charges to its rated voltage the current will decrease accordingly until you can no longer adjust to get the maximum power. The battery has fully charged when there is little or no more current draw from the circuit. The pic has a set point for the minimum current draw an will shutdown if this value is reached.

Which brings me to my point in the beginning that a MPPT charger is very much like a buck converter.
I have attached a pdf that the describes different ways of controlling the power.
Sun Mar 7 2010, 14:05:14, download attachment Advanced algorithm for MPPT.pdf
version 2 (by MGP)
Here is a better version of a MPPS.
Sun Mar 7 2010, 14:53:07, download attachment pwm_MPPS_MGP.ld
(no subject) (by Ian Busuttil)
HI MGP,

Firstly thanks a lot for your help. Regarding the modified MPPT. This program will keep on incrementing the PWM output as as soon as the value from the adc is increased and similarly when it is reduced will keep decreasing to zero.

If a certain voltage and current are settled the duty cycle will keep increasing or decreasing.

Thanks again
Ian

_____________________________________________________________


Hi Juan,

Regrading the techniques used for MPPT I have already looked at various methods.In my circuit the aim of the MPPT is not depending on battery charging only, but supplying other converters. Thus my aim is to keep the voltage across the PV terminal to 15 Volts since during my test I found that my panels are at there MPPT at approx 15Volts were the open circuit voltage is 20 Volts.

So in my circuit the circuit will be working as a Buck instead of boost

Thanks
Ian

Ian
Mon Mar 8 2010, 17:37:07
(no subject) (by MGP)
you wrote:
-------
Thus my aim is to keep the voltage across the PV terminal to 15 Volts since during my test I found that my panels are at there MPPT at approx 15Volts were the open circuit voltage is 20 Volts.
--------
That is not the meaning of a MPPS.
What you ask is something like a LT1085 voltage regulator or a shunt regulator.

Read this.

http://www.boatdesign.net/foru...llers-mppt-battery-charger.pdf
Tue Mar 9 2010, 11:33:32
(no subject) (by IAN)
Sorry of not being clear in my describtion. In my project I am going to use approximately 9 panels and the connection will be groups of 3 in series and than in parallel with each other. This will result in an output voltage of 60 Volts O/C so it is not possible to use such above voltage regulators. Now to track for maximum power the output must be controlled to 45V (ie: 15 Volts across each panel).

Regarding the MPPT I was trying to use the Perturb and observe algorithm.The program you have send me the (better version for MPPT) is that following the latter algorithm?

Thanks
Tue Mar 9 2010, 12:11:47
(no subject) (by MGP)
Yes, but it's a example program so you can change it to your needs.

I still think that you are focused on the voltage but that is only true in full sunlight.
You can also have a MPPS point at i.e. 30V and that's the goal of this program.
Always in search of the MPPS.

grtz
Tue Mar 9 2010, 12:59:11
(no subject) (by IAN)
Yes you are right. But that program as soon as the current or voltage increase it will keep increasing till the saturation value of 99 and this will not find a steady value of duty cycle to get the MPPT. I am right ? This will work if the adc values will keep oscillating i am not sure but in the real situation I think that the values will keep oscillation about some value. I am going to put it on the PIC and make some test with your program.

Thanks
Ian
Tue Mar 9 2010, 13:45:16
(no subject) (by MGP)
In my writings, read MPPS as MPPT, i was a little bit confused by some other program i have made..sorry for that.

And yes, it will oscillate around some point.
It shall never reach the 99% in cloudy weather because de current/voltage will drop.

It's a program that you need to expand, controlling the battery,timings, minimum and maximum points, start-stop etc...
Wed Mar 10 2010, 09:12:57
(no subject) (by IAN)
OK np MGP, Thanks for your help.Is it possible to show the values of current and voltage and power on a display and how you can show the decimal point?
Wed Mar 10 2010, 11:10:30
(no subject) (by MGP)
Hunoell has uploaded a display program in the thread below this one " HD44....7segment display."
Wed Mar 10 2010, 12:53:25
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):