08M2 PV MPPT Charge Controller

Solar Mike

New Member
Have been building solar PV charge controllers for many years, thought this project may be though provoking for some readers on this forum, designing an ultra basic controller using a 08M2, usually I post all my projects on "TheBackshed" forum and will continue to so so as they allow more images etc in posts.
So rather than repeat everything here, will add a link for anyone interested. Picaxe PV Controller

Have just sent the gerber files away to get pcb's made, so will be a couple of weeks before I get them back and can start writing some software.

24176


Cheers
Mike
 

lbenson

Senior Member
Very interesting design. I had read the linked TBS thread when originally posted, and noticed that you said that because of a shortage of pins on the 08M2, "Cannot measure the PV voltage, will have to improvise using software to determine PV is present".

I was wondering how you were going to do that improvisation, but see now that an additional design you posted in that thread uses the 14M2, which seems like it might be less restrictive. Do you still think the 08M2 will do what you want?

(Writing in Nova Scotia, not quite 45 degrees North, where there sadly seems no hope for solar.)
 

Solar Mike

New Member
With the 08M board, PV must be present if at 100% PWM, there is charge current detected...
Don't really care about the PV; all I want is max charge current for any solar variations, so mppt operation will be optimizing the PWM for max charge every second or so.
This project needed to small as possible, but should work ok, need 10 or so minimal functionality controllers for some remote batteries out in the field.

Added the 14M2 to get some extra led status indicators.

You must get some sun....

Cheers Mike
 

AllyCat

Senior Member
Hi,

You can also use C.0 of an 08M2 as an ADC input using READDAC{10}. It can be particularly useful for reading bi-directional currents as the DAC can introduce a bias. But I would consider 08M2 v 14M2 irrelevant for a circuit design of that complexity.

I'm not sure about "no hope" for solar at 45N. We have substantial solar farms in southern UK, all above 50N, but maybe the Government got the subsidy wrong (IMHO they did). However, at these latitudes the Winter months can be a major energy storage issue, or "dead loss", depending on the application.

Cheers, Alan. .
 

Solar Mike

New Member
But I would consider 08M2 v 14M2 irrelevant for a circuit design of that complexity.
Indeed; normally I use the 20 or 28X2 versions for these controllers to make use of hardware interrupt pins and much higher 64 Khz PWM @10bit resolution.

Had a read up on the READDAC{10} command, interesting...

Cheers
Mike
 

lbenson

Senior Member
You must get some sun....
I walk out my back door in July and August and think, "I'm in Paradise". But winter is a long slog, and spring? Ha, what's spring? I was raised in Virginia, where March has many nice days, and April and May and into June are lovely before it turns brutally hot and humid. When this used to be my summer home, my neighbor would say I brought the good weather up with me at the end of June.

I can't see solar doing much here, even aside from the fact that you'd want perfect placement, which I don't have.
 

premelec

Senior Member
@Solar Mike - thanks for bringing this up again! I admire your work on this while also noting that with many installations you can get pretty close to maximum power by measuring temperature and voltage of the PV panels - controlling current loading of a switching converter to keep that PV voltage in range. As PVs have become less expensive squeezing the last watts out has become less necessary though still pleasing. Using a 14M2 with 4 PWMOUTs you can, if needed, use a vernier setup where one PWM gives coarse another fine tuning of the resultant PWM signal. Mostly it isn't needed to track output by the millisecond so PICAXEs are suitable. When clouds drift by you just don't get full control...

@Ibenson solar is still working in your area despite opinions on the weather... ;-0
 

lbenson

Senior Member
@Ibenson solar is still working in your area despite opinions on the weather... ;-0
Solar works--my garden did great. But PV solar in Nova Scotia? Do you have examples? Yes, there is one millionaire who fitted out his private island with solar, but the expense was great, and I'm not sure he's there in the wintertime.

Even aside from the fact that panels appear to cost 3-4 times as much here as in Australia.
 

premelec

Senior Member
@ Ibenson - glad that photosynthesis is still working to feed you &/or give you pleasure... I note that Canada has active solar PV promotion and your apparent area probably gets about 1/2 yearly KWHr/peakWatt than my area gets - that's still a lot... suggest looking at aerial views of your area to see if anyone is using PV panels. Energy storage is an on going expensive situation... this is not the best forum for a discussion. A large part is to see how to use less than NA people may be used to... end of gardening season here in a few weeks with early nasty snow storm that broke a lot of trees...
 

lbenson

Senior Member
premelec--we had our first frost three nights ago--a month earlier than last year. I'll look further, but a yearly average won't help much in January and February. No one would deny the flood of solar input in July and August.

Someone nearby has rooftop solar hot water, but in asking about I haven't heard of PV. And in any case, I'm not going to put solar panels on the roof of my 180+ year old house. I can look at an aerial view, but I could scan about 60 miles to my west-southwest without seeing even a paved road.

A "solar" cottage was highlighted recently in a news article, but they didn't mention the usage of the big propane tank visible in one of the photos.

Mike--I'll be interested to see your software, and to follow your progress (maybe on TBS).
 

Solar Mike

New Member
PCB's being made now, will get them back in approx 10 days.
Software I will post here, dont think many on TBS use picaxe's so will have minimal interest.


Currently looking at a suitable communication protocol to allow a master charger or aggregation device talk to the PV controllers in a small network to either send them the common voltage settings etc, or tell them to switch to Constant Voltage or Float operation at the same time; then ask each one for its average voltage or current etc.

A large bank of batteries may have 5 controllers connected; have noticed that there is always one that is the first or last to switch to CV or Float operation, ideally they should sort of follow each other closely.

I have a small matchbox sized pcb designed about a year ago that allows an isolated 1-wire connection to each device; probably will use some customized bit-bang method to send the info back and forth, just yet to decide how to do it, there is a mixture of CPU's so not all have sophisticated receive buffers etc.

Any ideas welcome...

Cheers
Mike
 

papaof2

Senior Member
I've been "dabbling" with solar for several years, primarily as a "Wait until daylight" option for the frequent but usually short grid outages we have and I've tried a number of commercial solar charge controllers - PWM and MPPT - some are much better designs than others. I'm interested in how "real world" usage works for your design over time.
The solar irradiation for Atlanta works as a rule of thumb for 50-100 miles out from there so we basically have 3 useful sun hours in winter and 5 useful hours in summer. The current system is a 12 volt, 420AH battery bank which is kept charged by a single 250 watt panel via an MPPT controller. With a 2000 watt pure sine wave inverter, the system powers fridge, freezer, a few LEDs and the internet for 8-10 hours - long enough for a storm to pass or until daylight and I could then go out to set up a small (1600 watt) inverter generator. The average running load is under 300 watts but you must allow for the surge watts of starting motors (fridge, freezer, etc.) which is typically 5 to 7 times the running watts but can be 10 times the running watts.
Finding a good place to put solar panels can be difficult when you have tall, old growth trees but this year's tree work includes removing a dead maple, cutting dead/damaged limbs on multiple trees and removing an oak that doesn't provide useful shade for the house. When the oak is gone, I'll have space for 1500-2000 watts of ground-mounted solar panels and we could grudginly manage with that for the long term - but still better than being in the dark ;-)
We'll never produce the amount of power we use from the grid (monthly utility details kept in a spreadsheet for more than 15 years) but another spreadsheet tells me what we can power and for how long on days with and without sun. If you want heat, use gas (LP, natural) or wood. Solar PV is not a good choice for electric heating.
I experience "solar envy" when I pass a design/contructionbusiness a few miles from us - the roof is covered with about 100 panels of estimated 250-300 watt size. I'd like to see their entire setup...
 

Solar Mike

New Member
I've been "dabbling" with solar for several years, primarily as a "Wait until daylight" option for the frequent but usually short grid outages we have and I've tried a number of commercial solar charge controllers - PWM and MPPT - some are much better designs than others. I'm interested in how "real world" usage works for your design over time.
It should be mentioned that building a mppt controller will have little advantage over a basic pwm type when the PV panel voltage is closely matched to the battery and the output power is not so high. I am only suggesting a mppt design here for my setup, which has various individual batteries using a number of differing panel types with various power outputs and voltages.

If I was building a small system and purchasing new PV panels, then basic pwm is more cost effective, as its not so complex to design and off the shelf chargers are reasonably inexpensive. PV is so cheap now that any power lost in PV-Battery mismatch can be made up by adding a another panel.

This charger could easily be turned into a PWM type if desired by shorting out the buck inductor, removing the input electro and most of the output electros.

For a larger system where we are working with charge currents > 100 amps, MPPT has many advantages is that the ripple current as seen by the battery is very low and easily controlled by software. It is not the best practice to send huge pulses of current into lead acid batteries to keep them topped up in float state as would occur with a high power PWM. The lifepo4 batteries that I mainly use probably couldn't care less about that situation, their internal impedance is so low, it would have little impact.

"papaof2": I run my home office + 1 fridge and an upright freezer off a 12v 400 AH Lifepo4 battery (4 x 3.3v cells in series) coupled to a highly modified 3.5KW inverter, 1Kw PV. its not uncommon to see surge currents >100 amps when a fridge turns on, most commercial inverters 2Kw or less would fail I think if the fridge and freezer switched on at the same time; if you want to use a low power inverter then a low frequency type is better suited as they can cope with large surges better than the HF type.

Cheers
Mike
 

Solar Mike

New Member
Have finally started building the prototype, writing the software and doing some tests with various inductors. PCB had no errors on it, so a good start.
here is a photo showing the test setup.
24300

Using a variable psu with current limit control to simulate a PV panel, set to 30v, load is a 12v battery with a 10 amp water cooled load. Was curious to see the effects of various inductor types, so made several and can plug them in using XT60 connectors. Current through the buck inductor is measured across a precision 0.01 ohm resistor, hand held digital scope shows the inductor ripple wave form, was aiming for approx 15% ripple in the design.
So far all testing has been done at approx 10-12 amps load, the inductor in the photo has 2 amps ripple which is pretty good. Will have to make another load to test at higher currents, 12 amps is giving 92% efficiency. Nothing really gets hot on the pcb, input cap 3300uf 160v gets to about 35c after an hour, the heatsink is barely warm, inductor 30 or so degrees.

Code was tricky to write, using an 8 pin device there are limited measurements that can be done, working on the theory for maximum power out of the panel using the charge current for control, always aiming for a max current about a pwm duty cycle point that moves up and down to to track the panel output. Seems to work pretty well with accurate voltage and current control.
Tested this afternoon on a 150 watt panel outside with bursts of bright sun, clouds etc, tracks very well and quite fast. Code as currently working attached.

More photo's look on the BackShed, see link in first post.

Cheers
Mike
 

Attachments

Solar Mike

New Member
Have completed more tests at higher charge currents, with 20-22 amp loads for an hour. Altered the software to allow loads above 20 amps and added another hot water element 10A load @12V to give a total of 20A + the battery charge rate.

Changed the inductor to T200-26B with 26 turns 2mm dia wire, note this is a bit light should be 2 wires not 1, so copper losses are higher than expected.

Heatsink gets a little warmer than previous, certainly < 40c, input cap gets approx 45c (its 105c rated) nothing else on the pcb really changes temperature, the output caps not even warm, the inductor as expected gets to 45c odd with the light gauge wire.

Inductor AC ripple is now 4A or 20% ripple as per design for 26 turns. Input voltage remains at 30V, so will work ok on a 300W panel.

Efficiency is 90% @20 amps and 30 volts input, with a PWM duty cycle of approx 50%, the higher voltage mosfets currently used would be more efficient if lower voltage types used if it was going to just charge a 12v battery.

Calculations show the above inductor will work over the design spec of 35 amps ok without saturation, if the thicker wire is used, input voltages up to 61vmp (2 series panels) will also work, however the input cap probably would get too hot and have to be uprated to a lower esr type.

Last test, I tried opening the output circuit breaker to the battery and @20A load to see what would happen to the sudden unloaded output voltage, it should rise; and did to 32V before the software shut down the pwm, no drama, did it twice to make sure.

So quite pleased, works as designed; I will be building a number of them for 12v small batteries 100W or so panel and a 24v version for my UPS that I have rebuilt with Lifepo4 batteries.

Will make up the other version next using 14M2 CPU.

Cheers
Mike
 

lbenson

Senior Member
Nice job. Thanks for reporting, and congratulations. I'll be interested to see what additional you do with the 14M2.

Am I correct in thinking that the "output circuit breaker to the battery" that you opened is shown in the photo, and is 2-poles so you're breaking both +V and 0V?
 

Solar Mike

New Member
Yes both +- battery and load connections broken by a double pole CCB, not shown in the photo; connect to the watt meter cable.
When opened under load, the output cap voltages rise to 30 odd volts very quickly, cpu winds back the pwm, to its lowest setting, the load current is zero and it turns off the pwm completely, then output voltage drops to nothing before the Pic can restart as the delay period between measurements is too long, so shuts down.

There is excessive output capacitance 8 x 470uf, will reduce to 4 caps. The battery is in effect a near infinite capacitor, so behavior is not same as building a step down buck PSU.

Mike
 

Solar Mike

New Member
Update: Have made a couple of changes, T200-26B core, rewound with 2 parallel strands 2mm dia wire, 26 Turns; replaced the 3300uf 160V main cap with a better quality 10,000uf 80V with lower esr; taken off 4 of the output caps, so now there are 4 x 470uf 35V on board, noting these are very low esr types @1.8 amps ripple rated, removed the 12V psu module as not required when using a 12v battery.

Tested running 20 amps for a hour, main cap doesnt heat up so much, inductor mildly warm, nothing on the pcb gets hot, so I will use these changes for the battery chargers. Have made few mods to the software and still doing so, will post final code here along with pcb gerber files if anyone wants to make one.

Cheers
Mike
 

Solar Mike

New Member
Update: Software has been modified somewhat and been in various stages of test over the past few weeks, mppt code now works much better than my previous attempt. Testing on a 300W panel roof mounted, tracks in all light conditions from full sun, down to fractions of an amp at near dusk. Using a PSU with current limiting to simulate a PV panel 20A continuous is fine, nothing over heats, 30A would be the top end for the inductor I'm using, would need thicker wire; 40A would be the limit of this design.

Current code and gerber files attached.

Have a good Christmas all.

Cheers
Mike
 

Attachments

PiCaxeDB

New Member
Hi All,
I have just built a MPPT for my 2.1Kw solar array. I use the system to power my HotWater. The Picaxe 28x2 does the job very well, returns 95% to 85% efficency, very pleasing result, as this was my first design project.
To answer the question can a Picaxe chip run an MPPT for me it is YES.
 
  • Like
Reactions: J G

J G

Active member
Hello,
If you are interested, I have come across an even more simple style of mppt, however you may class it as a pwm or hybrid between a pwm and mppt.

I used to race model solar cars (10W panel with no energy storage except for the momentum of the vehicle, >30km/h top speed around a 100m slot car style track and most of the cars had maximum power point trackers). There was a weight penalty in the form of extra ballast required to encourage people to learn more about matching motors to panels and gearing as the mppt pretty much formed an automatic gearbox with the motor appearing as a short circuit when stalled and almost open at top speed, with the mppt allowing the panel to always be run at a constant voltage. Other clever designs I have seen to get around the weight penalty by not having an mppt have included a centrifugal switch to mechanically swap two panels from being in parallel for high starting currents and torque to series for high final velocities.

Pretty much all of these "mppts" in these cars were significantly simpler again than Solar Mike's design, although possibly less accurate depending on setup and knowledge of the solar panel they are paired with, measuring only the solar panel voltage and using the rule of thumb that the mppt voltage is 80% of the open circuit voltage - see the graph of power vs voltage for one of my cars' panel.
This allowed m2 chips to be fast enough to respond to short races and quick changes in sun levels, simple and cheap enough for students to build (and modify the firmware as needed). They would operate by turning the motor off on start, measuring the open circuit voltage (assuming the voltage regulator and microcontroller have negligible current draw), then behaving as a buck voltage regulator except trying to regulate the input voltage by varying the duty cycle of the mosfet instead of keeping the output voltage constant. Every so often they might momentarily turn the motor off to get a new open circuit voltage reading as it can change with temperature of the panel.
When stalled, this system could easily be pushing 4 or 5 amps through the moderately small motor in bright sunlight.

In the interests of marginal gains, later designs used the hardware pwm in 14m2s to use a second mosfet as well as the shotkey flyback diode across the (brushed) motor to reduce losses from voltage drop across just the shotkey diode.

The event's website is here if you want to know a bit more about the cars: https://www.modelsolar.org.au/
I built a boost version of one of these mppts to charge lead acid batteries from a lower voltage panel, which can be found here: https://github.com/jgOhYeah/Solar-MPPT-Boost-Lead-Acid-Battery-Charger
A couple of commercial ones designed for the cars can be found here (one is picaxe based and a few are based on comparators and a manual adjust to the correct mppt voltage or atmel microcontrollers): https://www.scorpiotechnology.com.au/starter-solar-challenge-kits

In the graph, sun levels are percentages of 1000W/m^2, as measured by the event organiser's calibrated light box of halogen globes.

Hope you find this interesting.
24400
 

fernando_g

Senior Member
Two thumbs up for this very, very interesting project.

You have everything, or most everything already figured out, but I would still like to provide my two yen.

The Micrometal's mix-26 core material is a very widely used material, as it is extremely forgiving with respect to saturation and has a relatively high permeability.
However, if you plan to use a PWM frequency close to 100 Khz, the mix-52 material keeps the -26 good attributes with about 35 to 40% less core loss.

Apparently you are switching at 32 Khz. At those frequencies the increased core loss won't be noticeable between the two materials, and the mix-26 is cheaper.
 

Solar Mike

New Member
Have tried both 26 and 52 mix cores and there is no noticeable difference in performance at 32Khz, 20amps continuous load for an hour and core is just warmish to the touch.

I purchased the cores from AliExpress here, 26B and 52B quite some time ago before Covid, now with much higher shipping, costs more than the cores to NZ, cannot get any from the USA as too expensive with Trumps import tax added on, as they are all manufactured in China.

32Khz PWM is the max frequency the M2 series chips can go to whilst having 10 bit resolution, or 64Khz if X2 chips used.

Currently building the 14M2 version.

Cheers
Mike
 
Top