"My first solar charge controller" - Page 1
Forum section: electronics / beginners

author: paulca
author_rank: Super Contributor
timestamp: February 28, 2023, 07:18:28 pm
content: I have been wanting to play with an MCU controlled MPPT solar charge controller, since I started electronics. It's just that I have never remembered to buy a solar panel small enough to work on indoors on the scale of a single 18650 or two.That is about to change. I got an INA3221 three channel current and bus voltage sensor. I also bought a bunch of various sizes of tiny solar panels. As efficiency is not the first targetI picked the biggest to start with.A 6" x 6" 6V panel. I can't recall it's "claimed" specs, not that they matter. For testing I have my super powerful bench lights, which don't often get used, but energize this 6" panel into producing measurable output.Connected directly to an 18650 Li-on - (After sanity testing first with some resistors) - it was able to put 25mA into a cell at 4.01V. With the bench light cranked up to 100% unbearable it produced 60mA into the cell at 4.04V.I think that's almost enough to start working on a buck convertor. I may need to discharge the cell down a bit though to work on it under the bench light. A 6V panel should have an open circuit voltage some where around 7.5-8.0V but only gives 7.08V under the LED lights. This makes sense. The 100W LED panel is designed to project it's 100W light over about a 1m^2 area. Which is about 1/14th of the standard test conditions for panels.If I can get anything out of it under artifical lighting, then I can test it more properly in the evenings putting the panel out the window sill in the afternoon sun.I have a buck/boost convertor on order from Ali express, but in the interim I'll use a barebones breadboard buck.The MCU will be an STM32 F401 with a TFT screen for debug, using a basic timer for PWM output and the I2C communicates with the INA3221.The Li-on cells are unprotected. However as soon as I test the voltage limiter ... there isn't enough power in the panel to cause any real harm. That will come later with larger panels.As a first goal... I'd like a pair of 18650s and this 1W panel to power the F401 MCU and even allow a push button to turn the screen on for 5 seconds on demand.... without help. Should be "easy", right?

author: hojnikb
author_rank: Contributor
timestamp: February 28, 2023, 08:50:00 pm
content: definitely following this thread.As im in the similar situation; i've gone and bought this fake mppt boardhttps://www.aliexpress.com/item/1005005207309050.html?spm=a2g0o.productlist.main.15.7f0e17c4Ink9eY&algo_pvid=9aa56068-89a6-4085-86fa-a5d461fd2c10&algo_exp_id=9aa56068-89a6-4085-86fa-a5d461fd2c10-7&pdp_ext_f=%7B"sku_id"%3A"12000032167055955"%7D&pdp_npi=3%40dis%21EUR%2127.44%2111.8%21%21%21%21%21%400b0a558a16776171431147723d068a%2112000032167055955%21sea%21SI%21717750433&curPageLogUid=BraKMhDY9VY1It does boost the voltage, but it does not automatically track maximum power point, as you'd expect from a MPPT. Instead, there is a potentiometer, that you can set at which voltage you'd like to drive the panel.Now because there is a potentiometer onboard, maybe with some current/voltage sensing, you could vary that potentiometer (either with a digital potentiometer or some sort of PWM signal?) to extract optimal driving voltage for given conditions.In your specific case, you could use something like this for smaller panels and do the exact same thing.https://www.aliexpress.com/item/1005004609631629.html?spm=a2g0o.productlist.main.63.7f0e17c4Ink9eY&algo_pvid=9aa56068-89a6-4085-86fa-a5d461fd2c10&algo_exp_id=9aa56068-89a6-4085-86fa-a5d461fd2c10-31&pdp_ext_f=%7B"sku_id"%3A"12000029817900603"%7D&pdp_npi=3%40dis%21EUR%213.81%213.77%21%21%21%21%21%400b0a558a16776171431147723d068a%2112000029817900603%21sea%21SI%21717750433&curPageLogUid=kCmcb2618E3L

author: MrAl
author_rank: Super Contributor
timestamp: March 01, 2023, 03:39:43 am
content: Quote from: paulca on February 28, 2023, 07:18:28 pmHi,There are a couple key ideas you should know about max power tracking with a solar array.First, charging batteries is a special case of using a solar array for energy production.The IV curve of a solar array (with I on the 'y' axis and V on the 'x' axis) has a horizontal portion at the top which means the current is nearly constant for any voltage the panel will produce. This is not exact, but is fairly close, and the max power point is just to the right of the flat, horizontal portion where the voltage drops just a little. For example, for a 21 volt panel the MPP may be around 17 volts.What this means for charging batteries is that if you place a diode in series with the array you get nearly constant current for nearly every possible voltage, which means the batteries charge at the same current for any voltage, approximately. That means you have to go some to get better with the MPP.As i said it is not exact, but since this is a close approximation you have to go through some trouble to get faster charging by tracking the MPP. In order to get any practical value from max power point tracking the boost converter (or buck converter even better) has to have fairly high efficiency AT the range of expected voltage inputs and voltage outputs, so you'll end up with an average efficiency. I would say shoot for 90 percent minimum to see any real value from the project, unless you are dealing with very high power like thousands of watts, and of course still charging batteries.For a couple examples, say we have an array that puts out 1.1 amps short circuit current. At the MPP it may put out 1.0 amp. With an open circuit voltage of 21 volts and MPP voltage of 17 volts, we would get a max power output (full max insulation level) 17 watts.Now 17 watts charging a 12 volt battery would mean we would see a charge current of 1.42 amps, while with no MPP tracker we would see just 1.1 amps for most voltages. That's an increase of 29 percent which is significant especially when dealing with very high power arrays.Unfortunately, that is with a converter that works at 100 percent efficiency for any voltage level.With a converter that works at 80 percent (typical regular buck converter) we lose 20 percent of that 17 watts and that brings us down to 13.6 watts. Of course that means we get less charge current, and that would be around 1.133 amps. Without the MPPT and converter we had 1.1 amps, and now we have 1.133 amps, which now is a gain of just 3 percent, which is almost 10 times less of an increase in charge current as with the theoretical 100 percent efficiency converter.So you can see the problem. With a regular converter we would get only a tiny increase and we may even see less efficiency over the average voltage range. Now let's look at a the same when using a 90 percent efficient converter.With a 90 percent converter that 17 watts turns into 15.3 watts, and so we get a charge current of about 1.28 amps. Compared to using a diode, that means we get about 16 percent increase in charge current. That could be significant if we were using a 2000 watt panel (150 amps vs 129 amps) but if using a 20 watt panel we would see 1.5 amps vs 1.29 amps, so it may not make as much of a difference.Then again if we use another slightly better converter at 85 percent efficiency we get a little better than at 80 percent and a little less than at 90 percent.This all means that the efficiency of the converter is a key point in the design, if you even choose to use a converter.If you do, the better way to go is step down with a buck because you can usually get higher efficiency with a buck and better stability.If you like you can experiment with these circuits and see what happens.See what you think and if anything is not clear just let me know.Will be interesting to see what you end up doing too for the final project and results from experiments.Back in the 1980's i worked with a million dollar solar array that took up the whole side of the building. It was a project for Sandia Labs in New Mexico.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 09:42:50 am
content: I think I understood most of that. As you say charging a battery with a panel is a not-so-common case, today at least. When you say "solar" today people assume a large array of 300+W panels on a roof with mini-invertors feeding a grid tie system. A different kettle of fish.Off grid, DC only systems traditionally used PWM, then later MPPT. The key point is, if you just connect a solar panel to a battery, as you suggest with one or more diodes in series so you don't overvolt the battery, you will get a pretty constant current. However you will get that current at whatever the battery decides. The panel is slaved to the battery and can do nothing the battery doesn't do. So if the battery is at 11.0V and the panel can produce, say, 3Amp, the battery voltage (assuming lead acid), might rise to 12.5V, so the panel will be operating at the 12.5+Diode drop. Even if the MPP is 17V. So you get your 3A * 12.5V when the panel is capable, at that very moment of doing 3A at 17V and 50W.MPPT, from my experience is simply placing a DC convertor between the panel and the battery which allows the voltage on either side to decouple. Allowing the panel to operate at 17V while feeding the battery maybe only 12.4V and 4A and letting the panel stretch its legs up to 17V.The corner points are the concern. When the battery starts making "demands" on the panel, such as the battery approaching fully charged and it's voltage rising. If MPPT algorithm isn't quite right it can go off on a tangent at that point or get stuck in an oscilation. What should happen is the panel voltage should rise beyond the peek power point and produce less and less power as the battery takes less and less power. I have seen my current commercially bought MPPT controller reach 0 amps, 0 watts because the battery had been fully charged at 14.40V for 4 hours, so it dropped to float voltage and for a while the panel was sitting at 20V doing nothing.

author: MrAl
author_rank: Super Contributor
timestamp: March 01, 2023, 11:01:43 am
content: Quote from: paulca on March 01, 2023, 09:42:50 amHi,I am not sure if charging a battery is a rare case it may be more typical these days with bettery batteries than some time in the past. I myself use a panel for that too, but you bring up an interesting point and that is what to do once the battery is charged.With my setup that never happens because my battery is so big it could take the panel charging it all day and it would never fully charge, and during the night the charge drains off anyway with the normal usage. This means a diode in series with the panel (and a fuse too of course) is enough.In your case you may also need a charge controller, which is not a MPPT really just watches the battery as it charges and shuts off when it determines the battery is fully charged, or drops to a trickle charge level current.If your battery is fully charged and the panel can put out more energy, there is not much you can do after that unless you have a way of switching in another battery and start to charge that one too. You cant keep charging an already fully charged battery except at the trickle charge rate for that battery and would be much lower than a normal charge, unless of course your panel was small and did not put out much current at any time it ever runs even in direct full sunlight.The only way to 'over volt' the battery is to keep charging it at a high current level after it is fully charged. The current should drop to the trickle charge level current or lower. The battery will self discharge somewhat if it is lead acid so you have to have a way of automatically checking for this. The way some work for example is they will start to charge at something like 13.0 volts and stop charging at 14.2 volts. If the voltage drops to 13.0 volts again, it will start to charge again until it again reaches 14.2 volts, then shut off again. Some may keep a trickle charge going which would be lower current.The two voltage extremes, 13.0 and 14.2 volts, may self-adjust depending on battery temperature, meaning those thresholds may go slightly up or slightly down depending on temperature.Did i mention it is better to step down than to step up?That would mean using a higher voltage panel to charge a lower voltage battery using a buck switcher if you do decide to use a converter at all.It may be interesting to note that Sandia Labs determined it would be better to use a secondary solar cell to monitor insolation rather than try to track using a controller alone and actually measuring the power. The secondary cell would be out with the full panel so it would get the same sunlight level as the panel. They determined it would be more stable. That was for line tied applications though.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 11:55:01 am
content: Still not sure we are entirely on the same page. I still don't accept a diode in series is a sensible way to connect a battery to a solar panel. You are likely to only get about 40% of the available power. PWM might get you higher as the panel will not be constantly pulled down to the battery voltage and gets brief periods to produce higher voltages caught by a cap.The point about using a secondary panel to control the power point of the main controller is an interesting idea, however, I could see it having advantages and disadvantages. In my case my panel has shadows morning and evening which move across it, the secondary panel is that case may well be getting completely different insolation.Here is the bare bones of the MPPT algorithm.Code:previousBattPower = battPowerbatteryPower = getBattVolts() * getBattAmps()if battVolts >= MAX_VOLTS:duty_cycle--direction = DOWNLOOPif battCurrent >= MAX_CURRENT:duty_cycle--direction = DOWNLOOPif previousBattPower > battPowerdirection = reverse()adjustDutyCycle( direction )It's deceptively simple. That's why I don't trust it.On a diode drop straight to battery. Yes, it's fine for various applications where the efficiency of the panel is not important. For example, I am tempted to get a little 5W panel and leave it connected to the motorbike battery over winter. With just enough diodes to never breach 14.4V

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 12:08:55 pm
content: Analsysis of that algorithm quickly highlights it depends greatly on it's frequency (accounting for capacitance/inductance 'delays') and the step sizes for each adjustment of the duty cycle.Also "duty cycle" assumes either direct control of the mosfet in the buck, or producing a PWM smoothed control voltage via a DAC... although an I2C controlled buck converter IC would be epic!If it's, say running at 1kHz and the PWM resolution is only 8 bits, the voltage and current limiter clauses will cause a noticable ripple on the output as it oscillates back and forth off the limiter. More power, no too much voltage, more power, no too much voltage and so on. This is eventually how the "battery full" condition gets handled. The algorithm constantly tries to push more voltage into the battery to raise the battery side power, but get's knocked back by the voltage limiter. Reordering the algorithm is unlikely to help as the duty cycle has to be adjusted for the feedback loop to complete anyway.An STM32 can run the PWM at a much, much higher resolution. However the I2C voltage monitor has limitations depending on how stable a conversion you want. I haven't looked at it's block diagram closely, but I suspect it's a single ADC with 3 channels. So if you were measuring more than 1 voltage you would need a longer conversion time to allow the port capacitance to settle. If I am only measuring a single voltage with it, assuming the current sense ADC is separate, I can shorten that 1.1ms conversion time to 200us and run the algorithm at 5kHz. I might be able to go faster, need to ingest the datasheet to see what happens when you exceed the register update rate with read requests.If I did a raw 0.1% resistor voltage divider and measured the shunt and bus voltages myself with the STM32 I could read those at 1Mhz probably. As I am measuring a mostly ballasted, stable voltage and current these conversion rate being extremely short shouldn't case too many accuracy issues. However, by the same metrics there is less point in high rate measurements.In the other case, when the sun is going down and the panel loses all power, the buck convertor will quickly move up to 100% and directly connect the panel to the battery. This is exactly what my commercially bought MPPT controller does in this case. When the panel voltage is below the battery voltage, the system just runs at battery voltage. You periodically see a twitch in the output as dawn approaches as the panel starts to be able to produce a higher voltage than the battery and produce it's first current of the day, the MPPT algorithm starts twitching into action.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 12:21:17 pm
content: Resolution and approximation artefacts cannot be ignored I fear.Consider if I made the duty cycle a 16bit or 32bit int. That would allow for a pointlessly high precision, but notably far, far higher precision than I can measure the voltage/power. This opens the algorithm to "hunting" oscillations, caused by quantisation/aliasing between the control input and the data feedback.

author: Peabody
author_rank: Super Contributor
timestamp: March 01, 2023, 03:58:54 pm
content: paulca, could you post a schematic of what you're proposing to do? MrAl has been talking about lead-acid, but you're using lithium. Where does the constant current, constant voltage, termination charging pattern for lithium come into this?I've become a bit dubious about the benefit of true MPPT for small projects. Most of the "solar charge controllers" for lithium from the Far East claim MPPT, but actually only try to keep the panel voltage at a fixed level. If you plot a panel's curves for various levels of sunlight, it turns out that the MPP current varies a lot, but the voltage at the MPP doesn't change much. So maintaining the voltage works almost as well as actually tracking the power.Even a linear charger like the TP4056 doesn't do a bad job with solar. The charger won't draw any current at all if panel voltage is below the battery voltage, so something like a 5V panel is going to be in the ballpark of the MPP voltage most of the time.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 06:31:44 pm
content: Quote from: Peabody on March 01, 2023, 03:58:54 pmNobody says these are required. They are maximas if anything. The algorithm has a max current, which assuming the panel is capable of hitting it will effective form the "constant current" or "bulk" phase. Eventually however the voltage will reach the target charge voltage when it will become the limiting factor and thus amount to the "constant voltage" or "boost" phase. There is no termination. The end of day will terminate it. The other option used by charge controllers with lead acid functionality is to set a maximum duration at boost charge, reverting to "float". Just set the float voltage below the resting voltage of the lithium pack and you are fine. The charge stops until you put the battery under load again. That's do-able just by running a timer and changing the MAX_VOLT limiter.As to how much you gain with MPPT. I recall watching Julian Illet's video about his charge controller. He demonstrated the need pretty well by connecting a 20W 12V solar panel to a 20W 12V car brake light bulb. Did it work? No, of course not. He got less than 5W.

author: MrAl
author_rank: Super Contributor
timestamp: March 01, 2023, 08:03:09 pm
content: Quote from: paulca on March 01, 2023, 11:55:01 amIn regards to that 40 percent figure you quoted for using the diode, i cant figure out where you got that figure from. It sounds like you got it from a company that sells charge controllers (no kidding). If you look up on the web some solar panel companies sometimes they will quote 80 percent power even with clouds. That's all nonsense they are trying to sell panels.I have a solar panel running 24/7 and have lots of data collected that says i get full current during bright sunlight, and that is because the current is almost constant with voltage. The MPP is around 17 volts or so, but it is forced to be 12 volts plus some, like 13 to 14 volts or around there. Since the current is nearly constant, i get almost full power using just one diode. I actually have a charge controller but i dont use it because it itself requires some running power which absorbs some of the energy.You dont have to take my word for it though, do some real world testing with some careful measurements and see what you get. I just explained how it works so you would get a good idea what you are dealing with, and 40 percent is way way out of range for what actually happens.You will have to note that this is using a panel that has an open circuit voltage quite a bit higher than the battery voltage. You cant use a 12 volt OCV panel to charge a 12 volt battery for example. A 21 volt panel is the recommended OCV for that battery voltage. If you went to 24 volts you'd have to get a panel that goes even higher. This is an important point too.Also, dont get me wrong here, the efficiency of the converter plays a crucial role in the possible benefit of using a converter charge controller. As i said, if you can get a 90 percent converter you can see some benefit, while 80 percent just doesnt seem to be worth it. You can go through the calculations to see how this works. One thing you definitely dont want is a LINEAR charge controller. That would be a total and complete waste.You should take careful measurements, and I'd be interested to see how your tests go.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 08:47:44 pm
content: If you only want current, just short the panel.https://www.electricalengineeringtoolbox.com/2021/12/the-behavior-of-illuminated-solar-cell.htmlA solar panel is a current source. It matters little what you do with it, it will produce current equal to it's insolation level. Brilliant. However it will produce that current from a dead short all the way up to a little before it's peak power point.The voltage is obviously the other side of the equation. Why would you want to take the 2 amps at 13.6 volts when you can have it at 17V? I mean it's only 40% more power.This is why PWM and MPPT really, really matters. The current is constant at any voltage. It's only at the highest voltages the current will rapidly collapse to zero.... at open circuit voltage, no current.Fixing the voltage or adding diodes will help you when the panel is at it's optimal insolation levels, but if the panel is only getting 80% of that due to hazy cloud, the MPP will not be in the same place it might be a lot lower and your fixed diode dropper will collapse the panel current and get a trickle.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 09:06:11 pm
content: This is my garden 50W panel with an EPEver MPPT charge controller.You can see the panel rise at dawn, but not produce any power until it's out of shadow of the house at 11am when it kicks off into MPPT.Around noon the Lithium pack voltage rises rapidly. LiFePO4 "done" profile. The panel voltage soars because the battery isn't taking current. The charge controller expecting leadacid, keeps the 14.40+V on it for 2 hours before cutting to float @13.60 and thus effectively disconnects.Also, around 4pm the cells have rested down towards 13.60V so the panel voltage is pulled down to battery voltage... it's in shadow again.The difference between the phases of shadow, where the panel cannot produce any real useful power and ends up at battery voltage is the non-MPPT portion. The buck convertor is 100% duty cycle. The bit between 11 and noon is the MPPT portion. Those extra few volts make quite a difference.

author: Peabody
author_rank: Super Contributor
timestamp: March 01, 2023, 10:20:30 pm
content: Quote from: paulca on March 01, 2023, 06:31:44 pmAnd yet, every lithium charger I've ever seen goes through constant current, then constant voltage, then termination. Why do they bother if none of this is required?QuoteI assume that's because the bulb's load on the panel made the voltage collapse, so the actual power was well below what MPP would have produced. But a battery is not a bulb. A battery will not draw current from the panel in such a way that would drop the panel voltage below the battery voltage. So voltage won't collapse until it's dark. That's assuming the OC voltage of the panel is only moderately higher than the battery voltage. Something like a 5V panel for single cell lithium, or maybe 6V. What Julian should have compared is the battery charging performance of MPPT vs linear. MPPT would be better of course, but I don't think by much.

author: Peabody
author_rank: Super Contributor
timestamp: March 01, 2023, 10:24:37 pm
content: Quote from: MrAl on March 01, 2023, 08:03:09 pmA total and complete waste? Can you explain why this is the case? I have a TP4056 charger powered by a 5V panel that seems to work quite well on an 18650. Little did I know that it shouldn't be working at all.

author: paulca
author_rank: Super Contributor
timestamp: March 01, 2023, 10:33:05 pm
content: Quote from: Peabody on March 01, 2023, 10:20:30 pmThe constant current phase is just a current LIMIT phase. Most generic 18650s it's ill advised to charge them more than 1A or 1/2C. So almost all single cell chargers default to 800mA - 1.2A range as current limit.If you charge a lithium ion cell with a bench PSU and don't set a current limit it will probably go bang. If you set a current limit then it will behave exactly like a CCCV charger. Just set it to 4.20V, max current 1A and it will charge your cell. When it's consuming a consistently small amount of current it's done.On linear. If you actually watch his videos he uses a rack of car brake light bulbs as a load on a much larger panel and does indeed compare like for like and apples for oranges.Direct load < Direct Battery < Linear < PWM < MPPT basically.In the specific case of a 5V panel, assuming we mean a MPP of 5V. Well it's only going to be able to produce any current into the battery in direct sunlight. If it's cloudy and the power point moves down to 4.5V you start to run out of voltage to anything with.If you put a DC/DC converter in there however, you can let the panel go down below the battery voltage if that is where it's peak power is assuming buck/boost.Most larger scale MPPT systems do not use boost, they just assume you will have far, far more panel voltage than batteries. Mine will not support 24V batteries on a 12V panel.

author: Peabody
author_rank: Super Contributor
timestamp: March 01, 2023, 11:12:27 pm
content: Quote from: paulca on March 01, 2023, 10:33:05 pm"It's done" means you terminate charging at that point, which is what all commercial lithium chargers do automatically. But if you're using a power supply to charge, unless you do something you'll continue to apply 4.2V to a fully charged lithium battery. Everything I read says you shouldn't do that. But Big Clive says this is a myth, so maybe what I see elsewhere is wrong.QuoteNo, the panel will supply as much current as it can at the battery voltage, even in lower light, as long as the battery voltage is below the panel's OC voltage at that point. That may not provide much current, but neither will MPPT in that situation.

author: MrAl
author_rank: Super Contributor
timestamp: March 02, 2023, 09:20:37 am
content: Quote from: paulca on March 01, 2023, 08:47:44 pmI thought i made it clear how this works. The panel acts more like a constant current source and this is interesting because when we charge batteries the batteries get charged due to current not voltage, as long as we have enough voltage to begin with, and we always have that with a solar panel except maybe at night.If you apply 1 amp for 1 hour you have charged the battery by 1 ampere hour. 1 amp for 2 hours is 2 ampere hours, etc.This does not matter if the battery voltage is 2v, 5v, 10v, 12v, 14v, with a panel that can put out something like 21 volts open circuit.So you should be able to see that the MAIN metric is current, not voltage, and not power. It is interesting that power is secondary too.Since current is power divided by voltage, the more power we have the more current we have for similar voltage levels. But the power does not magically transform into more current unless we have a switching converter that is of high enough efficiency to convert that power into a higher current at lower voltage. This is why the converter efficiency is so important. So we cant just say that more power charges the battery faster, that's just a general rule. We have to dig into the workings of how it does that, and when we do that we find out that the converter has to be of a high enough efficiency to make a significant difference. This also means that we can not go by the 'ideal' conditions of 100 percent efficiency or else we get misled into thinking that ANY converter will give us more charge current.There is also the distinction between what a charge controller is, what a max power point tracker is, and what a charge controller with max power point tracking is. Those are three different types of devices.A charge controller JUST controls the maximum charge that the battery will get.A max power point tracker tries to convert the power from the array into a form of power that matches the voltage of the device so that it can transfer maximum power from the array to the battery which really says maximum current to the battery.The two together will both try to maintain max power when possible (not always possible either) and also not over charge the battery.The main issue though is the converter. We have to multiply the INPUT power from the array by the converter efficiency to get the OUTPUT power.If we have 100 watts from the array and an 80 percent efficient converter, the output power is only 80 watts. That 80 watts is then in a form that is matched better to the battery than the raw array or the raw array with a series diode. That 80 watts however, may be low enough to make max power point tracking more or less moot. If we had a converter that can do 90 percent though, it may be significant so may be worth doing.It doesnt take much to look into this and understand it better. Just do some testing.

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 09:24:18 am
content: Quote from: Peabody on March 01, 2023, 11:12:27 pmThe MPPT stands a chance. Simply because the panel voltage is not coupled to the battery voltage and can be whatever it wants (assuming boost/buck). With the right alogrithm the panel will move to 4.5V and produce several times more power, if the output power is 5V boost it to 5V.A brilliant analogy for an MPPT charge controller is a gearbox.On peaking cells. This happens all the time for hours in multi-cell packs. Some cell or cells will reach 4.20V before the others. Only a really stupid controller stops charging when one cell peaks. The vaste majority of them slap a 100R resistor across the 4.20V cell and continue to push current into it while the others charge.

author: MrAl
author_rank: Super Contributor
timestamp: March 02, 2023, 09:25:41 am
content: Quote from: Peabody on March 01, 2023, 10:24:37 pmHello,What i meant was it is a waste when compared to a charge controller with a converter circuit like a buck converter.That's because a linear regulator consumes a lot a lot a lot of power because of the overhead voltage, in most cases because it is not a true power converter it just drops voltage.For example, with a linear regulator if you had 20 volts input and 10 volts output and 1 amp current, the regulator would be consuming 10 watts of power. Since the input is 20 volts at 1 amp which is 20 watts, that would mean the regulator would be just 50 percent efficient.If you use a buck converter at 80 percent efficiency, you would only lose about 20 percent of the power. The buck converter is a true power converter.There is one condition where a linear may beat a switcher, but that's only when the voltages are already matched closely. For example, 11 volts input and 10 volts output, only 1 watt wasted with a 1 amp current level.

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 09:26:56 am
content: Quote from: MrAl on March 02, 2023, 09:20:37 amI stopped reading here. Please re-read this and check yourself.

author: MrAl
author_rank: Super Contributor
timestamp: March 02, 2023, 09:36:50 am
content: Quote from: paulca on March 01, 2023, 08:47:44 pmI tried to make it clear that MPPT does not alway mean faster battery charging but you seem to be getting some info from some place that is misleading or something. The MPPT will only help when you have a MPPT'er that has high enough efficiency because if it is too low you lose power with the MPPT'er itself. The converter is the main issue. An 80 percent efficient converter only allows 80 percent of the power through. That could mean you get almost the same current into the battery as you get with a diode. The insolation level mostly affects the current.Here is where you seem to be led astray:"Why would you want to take the 2 amps at 13.6 volts when you can have it at 17V? I mean it's only 40% more power."Nobody in their right mind would want that condition to prevail. But that is in the IDEAL case which NEVER occurs in real life practice because the CONVERTER is in the circuit ALSO.You got 2 amps at 13.6 volts (fine) and you are assuming 2 amps at 17 volts, but that's not how it works. It is 2 amps at 17 volts MULTIPLIED by the converter efficiency. That's where the converter efficiency kicks in.So now do the same calculation but include the converter efficiency and you will see exactly how this works in the real world.There is also one more issue and that is what the battery ampere hour rating is versus the array panel power rating is or short circuit current rating is. If you have more power from the array than you need, it makes no sense at all to have any MPPT'er at all no matter how efficient it is. That's a separate issue though maybe we should not get into that right now.Does this all make more sense now?Also please note that many web sites are going to be talking in terms of IDEAL conditions just to provide a BASIC understanding of how the panels work and what to expect. It is reasonable to think about these things in terms of ideal conditions because that is important from a theoretical standpoint. If someone tomorrow came out with a 99.999 percent converter we would all want one i think along with a MPPT'er. But for now the ideal case just allows us to understand the workings on a basic level. To know what we would get in real life we have to figure in all the details and that changes things by quite a bit.Also some web sites are selling products AND providing what they call educational content when really their main goal is to sell products like solar panels. I was surprised when i looked around the web for solar panels all the information was very very very misleading, quoting figures that nobody would ever see.I would not be surprised to see the same thing on web sites selling MPPT'ers too but i havent looked for that yet. If i did need one i would probably design it myself and include a special design for the converter to get super high efficiency. When i worked in the industry i had to do this for a living.

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 09:37:57 am
content: On "information, out there" on Lithium batteries. A very nice person wrote a very long and detailed website about battery chemistry and charging way back in the early 2000s. It's been the top google result for decades now.It's full of nonesense and inaccuracies. It publishes data from a study which isn't referenced, but has now propogated through neverly every RC and electronics forum and nobody has been able to reproduce their results. It would seem the data may have come from a single lithium cell vendors datasheet back in the 1990s. That study was on storage states and temperatures and claimed if you left a lithium ion battery full charged at room temp it would loose 5% capacity in a week or some non-sense. Maybe, maybe for that particular cell back in 1998.It's been debunking in many finer details many times on here for example.Battery University. That's the one.

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 09:45:20 am
content: 80% is a worst case. I can cherry pick the other way and state the "maximum" efficiency figure of 98%, which granted is most likely when it's 100% duty cycle.There are conditions where a panel, if pulled at the wrong voltage will produce 10% or less of what it's capable of.I know this thread is about a single cell bench project, but my familiarity is more in dealing with much bigger panels, mutlicell battery packs and a panel will enough voltage to set my lithium pack on fire. The difference between running the panel at 10A and 12V versus 10A at 33V is more significant losses. When a cloud rolls over and the panel MPP drops to 30V, it might still produce 300W, but at 33V it might only produce 50W.In fairness and bringing it back to "this" projects scope, a single lithium cell with a suitable protection circuit could be matched fairly well to a panel and the efficiency increases you will get with an MPPT setup will be minimal and may even disappear with efficiency of the buck.But it's just a prototype. Many things dont work at lab scale.

author: MrAl
author_rank: Super Contributor
timestamp: March 02, 2023, 09:53:28 am
content: Hello again,I should note that i have problems with shading too and even worse, cloud cover.This week where i live very little sun the whole week so barely any battery charging. That's a bitch and that's probably going to be my main problem now and in the future because we have cloudy days and that's just the way it is. With full sun i get really good charging, but with clouds i get nearly nothing, or very little. I guess it is better than nothing, but not by much.

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 10:05:16 am
content: It's not hard to spot blue sky versus patchy versus dead overcast.The panel is in a south facing garden, but has the house on the east and a hedge on the west is is thus heavily impacted by the azimuth of peak solar day and in February at 55*N, that's not that high. It does better in June/July when it gets about 6 hours. 44W from a 50W panel in Feb is pretty epic. I've seen it hit 53W before.This is the last day that 50W panel serves me.Poor thing been online for 6 years or so now ). 330W panel goes out today. Got a nice bright but cloudy day to swap it.

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 10:12:29 am
content: On topic. Those spikes on the graph from my EPEver controller. They look like it's probing every hour or so. Seems to be setting the duty cycle to 0 for a short period and testing what the open circuit voltage is on the panel.I'm curious as to why it's doing that. I can see, on the cloudy shaded portions it isn't able to do much MPPT'ing. It's gone 100% DC and coupled the two because there is sod all power anyway and the battery won't take it at panel voltage anyway. Maybe it periodically resets to 0% and retrains, just in case it gets stuck on the wrong side of the corner or something.This will of course all change today when a 33V panel replaces it. Connected to a 14.40V battery, well, it's not going to be sitting at battery voltage much after dawn I assume. I'll soon see.EDIT: Putting matched loads asides, when you have no choice but to buck the panel down to the battery voltage anyway, I'm going to suggest that direct PWM is worse than MPPT.

author: Peabody
author_rank: Super Contributor
timestamp: March 02, 2023, 02:57:16 pm
content: Quote from: MrAl on March 02, 2023, 09:25:41 amI agree that it makes no sense to use a linear charger when the panel voltage is far in excess of the battery voltage. But there's no requirement for such excess. Instead of whatever series configuration you're using to get the 20V, you can rearrange them in parallel and get 10V. In low light, the 10V panels will provide as much current as they can at just above the battery voltage (30mV above in the case of the TP4056) so long as the battery voltage isn't above the panels' OC voltage. In full sun, the charger will dissipate some power, but you probably have excess power anyway, so MPPT may not provide much advantage in terms of actually charging the battery.Could you clear up something for me regarding MPPT? If you have a switching circuit to keep the panel at the MPP, don't you need another switching circuit to charge the battery? It seems to me that one switcher can't keep both the input and the output at the right places. You have to have two power conversions for it to work. Is that right, or have I misunderstood?

author: paulca
author_rank: Super Contributor
timestamp: March 02, 2023, 04:39:59 pm
content: Quote from: Peabody on March 02, 2023, 02:57:16 pmInput power = Output power. So all the MPPT has to do is hunt for the maximum output power.I have heard of dual conversion MPPT but only briefly, I believe it may have a purpose in micro-invertors or something.Which is apparently the modern way now for full grid tie roof systems. Each panel or parrallel pair if your cheap has an MPPT micro-invertor on the back. Each panel tracks it's own power point, converts it to AC and then competes for current on the main bus. That makes routing high current low voltage DC around the roof a thing of the past. The high voltage AC comes to the "controller" where it's conditioned and synced to mains etc. At least this is my understanding. They have had "per panel" MPPT convertors for quite a while and it might be here dual conversion is required, because it needs to PUSH voltage onto the common line to get it's current accepted, while at the same time keeping the panel sweat.

author: MrAl
author_rank: Super Contributor
timestamp: March 03, 2023, 11:57:26 am
content: Quote from: Peabody on March 02, 2023, 02:57:16 pmHi there,Well when we design something with a switching regulator it usually means we are after efficiency so we try to do everything with just one switching circuit.Just to think about using a MPPT circuit combined with a separate charge controller, imagine that the MPPT is at 100 watts and the charge controller is only allowing 70 watts for the battery charging. Where does that remaining 30 watts go. It has no place to go. That would mean that to have the MPPT at 100 watts and the battery taking in 70 watts would be an impossible condition without resorting to having a separate load to dissipate that extra 30 watts.What this would mean is that the MPPT'er could not keep the array at the MPP any longer. That's not hard to imagine because we might want an array that is big enough to supply enough power during lower sunlight levels but be able to cut it back during full sunlight, which would allow enough power for a longer portion of the day.The MPPT'er can only maintain the max power when it has a load that can absorb that power. In a line tied application it is assumed that the line has low enough impedance that it can take any power the MPPT'er can provide, and the system would be designed with some absolute max power level like 1000 watts or something.The best solution then is to design a MPPT'er that can both follow the MPP when the battery can take the full power and regulate it down (and go off the MPP) when the battery cant take the full power. Obviously the two extremes would be when the battery is fully depleted (MPPT'er provides fully power) and when the battery is completely charged (MPPT'er provides trickle charge which would be very low power).The system i used back in the 1980's was very high power but that was not my panel that was owned by Sandia Labs. The one i use now is only 20 watts (ha ha) so it never over charges the 12v lead acid battery which has a rating of something like 60 ampere hours, and we dont seem to get constant sunlight over several days around here either.

author: paulca
author_rank: Super Contributor
timestamp: March 03, 2023, 03:43:45 pm
content: The annoying thing holding me back here, asides playing with the new "real sized" panel.... I don't have a single p-channel mosfet. Have to order some.

author: paulca
author_rank: Super Contributor
timestamp: March 03, 2023, 05:31:07 pm
content: So the first test with the panel using a lowside N channel and a 220uH inductor a BS170 mosfet ... emm... I'm just left confused. All the voltages are so alike, it's hard to tell what is actually happening.I think the low side switching makes the topology hard to debug as well. Especially when you have a panel on one side and a battery on the other, two atypical components for the basic buck.In the end I couldn't see the slightest difference between 0% duty cycle and 100% duty cycle. Suggesting the circuit was wrong.I'll regroup tomorrow. Focus on just a buck convertor with a static R load and a fixed 6V input. If I can confirm that is working then I can swap the output for hte battery and check I can do a manual charge voltage control.... then and only then add the panel to the mix and see what happens.I haven't even bothered with MCU PWM yet, I'm just using a signal generator. The MCU PWM would require an NPN to allow it to use the panel system voltage to switch the mosfet. Hopefully the PChannel highside mosfet is easier. I'm not sure.

author: paulca
author_rank: Super Contributor
timestamp: March 03, 2023, 05:44:17 pm
content: Right, I figured out one problem that makes it difficult to measure. The low side switching topology is floating. My scope isn't. So I can't make any measurements within the floating topology without collapsing it. Not without differential probes.I can only put my probes either the output ground, the input ground and get different results, but I can't put it in the middle, say across the load as that will pull the Drain to ground.Sometimes you set out to make a circuit and it works. Other times it seems someone has left all the hurdles out for you to play wiht first.

author: MrAl
author_rank: Super Contributor
timestamp: March 04, 2023, 09:05:09 am
content: Quote from: paulca on March 03, 2023, 05:44:17 pmHi,What do you mean your scope is not floating? Is this circuit plugged into the same power line as the scope?I would think you should be able to measure across the load. I've done this before. As long as you dont have the other probe (2 channel scope) ground connected to an actual circuit ground you should be ok. Just start with only one probe.

author: Peabody
author_rank: Super Contributor
timestamp: March 04, 2023, 05:55:38 pm
content: So if you have an MPPT buck converter, you can just dump the output into the battery. The battery voltage sets the output voltage, and whatever current makes the input and output power equivalent becomes the charging current. But if you have a charge current maximum, or you need to switch to constant voltage for lithium, or you need to back off to trickle charge with lead-acid, then you make adjustments that take you off the MPP. And I guess the reason for using high-voltage panels is just so a buck converter can be used for any usable power level, which is most efficient.I think it's still an open question on small systems whether using carefully selected panels in a linear system would provide significantly worse performance than MPPT. It probably would on the margin - a string of cloudy days. But it would be interesting to see a formal test.

author: MrAl
author_rank: Super Contributor
timestamp: March 05, 2023, 05:53:52 pm
content: Quote from: Peabody on March 04, 2023, 05:55:38 pmHi,Well in theory if the source voltage closely matches the target voltage then the linear may actually be better than a switcher that works at 90 percent which is considered pretty good.You can run some numbers to get an idea how this works. Using whatever load you want and trying a few different source voltages.Here's quick example...If we had a 100 volt source and 12 volt load, the buck would win even if not too efficiency (80 percent).If we had a 12.1v source and 12 volt load and the linear dropped 0.1 volt while regulating, the efficiency would be slightly over 99 percent, which is better than any buck i've ever seen.Those are two extremes, so something in between would be similar we'd just have to know the source voltage and load voltage levels and the efficiency of the buck.Maybe it would be possible to add an automatic switch that switches out the buck and switches in the linear at times when the source voltage closely matches the load voltage. For that example above we could have the buck working at 100v down to maybe 15 volts or whatever it works out to, then switch out the buck and switch in the linear, then for even lower voltage maybe switch that out and just short the connection with a relay or something. That would cover all the bases i think.

author: paulca
author_rank: Super Contributor
timestamp: March 05, 2023, 06:25:25 pm
content: On MPP, I want to re-iterate, it moves. It moves quite a bit. Depending on where the sun is on the panel to how hazey or cloudy it is. Whatever way you use to "match" your stuff to it's MPP is futile when the MPP moves 2V in cloudy weather.On dropping back to linear (or PWM) conversion when buck would be inefficient... What happens when you set the duty cycle to 100% on a normal buck?Assuming you drive the mosfet on hard enough all you get is a saturated inductor in series with a mili-ohm RDS of the mosfet. Which if charge controller spec sheets are anything to go by is about 98-99% efficient. It's not converting anything, but it's given a linear connection to the battery. The system voltage versus the panel voltage has an impact here. My system is happy to hold a 33V panel down to battery voltage of 13.4V when there is no sun. I wonder would it do the same for 3x33V panels in series?This is exactly what MPPT charge controllers do, they not only test where the maximum power point is, but whether it's more efficient than just connecting straight to the battery.I got the buck working. Found a little bit extra power. From 78mW @100% up to 102mW@ 25.5% duty cycle. However I couldn't measure both sides at the same time due to the lowside mosfet and the 3 channel current/voltage monitor (INA3221) not liking multiple grounds. Those measurements where measuring just the panel. At 100% duty cycle the voltage was battery voltage, 3.6V, a little higher than it's resting of 3.55V. At 25.5% the panel was at 5.7V.I need to measure both sides to get efficiency.However, I am starting to agree, that in the case of 6V panel and a 4.2V lipo, MPPT is not really going to help much. What might be more plausible is a basic PWM+Cap voltage limiter.I've decided to regroup for the MPPT experiments by widening the voltage range and mixing things up a bit. A 12V 3Watt panel and some super-capacitors. That should make MPPT play much easier.

author: Peabody
author_rank: Super Contributor
timestamp: March 05, 2023, 08:30:42 pm
content: Well as of now the schematic below is *my* first solar charge controller, complete with a load sharing (power path) circuit. All hobbyist-friendly parts. :-) The panel is nominally 5V, 2.5W, with maximum OC voltage around 5.7V. The TP4056 is set to charge at 1A, but the panel will only do about half that. However, I have another panel that I could parallel if needed.This actually works quite well. Depending on load current demands and battery charge status, the panel might not be particularly close to the MPP, but panel voltage will never be lower than the battery voltage plus one schottky diode drop. So the voltage will never collapse except at night, which limits the divergence from the MPP.The opamp turns on the mosfet if the output voltage is ever below the battery voltage. It's basically just a comparator, with a little feedback to make sure any input offset voltage doesn't mess things up.Of course this is for one 18650. With cells in series, things might need to be a lot different.Edit: Found this MPPT "reference design" at TI:https://www.ti.com/tool/TIDA-010042

author: MrAl
author_rank: Super Contributor
timestamp: March 06, 2023, 11:13:37 am
content: Quote from: paulca on March 05, 2023, 06:25:25 pmIt depends on which buck circuit you use.What always bugged me was that some of the single chip buck converters used bipolars and they always drop voltage, and at higher currents even more. Always wished they would upgrade the designs so they would be much higher efficiency. Maybe somebody did by now that was several years ago.

author: MrAl
author_rank: Super Contributor
timestamp: March 06, 2023, 11:19:12 am
content: Quote from: Peabody on March 05, 2023, 08:30:42 pmThat looks interesting.

author: paulca
author_rank: Super Contributor
timestamp: March 06, 2023, 12:44:05 pm
content: Quote from: Peabody on March 05, 2023, 08:30:42 pmYea, that is the kind of thing I was going for.A point to note. They derive their VCC_10V for mosfet gates and VDD_3v3 from the panel, not the battery. So unless that buck convertor goes short with no diodes at night or the entire thing switches off. Not exactly desirably considering it requires VCC_V10 to connect/disconnect the load.Given it's TI, it will either state it shuts down or it will state how the system power is provided at night.It's an interesting question as it does create some dilemas when trying to run the charge controller off the battery it's charging.

author: Peabody
author_rank: Super Contributor
timestamp: March 06, 2023, 01:48:15 pm
content: Yeah, it doesn't show in the block diagram, but Section 2.2 says:"To power the system, a switching regulator (LM5009) is used to step down either the panel or battery voltage, whichever is greater, to 10 V for the gate drivers. From the 10 V, a low-dropout (LDO) regulator (TLV70433) is used to regulate a 3.3-V line for the rest of the components."Edit: It can say that, but I don't see it in the actual schematic. Looks like the circuit is powered from P+, which I assume is the panel.https://www.ti.com/lit/pdf/tidryu8

author: paulca
author_rank: Super Contributor
timestamp: March 07, 2023, 10:07:04 am
content: I got a setup working with both sides measured. It's not efficient, but it does work when I manually adjust the duty cycle. Still only a little more than 100mW indoors with the LED lights.On efficiency. To me it doesn't actually matter what the efficiency number is. If with one setup the panel is putting 80mW into the battery and in another it's putting 100mW into the battery, it doesn't mater if the later is less efficient in terms of what the panel is producing, because the bottom line is, you are getting more power anyway. 80mW of 99% efficient power is still less power than 100mW at 80% efficiency.Bizarre things and a few jumps....I thought I'd have a go with a large capacitor instead of a battery. Figuring a 1000uF cap on the output, I could measure it rising/failing and quickly discharge it and repeat.The first odd thing was the voltage that was being read across the cap. On the INA3221 it was reading pretty much the same as the input voltage. However my multi-meter was reading 0.45V across the cap. INA3221 bus voltage said 5.32V same as the panel. I found if I brought the duty cycle right back to nearly 0 the voltage as measured by the IN3221 would fall and match the actual cap voltge, but as soon as I raised the duty cycle it jumped up to panel voltage again.My suspicion here is that the V sense of the INA3221 is seeing a whole load of noise on the output from the inductor and is ending up taking a far higher peaking off peaks than a proper average. Baffled.I also figured that capacitors suck as a load. So I put a 1K resistor across the cap and that made everything work far, far more sanely.The other downside was discovered while fiddling with the mosfet gate and no load across the cap I measured -31V across the cap. Decided not to figure out how, but to discharge it quickly. It didn't even occur to me that a 1000uF cap charged to what I really suspected was a false reading and only about 5V... can be quite nasty. So when I stuck the meter probe across the pins I nearly leapt out of my seat when "CRACK!" it arced across the probe with a blue flash. Doh! Scare the knickers off me, wasn't expecting it some how.So, figuring I can't be trusted with high value caps I reduced both the panel input and 'battery' output caps to 100uF and it pretty much works.Next I need to figure out how to pull the 6V+ panel voltage to ground safely with an MCU. I'm figuring just a pull up on the gate and an NPN to ground gated by the MCU. I'm sure there are issues with that somewhere though, like the voltage drop over the NPN of 0.6V.The next weirdness was that the measurements were "out" at one point, quite a bit out. Voltage was 0.2V higher that it should be. Turns out, having the scope connected to the breadboard ground created a 0.2V drop across the breadboard ground rail. I can only assume there is current flowing on that ground, but 0.2V drop through a breadboard rail? There shouldn't be anything like that. I localised the drop to between the diode ground and the scope ground. The scope was "seeing" the 0.2V higher than actual. I removed teh scope ground and everything went back to accurate. Bizarre.

author: paulca
author_rank: Super Contributor
timestamp: March 07, 2023, 10:39:30 am
content: What Im basically working with at the moment.

author: paulca
author_rank: Super Contributor
timestamp: March 07, 2023, 01:58:00 pm
content: Still on the signal gen for now, but I have got the 6V, 1Watt panel in direct sunlight today!As you can see, while the buck allows the "panel" to hit it's MPP, however the efficiency of my buck converter at that point is diabolical around 75% so it nets almost exactly 0 benefit as you can see. The maximum output to battery is about 850mW, while the panel will do just over 1W.

author: paulca
author_rank: Super Contributor
timestamp: March 09, 2023, 08:41:16 am
content: Next steps are adding the MCU to control the buck convertor rather than the siggen.I left the device running last night, with the LED for the TFT screen on a push button so it's not consuming power constantly.The good news is... it's still running this morning at 3.45V on the cell and the sun it coming out. It only used about 0.2V of the cell with no power saving.I don't think this prototype will be able to sustain itself. The issue it the buck efficiency. I can wind the 12V panel up to it's MPP, say 1.5W. But I only have about 700mW going into the battery and a rather hot mosfet and diode. It looks like at higher power it's actually dropping voltage across the mosfet. It's not exactly surprising though, it's using "hmmm, that'll do" components on a breadboard.I might give it a go with a cheap buck module off amazon to see if that's any better.The plan for the MCU is to use a little low power micro, the STM32L432 I have. It will wake up, check the panel voltage and if it's low, go back to sleep. When it wakes and sees the panel voltage rising to a predetermined trigger point it will begin test MPPT scans. When it finds the max MPP of the panel going to the battery it will compare it with the direct link to battery and revert to that if it's more efficient. It will repeat that test periodically through the day. If solar insulation drops low enough, it will directly connect the panel and battery and go to sleep. The idea is, when the sun is shining and pulsing the mosfet has an advantage it can be awake and working. If pulsing the mosfet is not advantagous it can go back to sleep. Obviously it's also monitoring the pack voltage, so even if the panel is directly connected to the battery, if the battery hits it's max volts the mosfet PWM will resume to maintain no more than MAX V on the pack.

author: Peabody
author_rank: Super Contributor
timestamp: March 09, 2023, 03:40:11 pm
content: Quote from: paulca on March 09, 2023, 08:41:16 amRemember that with no load, the panel voltage will rise to its full open circuit voltage for the current level of sunlight. But that doesn't mean it could supply any significant current. So I don't think checking panel voltage will tell you much. It will always be high with no load, unless it's dark. And if the mosfet is on, panel voltage will be at the battery voltage.But if the mosfet is switched on, the panel would be contributing whatever current it can at the battery voltage. Perhaps you could measure that current, and at some point see if turning on the buck converter increases that current.As for efficiency, as you suggested, your mosfet gate drive is a bit "how ya doin", as Dave would say. It looks like it wouldn't turn off very fast with that pullup resistor. I don't know how this is typically handled when the MCU voltage is lower than the switched rail. Maybe an official gate driver chip. Then there's the question of PWM frequency. You might see what effect changing it has on efficiency.

author: paulca
author_rank: Super Contributor
timestamp: March 10, 2023, 02:17:20 pm
content: So considering a different tact.I'm going off on a tangent of using an off the shelf buck converter and injecting the feedback voltage from the MCU DAC.The first hurdle for that is working out the resistor network values for the 3 point. There is a PDF application note out there from Analog maybe that has all the calculations in it. I can work through through those.The basic ideal is you add a 3rd resistor at the mid point of the feedback divider, which if left floating will be at minimum voltage as set by the divider. However if the MCU applies a voltage to the 3rd resistor it can push the voltage up or down. I need to follow through those calculations and the exact intent. In LTSpice I can see an equal or lower value than R1 for R3 gives R3 nearly full control of the divider mid point voltage and the divider is ignored. Raising that value however does start to lower control the R3 input has. I'm not sure if they intend the MCU input to take full control of the feedback voltage and thus produce the "nominal" voltage, say 800mV and nudge it up and down or whether they want a much wider voltage range from the MCU DAC to influence the voltage divider with less impetus. To me it seems the later would be more stable and require less precision from the dac.

author: paulca
author_rank: Super Contributor
timestamp: March 10, 2023, 02:21:41 pm
content: On panel voltage detection. Using a buck converter in IC form tends to come with a minimum Vcc, for running the IC itself. I have seen some frightening behaviour of boost convertors when you violate than minimum.The same paper I mentioned above also covers the safety circuit I was considering. A zenner diode +resistor from Vcc to energise an NPN transistor and put voltage on the "Enable" pin. If the Vcc (panel in my case) voltage drops below the zenner voltage it stops conducting, the NPN pulls to ground and the Enable pin goes low. The buck turns off before there is an issue. This will be required in hardware as an interlock.

author: Peabody
author_rank: Super Contributor
timestamp: March 10, 2023, 04:56:20 pm
content: But when you turn off the buck, won't the voltage go back high? Won't it oscillate?

author: paulca
author_rank: Super Contributor
timestamp: March 10, 2023, 05:25:18 pm
content: Quote from: Peabody on March 10, 2023, 04:56:20 pmIt probably would yes. I could slow that down with caps, or make it "AND" with the MCU. The MCU says ON (knowing the voltage) AND the zenner diode is conducting. Making the zenner just a safety cut out.The buck turning on and off, one and off, isn't really big issue, it's basically PWM. However, when testing a buck/boost converter at 4V it was perfectly stable. At 3.8V it went nuts and slammed the output voltage to -32V when it was actually set to +12. It's that kind of response I have to avoid, hence hardware lock out.

author: paulca
author_rank: Super Contributor
timestamp: March 10, 2023, 06:23:48 pm
content: This tech note/white paper.https://www.analog.com/en/technical-articles/digital-adjustment-of-dcdc-converter-output-voltage-in-portable-applications.htmlThe safety undervolt lock out isn't in there, might be in one of the datasheets for the buck ICs. Anyway I'm sure it's a fairly standard voltage supervisor circuit.Haven't read, just found this also:https://www.ijert.org/research/digital-control-of-dc-dc-buck-converter-IJERTV1IS7038.pdfSeems there are also quite a lot of master's and doctrate thesis(es?) on the topic, but with various flavours of application area.