MPPT noise reduction and Blog - Page 1
Forum section: electronics / general

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 04, 2017, 06:31:56 pm
content: I have noticed my MPPT code not always tracking very well, it runs on a PIC16LF1782. I think I have concluded it's getting confused by noise in the ADC readings for input current and voltage originating in the associated boost converter. I have tried many things like analogue filtering but without many poles (steep rolloff) it's difficult to get much improvement. I have an idea of using oversampling together with averaging as that's quite easy to do for binary modulo's like 8, 16 etc the theory being the signal will sum in the time domain but not the noise (being random) hence the result should have an improved SNR. Has anybody heard of this technique in this or similar situations or have any other idea's ?

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: June 05, 2017, 01:18:36 am
content: Measure the ADC input voltage with a DSO and then you can be sure if noise is a problemSchematics, Code, pcb, photos and measurements can all help people to give better advice.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 07:45:50 am
content: You are quite right, the scope shot shows what happens in low light conditions, the MPPT is switching the duty cycle between nothing and something small but the PWM EMC swamps the current signal, the scope probe connection is not good so some EMC is entering that way.As the picture shows the construction is less than ideal being stripboard though efforts have been made to limit lengths and bulk up high current connections with bare copper wire soldered along pairs of strips.In the schematics U1 is the current amp sensing across an 0R01 resistor in the PV return leg. Missing from the schematic is a 1nF/56R snubber across the mosfet and also a 15R resistor in series with the gate to soften the mosfet a little.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: June 05, 2017, 08:41:02 am
content: Yes it can be hard to probe without noise from the high impedance probes.Short the probe tip to its ground lead and then touch the circuit to see how much is induced by the probes.The most obvious things to check/ change IMO.are you using Kelvin connections to the op amp? You should and even twist them.ground bounce, star ground, analogue ground. IOW could the ground be improved.can you use a current sense amp? At least u have rail to rail In and out which you will need.larger current sense resistor. @ 1 kw I think you can afford a little more drop across the current sense resistor.25 mV input if that is a full power you probably want more like Vref/2 whatever that is.Hope that helps.

author: capt bullshot
author_rank: Super Contributor
timestamp: June 05, 2017, 08:50:13 am
content: First, I'd recommend not to connect U1's output directly to the ADC input. Place a series resistor (range 10R to 470R) and a capacitor as close as possible from the ADC input to ADC GND (10nF should do the job). You should use the capacitor to GND on every ADC input, it helps filtering and it also helps to charge the ADC input sampling capacitor.And yes, oversampling and averaging can do a good job in reducing noise, I've done such things (oversampling and averaging) successfully before.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 09:57:40 am
content: Quote from: HackedFridgeMagnet on June 05, 2017, 08:41:02 amYes quite a bit, I have to subtract in my mind when looking at the scope! I am thinking of flux-strapping the inductor as I have found this technique useful in other projects, unfortunately it got omitted and it's impossible to do in situ so awaiting heightened desperation level!Quote from: HackedFridgeMagnet on June 05, 2017, 08:41:02 amThats a very good idea, at the moment the only ground for the controller is from close to R1 to close to U1 but of course that carries psu and mosfet driver noise too. I shall certainly try moving the connection of U1/3 by a separate wire to R1 (twisted of course).Quote from: HackedFridgeMagnet on June 05, 2017, 08:41:02 amYes you are right I think I erred on the side of efficiency a little to much, going up to 0R022 is still just within the capacity of a 2.5W resistor.Thank you for your insight

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 10:02:37 am
content: Quote from: capt bullshot on June 05, 2017, 08:50:13 amAhh I had that in mind but like the flux strap its not possible to do in situ, so thats two reasons for a return to the workshop now!Quote from: capt bullshot on June 05, 2017, 08:50:13 amI haven't done it myself before so it's good to hear it's common practice, I am also considering reducing the resolution as it seems to high and is just another invitation to noise.

author: David Hess
author_rank: Super Contributor
timestamp: June 05, 2017, 10:19:39 am
content: Quote from: fourtytwo42 on June 04, 2017, 06:31:56 pmFiltering and proper grounding and layout are a good place to start. Also consider the reference input, ground, and power pins to be other ADC inputs.QuoteNoise is always a problem with non-sampling ADCs which are not integrating ADCs (1) and sampling ADCs. Taking multiple samples over a specific interval is an easy way to gain the noise immunity of an integrating ADC and yields a sin(x)/x frequency response which can be used to reject noise. Another way is to implement synchronous sampling where sampling occurs during a low noise point of the signal.One thing I would do with multiple samples is calculate the standard deviation to get a quantitative measurement of the noise. This will allow better evaluation of circuit changes for reducing noise.(1) Not all flash and successive approximation converters are sampling converters.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 10:32:37 am
content: Quote from: David Hess on June 05, 2017, 10:19:39 amSadly pretty tough on stripboard!Quote from: David Hess on June 05, 2017, 10:19:39 amIts an integrated sampling ADC (I think thats what you mean) and I do use synchronous sampling however part of the problem I believe maybe the noise is being added to the samples by integration within the low pass filters!Quote from: David Hess on June 05, 2017, 10:19:39 amUnfortunately I am limited by the arithmetic capability of an 8 bit risc processor programmed in assembler with very limited memory and no human readable io

author: David Hess
author_rank: Super Contributor
timestamp: June 05, 2017, 12:42:23 pm
content: Quote from: fourtytwo42 on June 05, 2017, 10:32:37 amThat is going to be a problem and may be enough to explain your poor results.QuoteAn integrated ADC is very different from an integrating ADC. The former means it is part of an integrated circuit with other functions like a microcontroller and the later means that the input signal is integrated over a defined period of time to make a measurement. Integrated ADCs often have problems with noise from the other circuits they are integrated with.What are you sampling synchronous to? The switching regulator clock?Making a measurement like an integrating ADC for lower noise using a sampling ADC means averaging multiple samples.QuoteThe standard deviation is also the root mean square; so you take the square root of the average (arithmetic mean) of the squares. It is a pretty small step from calculating the average of multiple samples to calculating the average and the standard deviation. On a small microcontroller, I would do it in parallel with the average calculation so the only extra memory requirement is another memory location for holding the sum and whatever scratch pad memory is needed for the square and square root operations.If I did not have any way to monitor what is going on, then I would add a display interface via a serial port like SPI or I2C.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 05, 2017, 01:11:26 pm
content: First rule of differencing algorithms: FILTER FILTER FILTER! (In analog or digital.)First rule of ADC inputs: FILTER FILTER FILTER!(In analog.)An MPPT has the advantage that the difference must be correlated, but to the extent that noise enters the correlation bandwidth (i.e., it acts like a radio tuned to a particular frequency, rather than just a straight (baseband) input -- and the radio has some bandwidth defined by your circuit and algorithm, and any noise within that bandwidth will be treated as signal). So, at the very least, you should be measuringmanysamples, perhaps hundreds per MPPT step, averaging them together; and the MPPT steps themselves, that are resolved by the algorithm, should be numerous, so you have a strong confidence interval in the resulting calculated derivative. (There are many derivative finding algorithms, based around finding the curvature of an arc segment, rather than the slope of a line as defined by two points -- these use more points, so more operating points are evaluated.)Higher SNR also allows you to use smaller perturbations in the first place, so that you average more time very, very close to the true peak.Tim

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 01:42:32 pm
content: Quote from: David Hess on June 05, 2017, 12:42:23 pmYup it was only ever a toe in the water and experiment so I have to live with that and work around it the best I can.Quote from: David Hess on June 05, 2017, 10:19:39 amI already do the latter and am now going to add the former.Quote from: David Hess on June 05, 2017, 10:19:39 amSorry I get confused with some nomenclature, it's integrated in the PIC, has a sample and hold and is successive approximation.Quote from: David Hess on June 05, 2017, 10:19:39 amWell presently I have a snapshot system that stores 256 samples of what I want to look at in EEPROM, it's limited but avoids the complexity of adding external connections and more logic, I agree however it would be superior.I hope I got all the quotes right

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 01:46:38 pm
content: Quote from: T3sl4co1l on June 05, 2017, 01:11:26 pmYes I think my primitive implementation was very weak taking only one sample per MPPT cycle, also I found the electrical noise environment much higher than I had expected. Hopefully by taking note of your combined experience I can build something better.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 01:50:53 pm
content: Just a note to say now it's off the wall and back on the bench I have decided to go the whole hog and change the topology to buck-boost to enable me to capture just a bit more in winter and dull daysThis of course means a total rebuild of both the hardware and software. I am very grateful for all your inputs and will incorporate them all BUT I will still be limited to stripboard construction! I might also note I have not been impressed by the ESR of the polypropylene capacitors so that may be another area for improvement. Many thanks again

author: David Hess
author_rank: Super Contributor
timestamp: June 05, 2017, 03:29:43 pm
content: Quote from: fourtytwo42 on June 05, 2017, 01:42:32 pmIf you pay attention to the ground and supply return currents and add wires and decoupling capacitors to reduce their loop area, then a lot of improvement is possible.http://www.analog.com/media/en/technical-documentation/application-notes/6001142869552014948960492698455131755584673020828AN_345.pdfhttp://www.analog.com/AN-347?doc=CN0397.pdf

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 05, 2017, 06:13:02 pm
content: Quote from: David Hess on June 05, 2017, 03:29:43 pmYup been there done that many times but the devil as they say is in the detail, timely reminder though, thank youOhh for a PCB!!!!!

author: Codebird
author_rank: Regular Contributor
timestamp: June 06, 2017, 07:34:22 am
content: QuoteSometimes the simplist means is the best.reading=(reading*0.95) + (getnewreading()*0.05);It's very very crude, but it got my MPPT tracker working.

author: David Hess
author_rank: Super Contributor
timestamp: June 06, 2017, 03:40:59 pm
content: Being primarily an analog guy it does not surprise me but there have been many simple analog designs for MPPT which implemented sampling and integration for free. They mostly predate the internet so finding references to them is difficult. The only problem they sometimes have is locking on to a local maximum but this is only an unimportant corner case which occurs when panels are shaded.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 07, 2017, 11:00:33 am
content: Quote from: David Hess on June 06, 2017, 03:40:59 pmYes I agree introducing digital sometimes means you end up chasing your tail trying to solve problems you just introduced notably using sampling within feedback loops and coping with the delays introduced! Certainly this is the case in certain types of power supply and amplifiers. I have seen analogue mppt's but the ones I recall were still using sample & hold techniques. I guess a well considered mixture of analogue and digital is best, I certainly don't hold with digital is king! Back in the 70's we used to design and manufacture analogue modems, they were expensive partly due to needing high precision components for repeatability but also the amount of select on test stuff. It took a long time for digital circuits to become powerful enough, I still remember the first 48 bit MAC chips from TRW fresh off the secrets list physically bigger than a modern BGA CPU chip and consuming over 10 watts!

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 10, 2017, 06:26:39 am
content: I took the plunge and rebuilt the converter, here are the power and cpu boards ready for bench test, the inductor now has a flux strap, the current amp has kelvin input connections and an RC connection to the ADC, there are heavier connections under the power board and common mode chokes on the power in and out. Hopefully this will combine to reduce noise along with some software changes such as oversampling/averaging and reduced resolution. A new feature has been incorporated a continuously variable PWM for the immersion heater enabling it to better match the panels mppt at low insolations, with some juggling it was possible to fit this on the existing heatsink. I was hoping to improve the ripple capacitors but there is insufficient space so just settled for an extra on the input squeezed under the inductor.Quite a bit of software to write now before testing can begin.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 11, 2017, 06:49:30 pm
content: This has become an ongoing rebuild blog, finished the software today, around 700 codewords of PIC16F assembly much of it of course from before but some major new extensions. Started some testing at moderate voltage input (15V) that seemed to revel an unexpected 500mV on an analogue input configured as the +input of an op-amp but leave that till later otherwise ok.Rest of day spent rebuilding and testing the APU (Aux Power Unit) this being a critical piece of solar technology, it produces a stable 12V rail for turning on the mosfets from any input between 12.1V & 170V, as it is capable of also powering a fan this is now a switcher (see pic). The old linear unit I used to use could keep an LVPIC alive down to a PV voltage of 2V, worked in moonlight but couldn't produce any useful power and certainly couldn't power a fan!I used to be an ultra efficient energy scraper that could power up in moonlight but sadly some things had to go upon entering the Kw plus range.Next up adding this module to the other two (power & cpu) then start high voltage testing (bench).

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 17, 2017, 08:19:52 am
content: Outside on the wall again, early 7am to catch the morning sun, bit of a false start with some leftover debug only code!! Picture shows the input voltage modulated by mppt at low power hence the high voltage swing, something to come back to maybe but its one way of keeping the noise out. This version also reduces efficiency to improve EMI, I can even use the scope and see the signals nowLast picture interesting bug in converter when transitioning from buck to boost mode around 600W, patience is rewarded!

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 17, 2017, 02:03:53 pm
content: Back on the bench again, BLOWN MOSFETSometimes I could give up but...................Removed the probes etc from this mornings session with PV breaker open for safety, screwed lid on box, PV breaker on then tidy gear away......after a while checked power meter Zilch! Ohh I thought forgot to turn it on, nooo check PV volts umm 2!! OMG breaker off, lid open, check, Boost mosfet short circuit, impossible!!Off the wall on the bench, boost mosfet definitely s/c hmmm why ??Well there is a nasty overvoltage mode in boost converters and it goes like this.....power is applied, current flows through boost inductor and boost diode to charge output capacitor/s. When output is charged, flux collapses and current reverses in the boost inductor just like at the end of a switching cycle BUT if there is no load on the output the voltage rises uncontrollably until either the inductor runs out of energy or something breaks down.The reason there is no load is all mosfets are prevented from turning on till there is sufficient voltage in the auxiliary supply to ensure they turn on properly and the software has completed a startup delay but the above failure sequence happens in the first 50-100uS. Most times it doesn't happen because the breaker is not used when the panels are generating lots of power.It's a hard one to fix as medium voltage mosfets with low rdson and low TQc are hard to find, I use IRFB4227's and sadly I have shot myself in the foot by being mechanically constrained to TO220. TVS devices capable of absorbing more avalanche than the mosfet have a wide voltage between breakdown and clamp voltages. The problem is self inflicted as there is really insufficient headroom between the intended maximum operating voltage and the mosfet vds.My compromise solution for now will be to reduce the maximum operating voltage a bit to allow a TVS to be used I am hoping a 1.5KE170A will be enough to protect the mosfet AND remembering to try not use the breaker when running at fairly high power.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 17, 2017, 07:58:51 pm
content: So add a voltage limit to the control...Here's an example how to do that:All the feedback stuff is at the bottom, feeding an error amp feeding an opto (the UC3842 controller is wired as a follower, so the opto sets the current setpoint). When any of the three conditions is exceeded (current, temperature or voltage), the setpoint is reduced. Note that the secondary thresholds are quite soft (the 2N3906s are used in common base configuration, with lots of resistance in the emitter circuit --> low gain), and everything is limited to a bounded range (i.e., the emitter resistance plus the collector resistors preventing them from driving the op-amp into hard saturation).It's not enough to simply say "if temperature > 100C, set current to 0". That will chatter like a motherfucker. Consider what that means: as long as temperature is high, turn it off completely; temperature had been rising in the first place, so presumably, this will last for a few cycles -- battle won, right? Well it'll cool down in the mean time, and then it's going to slam right back on again -- right back to 100% full power (or worse, your PID has saturated and it commands something else into saturation), right at maximum temperature. It oscillates with the thermal delay and time constant of the system.Most ICs do it by shutting down at a high temperature, and remaining off until temperature falls below a lower threshold (hysteresis). This gives a little reprieve from the high temperature, but changes it for thermal cycling, which still isn't good. In short: you need to avoid situations like this, and preferably solve it with an alternate method: the fault can be latched, waiting a much longer timeout period, or until power cycle or user reset*; or the power output can be reduced, so that temperature remains nominal.*With a timeout enforced on THAT, so the user can't simply spam the button until the thing explodes! Or, for that matter, holding it down. Nay, you need the button edge-triggered, so holding it down doesn't mean anything. Easily solved with a few resistors and capacitors, or logic gates, but easily overlooked!But that means changing your controller. Controlling temperature requires a much longer time constant than controlling voltage or MPPT. This is why the above circuit has such a soft threshold on temperature: the limited gain keeps it stable. The light output simply dims to whatever level it can operate at!So it's not very good to put a hard limit on things. Much better to approach it slowly: create a temperature variable, scaled and offset to the same range as your main control variable, and do something like: feedback_variable = max(control_variable, temperature_variable). This is equivalent to using ideal diodes, or using transistors normally biased off (as above).Tim

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 18, 2017, 06:42:18 am
content: Hello Tim, thank you for your reply, I like your circuitVery true about to much gain and a bang-bang response, I have to avoid that in the MPPT algorithm itself. There is output voltage control, it was just set to high, but the voltage control doesn't help the initial power on situation that happens before any controller receives power. That is in part caused by the high inductance for a wide operating voltage range and small capacitors caused by avoiding electrolytics and being designed for high frequency (125Khz). Boost inductor is 100uH, input and output capacitors are 4.7 & 6.6uF respectively. All designs are full of compromises, it's just some of them turn into gotcha's laterThe output voltage is an issue, I need 148V to push 1100W into a 20R heater but also I was hoping to run at ~180V when the heater was switched off to power another unmentionable device that was going to automatically start once its UVLO was exceeded. Having reduced the maximum working voltage to something like 148V the other device will have to be explicitly told to start instead of relying on it's UVLO.....more wires!Back on the wall outside after repair and software upgrade, hope to get a clean buck to boost transition today and no more failures.If the Chinese stole your circuit the first thing they would take out to cost reduce it is all those expensive EMI components you so carefully crafted and they don't understand the need for or care!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 18, 2017, 06:45:27 am
content: 4.7 and 6.6uF? That's way too little...It seems you've discovered why!Tim

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 18, 2017, 07:24:51 am
content: Quote from: T3sl4co1l on June 18, 2017, 06:45:27 amWell like I say all designs are a compromise, economics, space, performance etcFirstly this converter operates at 125Khz, there are no ripple components below that, secondly the load is purely resistive and there is no requirement for a low ripple output, thirdly the panels are a fairly low impedance source so the remaining ripple current produces a small ripple voltage that marginally reduces there efficiency however the ripple imposed by the mppt algorithm is much larger! I do not feel the need to fit excessive expensive space consuming capacitance just to be nearer some theoretical perfection, as it is the converter is cheap, small and reasonably efficient and insofar as its main capacitors electrolytic free!In fact the main reason for any output capacitors is to control the rate of rise of output voltage should the output suddenly go open for some reason (fuse etc).I had my own targets for the design and largely despite a few teething troubles they have been met

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 18, 2017, 05:31:37 pm
content: And the teething troubles continue this time caused by the contents of the junk box! Old GREY silpads OMG I hadn't realized how bad they are compared to mica TO220 insulators see herehttp://www.bergquistcompany.com/thermal_materials/graph_pdfs/COMPARE_SPVALUE.pdf(400 series) and herehttps://www.fairchildsemi.com/application-notes/AN/AN-4166.pdffor a mica comparison.Anyway as I had some old grey silpads in my junkbox that's what I used and I am pretty sure that's what led to yet another mosfet failure today, I actually watched it dying slowly on the scope but didn't realize that's what I was watching at the time, I now have a mosfet graveyard in the corner of my workbench having lost about three in the last few days. At the time the heatsink temperature was around 40C and the mosfet dissipation could have been 20W so that means the tab could have reached 200C, should have spat on it to check itTalk about unfit for purpose, whats the point of pad material that gives an interface of 8C/W under moderate pressure grrrrrrr rant rant grrrrrrrrSo I think more effort to be expended on a bench test setup to allow higher power testing under controlled conditions rather than have the sun let rip on me while I am dangling like a bat up some ladders lolsJust in case anybodies interested there is a 13 year long discussion on pad materials herehttp://www.diyaudio.com/forums/pass-labs/37262-mica-goop.html

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 20, 2017, 10:17:20 am
content: I know how much you like pictures so here is the bench test rig. There are a set of transformers capable of providing 110Vdc & 5A (limited by rectifier), the big blue variac can be used to change the voltage. This is connected in series with an ELECTRIC KETTLE as a ballast to represent the non-linear PV source. The output of the converter is connected to an electric fire with 1, 2 & 3Kw settings to represent the load. Ideally my source would be a CV/CC psu of around 1.5Kva but sadly I don't have one of those! So far the horrid grey silpads have been replaced with mica and gunk and the shorted mosfet replaced. I have been checking and verifying very carefully the mosfet switching conditions, as the rig cannot run at anything like full power I have been copying my observations at 200W into spice and then cranking up the power to 1100W in spice, once again not ideal but better then nothingI really cannot find anything wrong with it other than the suspect silpads, the mosfet dissipation extrapolates out to 16W at full power so it's certainly possible that was the cause.There are some unexpectedly large current spikes at turn-on, either the boost inductor has quite a lot of capacitance, Qrr of boost diode or it's simply coupling EMI into the imperfect probes, in any case the mosfet rating is 65A (actually the soa is 130A@200V for 1uS) so it shouldn't be bothered. The turn on/off times are deliberately slowed to reduce EMI.vdrive and vgate are the two sides of the gate resistor, the mosfet is an IRFB4227.So today I will use the rig to verify some complex software around the buck to boost transition, much easier than waiting for the sun to do just the right thing!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 20, 2017, 10:56:34 am
content: Huh, gate driver appears to be around 5 ohms Rds(on), and the gate resistor around 15 ohms.What's the yellow trace actually measuring? It doesn't seem to be carrying any load current at all, if that's what you had intended...I hope the double-blip shape of the yellow trace isn't due to shoot-through or something. The gate waveform is quite slow, so this would be a concern in a synchronous converter.If you're using a PN diode, yes, reverse recovery is a big deal. It can pay toincrease(and snub) loop inductance, to reduce dI/dt and peak recovery current. There are silicon schottky diodes available in that size (10s of amps, 200V), though they aren't very good (Vf is comparable to PN diodes -- but with no recovery loss, so this alone can be worthwhile). (There are SiC schottky too, but these begin at 600V (and Vf ~ 2V), so they won't be worth it here.)Ed: nevermind, I see MBR20200CT. Pretty reasonable. The schematic is very hard to read.Tim

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 20, 2017, 12:17:09 pm
content: Hello Tim, yes that's about right for the gate. The yellow trace is across the source resistor so its supposed to be source current, the main reason for including it in the scope shots is a common visible timing reference (I only have two channels). I suspect most of the actual trace is made up of probe artifacts and EMI as no attempt has been made at tip grounding. Ohh its an 0R05 resistor and were only running 200W so the normal run current is practically invisible, this resistor serves as an overcurrent protection not for current measurement as such TBH its almost superfluous except for inductor saturation that could occur due to a software fault.I am sorry the schematic is very hard to read, it has to much crammed onto one sheet, just grew like topsyYup it's a schottky so Qrr isn't so bad although it is a fairly high voltage circuit. Some turn on spike will come from the snubber, some from the boost recovery and some from boost inductor capacitance, I don't really have the equipment to measure it all, as long as it is small enough not to represent a failure mode or generate to much EMI I am happy. I remain a little concerned about the double nature of that blip and may well spend some time trying to resolve the cause later.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 21, 2017, 12:09:43 pm
content: Today finished bench testing, as much as I can within the power available (a few hundred watts). Re-checked the weird double source pulse and found it changed when the scope ground was moved so pretty sure the double is actually spurious. Of course a single pulse in this location is perfectly normalChecked out the software moving from boost to buck and back again smoothly, takes a while to figure out how to use the test rig to simulate real PV conditions but got there in the end, basically if the load impedance is varied the MPPT acts to try and maintain the input power at it's peak which given a fixed input ballast resistor means it tries to maintain a constant input current that was visible on a test rig panel meter. I must admit I use the terms buck and pwm interchangeably, in one parlance it is bucking the input voltage but in another its simply pwm control of a heaterCurrently waiting for the conformal coating to dry prior to re-assembly then back outside (plus of course that kettle boiled) and I hope it knows I have no more mosfets left!! I did spend some time looking for something more robust but frankly the IRFB4227's are hard to beat without spending silly £££££ just hope the good old mica and gunk do the job.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 23, 2017, 11:59:27 am
content: Just a quick note to say I am too clever for my own boots, boost mosfet failed again yesterday and it wasn't even sunny! Stupidly I went out after re-installation so wasn't watching (overconfidence). So not thermal, not voltage, leaves current! Inductor could be saturating due to software fault and current limit lackadaisical. Started checking everything from scratch, here is inductor saturation measured on my tester, vertical is 4A/Cm so ~18A, design value was 13A. There is some overly clever software switching PIC PSMC frequency between boost and buck modes (to reduce switching losses in the latter) that may be causing runt extended pwm on times to the boost stage. Unfortunately the PIC PSMC is very poorly documented and so far I have been unable to find any timing parameters for it so even its reaction time to shutdown (overcurrent) is unknown so many more things to measure. Amusing this spell checker doesn't like inductorUpdate......I found a software fault that could cause the PWM to drive the boost stage at 100% duty cycle for several milli-seconds occasionally, certainly enough to saturate the inductor. The remaining mystery is why the resulting overcurrent was apparently unable to shutdown the PWM!Answer leading edge blanking cap was HUGE! giving 5.5uS delay, well long enough to fry a mosfet facing a saturated inductor! Somehow a gremlin crept in and it was 100nF not 1nF shown on schematic........No more mosfets till Wednesday as RS my usual supplier have let themselves run out of stock of one of the most popular mosfets till mid August......RS are going down the tubes, getting less and less interested in discretes! Anybody have this problem, switch to Farnell, most MOQ's reasonable too, just don't work weekends.

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 28, 2017, 02:55:58 pm
content: Ewww this PIC PSMC thing is really nasty! firstly after several days on the mchip forum asking, no replies whatsoever regarding it's AC specifications. Then today I find a new glitch and it's caused by the way I handle it (dynamically changing steering) but I did find a way out, there is a synch bit that allows you to specify changing steering synchronously with the period. But another glitch caused by a similar problem with polarity doesn't have a synch option, however that glitch occurs at very low duty cycle and is not in the inductor (boost) drive so unlikely to have any bad effect. Just beware anybody using this thing seriously you need kid gloves and a lot of time and patiencepictures are some glitches.Mosfets arrived today, fitted and bench tested, nearly flooded out yesterday/last night/this morning so a bit damp for refitting outside today.Have a nice day

author: fourtytwo42
author_rank: Super Contributor
timestamp: June 29, 2017, 03:36:34 pm
content: Re-installed 0830 today, horrible grey skies all day but at 1600 have gotten 1Kwh, not bad for a 1Kw array, ran in pwm mode all day, power typically 75-200W (peaked at 465W). Tank thermostat just cut off at 64degC (148degF) and a few hours daylight left so very happy.Next project is to use the surplus energy without batteries!BUT first of all see if it can hang together when the sun comes out again (maybe a week or so we seem to have been plunged into uk clag for a while).

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 03, 2017, 02:35:01 pm
content: Well we have had some brief interludes of sun, no blown mosfets but a very aggressive overcurrent protector, every time it gets up between 550-600W it shuts down! I have proved this is the boost stage overcurrent protection that uses a 0R05 source resistor with a 100R/180pF filter into a comparator who's reference is a silicon diode (~600mV), the output of this comparator internally shuts down the PIC PSMC (Programmable Switch Mode Controller) module. OK so it could be the leading edge spike except the PSMC has LEB (Leading Edge Blanking) programmed and I have tried up to 1uS but the problem remains. Sadly I cannot access the comparator output with a scope as the output pin for it is in use for an ADC input with a whopping 680nF filter cap!So it could be LEB doesn't work on this chip, or I am misunderstanding how to use/program it, or something else. This problem didn't used to happen when the filter on this pin was mistakenly 100nF, then it just used to evaporate mosfets instead!It could be noise entering the pin at some other time than the leading edge although I have seen no evidence of it. So for now I just have my thinking cap on!Scope shot is driver output (pre gate resistor) and comparator input after LC filter.2nd scope shot is worst case noise at comparator input BUT should be covered by LEBI am thinking of extending LEB even more than 1uS or slowing down the comparator but I am a little chicken to loose yet another mosfet even though I think I may have found the cause of that (occasional crazy on times).Update..... managed to conceive a way of getting a realtime output from the PSMC when it's shutdown to trigger the scope this proves beyond doubt is is the current comparator and that LEB is not working!3rd shot shows shutdown together with filtered overcurrent signal, 4th shot shows shutdown together with PIC boost drive signal (LEB starts at its leading edge). LEB here is set to 500nS!

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 05, 2017, 12:36:14 pm
content: Well at last a work-around for the unexpected shutdowns from the boost overcurrent! The thing that fixed it in the end was setting the comparator to SLOW MODE! I don't actually know why this worksEither LEB doesn't work at all (well I have not seen any reports of anyone trying to use it), or there is a glitch at some other time than the leading edge, well there is no scope evidence for that and there is also no high power activity other than just this boost converter, so no asynchronous noise source except the APU but it's only <100mW when the fan is not running (it wasn't) and it's on a separate PCB.I think my conclusion is LEB doesn't work at least on this chip and from the C1 input. That's what caused me to increase the filter capacitor so dramatically and enter the sorry downward spiral of mosfet failuresThe only way to prove this would be an extensive breadboarding exercise that frankly I don't have time for.Well thank you Microchip, you have cost me ££££ in failed mosfets and probably a month finding out your chip doesn't work, don't suggest I ask a question on your forum nor ask for tech support, I am still waiting after 2 weeks for someone to even answer the simple question of what is the Tpd from an asynch shutdown input to the PSMC outputs changing state! Time to move on to a better specified chip methinks for the future.When you consider this PSMC is also used in the flagship DsPIC it's astonishing how poorly supported and documented it is!!

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 05, 2017, 06:26:35 pm
content: Quote from: T3sl4co1l on July 05, 2017, 05:20:27 pmI find that a borish and stupid comment to say the least, I didn't think this site was infected with stupid trolls, perhaps I was wrong!!It is a matter of fact that I have found several silicon faults in a long career and as author of several patents and past member of IEEE do not consider myself a poor designer, perhaps you should examine you mirror more closely, and please do not reply as I have no further interest in your comments.

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 09, 2017, 07:14:28 am
content: Well I did set up a test rig specifically to test leading edge blanking on this chip and indeed it doesn't work, duly documented and sent to Mchip. Fortunately there is a work around of sorts to simultaneously program trailing edge blanking though the downsides of this are application dependent.I also measured the undocumented PSMC in to out delay and got a creditable 20nS.So I have some fixes to install outside, this will allow the power to ramp up fully on hot days (not to many of those around at the moment)1st scope shot shows PSMC in-out delay, 2nd shows a leading edge pulse successfully ignored by the blanking feature using the workaround.PS I should mention the path from the comparator to the output pin is different from the internal path from the comparator to the PSMC so these measurements are only approximations to the conditions internal to the chip (if that makes sense)PPS I had to set up a specific test rig as on the actual target the vital (to this problem) C1OUT pin is in use for something else that could not be dispensed with.

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 15, 2017, 01:26:20 pm
content: Been chugging away outside for almost a week, some sun so been up to 1100W, no more blown mosfetsAs for Mchip, they have ways of keeping there errata small, ensure you have a business case before investigating any bugsI seem to remember someone on this site comparing micro-controllers according to the size of there errata, well that doesn't work if the manufacturer doesn't update the errata with known bugsEDIT: Just added a plot of tank temperature and watt hours for the last week or so, on the whole the weather has been poor but it's still enough to keep the water temperature up.

author: ahbushnell
author_rank: Frequent Contributor
timestamp: July 16, 2017, 05:52:32 pm
content: Quote from: fourtytwo42 on June 05, 2017, 07:45:50 amCan you have the A/D sample in sync with the PWM so it does not do a conversion in the noise area? That's common with motor control.

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 16, 2017, 08:11:31 pm
content: Quote from: ahbushnell on July 16, 2017, 05:52:32 pmYes, it took me a long time to figure how to do it on that chip and it did make a dramatic improvement but then the whole thing has been a case of incremental improvement, like kelvin connections on the current sense amp also suggested here, oversampling and averaging the ADC, slowing down switching speeds and adding a flux strap to the inductor, all have contributedIt's been a learning curve, very different from a simple SMPS! Many years ago I used to work on servo-motor systems with accurately controlled velocity profiles BUT the power stage was linear (big heatsinks) so no switching noise!!Ohh I should also mention the "noise area" is somewhat extended by relatively slow op-amps AND is integrated by any low pass filtering prior to the adc further compounding the problem......so no magic solution just suppressed enough for the system to workI should imagine the problems recovering low level current sense signals in high power motor inverters are a complete nightmare.

author: RedSky
author_rank: Contributor
timestamp: July 24, 2017, 03:14:31 am
content: I have been working on MPPT charge controllers as a hobby for a long time now.My latest MPPT prototype oversamples the ADC pins 60 times and averages, 30 times a second. The MPPT duty cycle is adjusted about 15 times a second.To sample current I use a MAX4080S that reads from a 1mOhm sense resistor, the output of that is tied to a 10k resistor and 0.1uF ceramic cap to ground before going into the PIC ADC pin. The PIC is an older model 8 bit job with a 10bit ADC. I can get accurate 13bit readings out of the thing by oversampling (I don't divide the 60 readings by 60, generally by roughly 10).My MPPT tracks very well, though I have sweep and active tracking algorithms (full sweep occurs every half an hour in bulk mode - adjustable - takes about 5 seconds) and active tracking is constant in Bulk, Absorb and Float modes. The sweep action is mostly redundant though as the active tracking is always spot on.My advice therefore is to oversample a lot. DC conversion is noisy, no matter how much component level filtering you do, digital oversampling is necessary. Also make absolutely sure your PIC voltage rail is very stable. I use a MAX5033 powered from the battery side along with a combination of 7 capacitors to keep the thing rock solid.

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 24, 2017, 06:17:28 am
content: Hi Redsky, thank you for your commentsI use binary modulo's for multiply/divide so I can use shift operations, sometimes it's a bit limiting but so much faster. My PV voltage is much higher so I use low side sensing, any op-amp with a common mode extending below zero will do, I used LTC1637 because I happened to have oneI actually round my current resolution to 8 bit before MPPT processing, with an FSD of 10Amps this still gives a resolution of 39mA that I find more than enough.I thought the PIC ADC source impedance spec was somewhere around <=2K but I may be wrong, in any case I use just 470R/10nF to kill the real nasties prior to the ADC, I found a lower Fc causes noise integration within the lpf leading to bigger errors.Of course the whole thing is highly dependent upon the particular noise environment your working with so every case is individualI agree on the ADC reference voltage or PIC supply rail, I use a LP2950-33 linear to generate 3V3 for the PIC from a ~12V source so the 3V3 is stable and nice and quiet.My MPPT runs at around 16hZ that I find fast enough to track clouds, fortunately I don't have any tree shading to worry about, I don't bother with the additional complexity/power loss of sweeping because as you say I always find the MPPT spot on after extensive testing although that did take some effort at very low insolations (I use an adaptive step size).It's good to hear what choices other people make, always interesting

author: RedSky
author_rank: Contributor
timestamp: July 24, 2017, 01:24:49 pm
content: I should point out the 10k resistor is in parallel with the cap to ground, not series and you are right, it is fairly specific to using the MAX4080 chip as the current sense to get very accurate and stable readings.My prototype is designed to work with up to 50 amps output. I process my current readings so they end up as the amperage value to 2 decimal places. For example 1234 in a variable would represent 12.34 amps. I use that value in my MPPT algorithm and for display/data logging and other regulator functionality. The duty cycle is changed in 0.2% increments. It results in tracking that keeps fairly close, say +/- 0.2V to the actual MPP at most times, and doesn't hunt that much, which in my case is fine. For example, The MPP may still hunt up a few volts within 10 seconds if the sun came out behind a cloud, which to me is fast enough and leads to maximum extraction of power in a day. I don't do adaptive step size, for me that was unnecessary but I have read plenty of whitepapers that it's one of the best methods. To deal with low isolation, I have very low amperage resolution (10mA) which helps, though i'll admit if the power is down to within a few amps output level the active tracking may get stuck if it wasn't for the full sweep now and then, I could of course increase the duty cycle increment on the active tracking to deal with that if I wanted but It's all a compromise at the end of the day, there is no perfect method.I generally agree with your comments on the sweep vs active algorithm, however the sweep algorithm can be quite impressive. I do a full solar open circuit to battery voltage sweep in less than 5 seconds, and for half of that 5 seconds its running a fine sweep very close to the MPP thus losing very little available power. It also finds the MPP with an accuracy of 0.1VIf you do all the maths it works out for two sweeps an hour I lose on average less than 0.1% of the available energy from the sweeps.I believe the Morningstar Tristar MPPT uses even faster sweeps as it's primary way of tracking, so does the Outback MPPT and the Midnite Classic, though some of these have configurable algorithm options.For me that small percentage loss from more than a couple of sweeps per hour is unacceptable. But I guess these big companies have to allow for all the different customer systems and forms of shading that might occur and can see that sweeping would be more reliable in some specific cases.Having a sweep algorithm is also very handy to check your own active tracking algorithm. I can initiate a sweep instantly anytime which then provides the results on the display for confirmation that the active tracking algorithm is accurate. It's also useful to give the active tracking algorithm a head start when the MPPT controller is first turned on.I too think reading how you are going about doing your design is interesting. Keep up the good work and posting about it.

author: fourtytwo42
author_rank: Super Contributor
timestamp: July 25, 2017, 08:27:59 am
content: Quote from: RedSky on July 24, 2017, 01:24:49 pmAhh potentially we are talking about different things hereI measure my PV current for the MPPT algorithm! Measuring my output current would be no good as it is not directly related to PV current and would therefore give a false MPP for the panels. As I am measuring PV current in a single series string IFSD is 10A as that exceeds ISC of any panel I have encountered and certainly those I use (Axitec AC-260P/156-60S).

author: RedSky
author_rank: Contributor
timestamp: July 25, 2017, 01:38:39 pm
content: different load yes, still maximum power point tracking

author: Inverted18650
author_rank: Frequent Contributor
timestamp: August 19, 2017, 02:18:56 am
content: This is the best thread I have read here. Thank you for detail and all the contributions. This is the level I hope to get to and would be stoked if I can pick your brain sometime fourtytwo42. Thanks for the knowledge.

author: fourtytwo42
author_rank: Super Contributor
timestamp: August 20, 2017, 03:16:48 pm
content: Thats very kind of you to say that and thank you, I often wonder if my ramblings are any help to anybody, if nothing else I hope they either make people smile or inspire them to have a go themselves. Anybody is welcome to pick whatever is in my head anytime they like