August 25, 20205 yr 1 hour ago, JustinSchoeman said: derate charge current proportionally There are two ways to deal with this. The one is to regulate the charge current, and the other is to regulate the charge voltage. Or some combination of the two. In some systems, for example a Victron system with the PV coupled to the DC side, current regulation does not work very well. Especially when there is also AC charging involved (eg when you have a Fronius in the system), then you have multiple chargers and the charge current has to be distributed and regulated across a number of devices, while compensating for any power the loads are using (ie, you do some math to ensure that the current limit is set to what the battery asked for PLUS what the loads are using). Now, the DC current is usually about 10% more than the AC power, and not all (in fact, few) inverters have a shunt on the DC side to measure this, so it also estimates that... the result being that the charge current limit is always just "more or less" and never quite what you asked for. In an SMA system where all the PV is tied on the AC side, no problem. There is a single point of charge control (The SunnyIsland inverter) and current control works well. In a Victron system with all the PV on the AC side, same deal. So what I usually tell people is to try to avoid charge current regulation and regulate the voltage, and only lower the charge current if you have to. Sending a zero limit should usually be done only as a last resort.
August 25, 20205 yr Author Thanks for all the tips guys. Mostly incorporated and seems to work quite well. Here is a preview for anybody who wants to review it for me : // HIGH VOLTAGE LOGIC if(bat_maxv > BAT_MAX_V) { // over - shut off charging... Serial.println("OVERVOLTAGE!"); trg_chg_i = 0; trg_chg_v = bat_v * 10U; trg_chg_v -= (bat_maxv - BAT_MAX_V) * 200; // retard by 200mV for each mV above target... } else if(bat_maxv > BAT_DERATE_V) { Serial.println("HIGH VOLTAGE!"); // derate voltage trg_chg_v = bat_v * 10U; trg_chg_v += 16*(BAT_MAX_V - bat_maxv); // set the target voltage = current voltage + whatever is required to make the max cell full // derate current delta = bat_maxv - BAT_DERATE_V; f = delta; f /= (float)(BAT_MAX_V - BAT_DERATE_V); // (min derate) 0 < f <= 1 (full derate) f = 1.0 - f; trg_chg_i = (float)(BAT_CHG_I * 100U) * f; } else { // restore target trg_chg_i = BAT_CHG_I*100; trg_chg_v = BAT_CHG_V; } // ramp functions if(trg_chg_i < bat_chg_i) { // going down? rapid derate delta = bat_chg_i - trg_chg_i; delta /= 2; if(delta == 0) delta = 1; bat_chg_i -= delta; } else if(trg_chg_i > bat_chg_i) { // going up? very slow bat_chg_i += 1; } if(trg_chg_v < bat_chg_v) { // going down? rapid derate delta = bat_chg_v - trg_chg_v; delta /= 2; if(delta == 0) delta = 1; bat_chg_v -= delta; } else if(trg_chg_v > bat_chg_v) { // going up? very slow bat_chg_v += 2; // 500 s per volt... 50s per unit that the inverter can notice } Serial.print("bat_chg_v: "); Serial.println(bat_chg_v); Serial.print("trg_chg_v: "); Serial.println(trg_chg_v); // LOW VOLTAGE LOGIC if(bat_minv <= BAT_MIN_V) { // any cell <= minimum? shut off discharge Serial.println("LOW VOLTAGE LIMIT!"); bat_dis_i = 0; bat_soc = 0; bat_soh = 0; lv_lockout = 1; lv_lockout_ms = millis(); } else { // otherwise wait for lockout interval then release if(lv_lockout) { Serial.println("LOW VOLTAGE LOCKOUT"); bat_dis_i = 0; bat_soc = 0; bat_soh = 0; if(millis() - lv_lockout_ms >= LV_LOCKOUT_MS) { lv_lockout = 0; } } else { bat_dis_i = BAT_DIS_I * 100U; } } Still crude and messy and requires tuning. Inverter hates rapid changes in charge parameters and puts battery into standby... So added ramp functions, which seem slow enough to keep the inverter happy. Need to tweek the current derate function to make it steeper in the early stages. Otherwise works quite well so far.
August 26, 20205 yr 11 hours ago, JustinSchoeman said: Inverter hates rapid changes in charge parameters and puts battery into standby... So added ramp functions, which seem slow enough to keep the inverter happy. Need to tweek the current derate function to make it steeper in the early stages. Otherwise works quite well so far. First congrats on the work you have done thus far! I was just wondering if your inverter was to use SOH in its control loop in some way, would setting SOH to 0% not indicate to your inverter that the pack has 0% of its capacity left and then also change the behavior of the charger?
August 26, 20205 yr Author 1 minute ago, PJJ said: First congrats on the work you have done thus far! I was just wondering if your inverter was to use SOH in its control loop in some way, would setting SOH to 0% not indicate to your inverter that the pack has 0% of its capacity left and then also change the behavior of the charger? No idea really. Tried twiddling it, but does not seem to affect inverter response in any way. In fact, the low voltage point is 'interesting'... I set discharge current to 0 SOH to 0 SOC to 0, and it displays the battery in yellow but keeps on discharging it. Turn off the grid, and suddenly it is a low battery alarm and shuts down.
August 26, 20205 yr 10 minutes ago, JustinSchoeman said: In fact, the low voltage point is 'interesting'... I set discharge current to 0 SOH to 0 SOC to 0, and it displays the battery in yellow but keeps on discharging it. Turn off the grid, and suddenly it is a low battery alarm and shuts down. Having 0 knowledge on the inner workings of the Sunsync inverter I can only speculate that the inverter probably has a "On-grid" and "Off-grid / backup" mode. And in "On-grid" mode battery Charge current, SOC and SOH values are perhaps ignored by the inverter thinking : "the grid can easily charge the battery and loads can be fed with grid AC" so the zero DC charge current limit is seen as a moot point by the inverter. But in "Off-grid / backup" the system will probably disconnect the battery because you are saying : I allow 0 DC current and the battery is 0% SOC Or I could be totally wrong. You need to find yourself a Sunsync Plonky
August 26, 20205 yr 28 minutes ago, JustinSchoeman said: SOH SOH is state of health. I doubt the inverter cares about that other than displaying it to the user.
August 26, 20205 yr Author 1 hour ago, PJJ said: You need to find yourself a Sunsync Plonky Busy chatting with Deye engineers at the moment. My inverter did not have an 'island mode' signal. Contacted them, and this morning the option automagically appears on my inverter. Of course it doesn't actually work yet, but the option is there. Just need to deal with one topic at a time with them, or they rapidly lose track... Once island mode is sorted, I will start on this.
August 26, 20205 yr Author Thanks for all the tips/advice everybody. Tweaked version of the above algorithm (fine control of charge voltage, and coarse control of charge current) seems to be working perfectly. Well, at least it is top-balancing the cells now, without slamming straight into the BMS cell protection every few minutes...
August 26, 20205 yr 52 minutes ago, JustinSchoeman said: Well, at least it is top-balancing the cells now, without slamming straight into the BMS cell protection Which is precisely what you want. Well done man!
August 29, 20205 yr Author Heart transplant for a geyser timer... Two tricky aspects: 1) The size - which required some 'interesting' building techniques - but it fits in the end. 2) The PSU of the geyser timer is a linear regulator from rectified mains to 3.3v... As you can imagine, current output is extremely limited. Got the circuit consumption down to an average of 3uA though with some more 'interesting' techniques. I just hope reception in the DB box is good enough for this to actually work!
August 30, 20205 yr 14 hours ago, JustinSchoeman said: linear regulator from rectified mains to 3.3v Why not just a good old capacitive dropper? I spy a big yellow capacitor in the mains area... maybe you are doing that? You can get enough current from a capacitive dropper to power a small relay, which is usually how it is done in just about every daylight swith 🙂 Edit: Aaah yes, I see the relay too. That big old Songle in there. Edited August 30, 20205 yr by plonkster
August 30, 20205 yr Author I am using the stock main board for the timer. This contains the PSU + Relay. PSU is a 2 stage - 48V capacitive dropper for the relay coil, and from there a zener regulated linear charger for a 3.2V coin cell, which is also the main power supply for the timer board. Seems like quite a solid design, but draw more than 500uA and you are discharging the coin cell. To get the controller to really low power, it is pretty much permanently shut down. Every 8 seconds the watchdog timer wakes it up. It then turns on the radio, and powers down the uC for another 15ms. The uC then wakes up, streams any received packets from the radio, shuts the radio down, processes the packets and then goes to sleep again. Transmitter obviously has to transmit repetitively for up to 8s before the receiver acks, but that is no biggie.
August 30, 20205 yr On 2020/08/19 at 12:04 PM, plonkster said: Sure, but personally I don't have the patience to wait for it to ship, nor do I want to take the risk of using the Post Office, and if you add courier cost you have to bring in larger volumes to get good pricing. And then SARS wants their cut and you end up having to register as an importer if you do this more than a few times a year. I suppose if someone does this as a business venture, then yes... you can get that low. A really good alternative is Banggood.com. They have a shipping method called "South Africa Direct" which is cheap (R0-R100 depending on order size), fast (typically < 2 weeks) and reliable (I have used it maybe 30 times without a misfire). Best of all, it is couriered to your door. You can pay the duties (normally about R50) either on checkout or when it arrives in SA.
August 30, 20205 yr 23 hours ago, JustinSchoeman said: Heart transplant for a geyser timer... Have you considered going for proportional control? I have hooked up both my geysers through triacs so that I can adjust the power linearly using phase control (essentially a high current "dimmer"). Advantages: The main beauty of this is that you can now allocated any spare PV to the geysers, saving the battery from charge/discharge cycles as you kick in or out the 3kW geyser loads. You can run your geyser any time when system has some spare inverter capacity, but perhaps not enough for the full geyser load. Zero-delay switch off time in case of overloads. I control the triacs with the Arduino (Due) that I use as a controller for my whole system. Everything is powered by the Arduino: I run the triac of one pair in a CAT5 wire, and use two of the other pairs for a DS18B20 to accurately measure the geyser's temperature. This works fine for (in my case) 15m away. The most expensive part is the heat sink for the triac - total cost per geyser is about R200. By doing it this way you essentially incorporate the geyser into the system as an additional energy store - lots of fun to be had optimising the rules for power allocation.... One needs soldering and programming skills to do this, but I can see that you are doing all this already.😀
August 30, 20205 yr 10 minutes ago, Calvin said: Have you considered going for proportional control? I have hooked up both my geysers through triacs so that I can adjust the power linearly using phase control (essentially a high current "dimmer"). Advantages: The main beauty of this is that you can now allocated any spare PV to the geysers, saving the battery from charge/discharge cycles as you kick in or out the 3kW geyser loads. You can run your geyser any time when system has some spare inverter capacity, but perhaps not enough for the full geyser load. Zero-delay switch off time in case of overloads. I control the triacs with the Arduino (Due) that I use as a controller for my whole system. Everything is powered by the Arduino: I run the triac of one pair in a CAT5 wire, and use two of the other pairs for a DS18B20 to accurately measure the geyser's temperature. This works fine for (in my case) 15m away. The most expensive part is the heat sink for the triac - total cost per geyser is about R200. By doing it this way you essentially incorporate the geyser into the system as an additional energy store - lots of fun to be had optimising the rules for power allocation.... One needs soldering and programming skills to do this, but I can see that you are doing all this already.😀 This sounds very neat. I’ve been toying with the idea of replacing my 3kw element with 2kw, but using your Triac idea means I can dynamically change the power the element uses based on spare PV capacity. Any chance you’d show some schematic and code?
August 30, 20205 yr 16 minutes ago, gbyleveldt said: This sounds very neat. I’ve been toying with the idea of replacing my 3kw element with 2kw, but using your Triac idea means I can dynamically change the power the element uses based on spare PV capacity. Any chance you’d show some schematic and code? I would be happy to share , but most of what I did was based on the excellent work documented on this page: https://learn.openenergymonitor.org/pv-diversion. If you google "instructable arduino triac" (without the inverted commas) there are many well documented examples that will give you an idea of the work involved. If you read through these and are still interested I can give you the details of what I did - circuit diagram, board layout, components source, code etc. It is quite a simple build (I used a bit of veroboard), but anything involving 220V and high current needs to be soldered VERY carefully. I used BTA41-600 triacs and MOC3021 opto couplers. One could use the (much cheaper) BTA26-600 triac. One warning - If you are not familiar with the world of Arduinos and C++ it is quite a learning curve. Good luck - let me know if you want the details.
August 30, 20205 yr Author 1 hour ago, Calvin said: Have you considered going for proportional control? I have hooked up both my geysers through triacs so that I can adjust the power linearly using phase control (essentially a high current "dimmer"). Advantages: The main beauty of this is that you can now allocated any spare PV to the geysers, saving the battery from charge/discharge cycles as you kick in or out the 3kW geyser loads. You can run your geyser any time when system has some spare inverter capacity, but perhaps not enough for the full geyser load. Zero-delay switch off time in case of overloads. I control the triacs with the Arduino (Due) that I use as a controller for my whole system. Everything is powered by the Arduino: I run the triac of one pair in a CAT5 wire, and use two of the other pairs for a DS18B20 to accurately measure the geyser's temperature. This works fine for (in my case) 15m away. The most expensive part is the heat sink for the triac - total cost per geyser is about R200. By doing it this way you essentially incorporate the geyser into the system as an additional energy store - lots of fun to be had optimising the rules for power allocation.... One needs soldering and programming skills to do this, but I can see that you are doing all this already.😀 That sounds like a really great idea. Not sure how well a transformerless inverter will deal with a 3kW switched load - but may be worth experimenting.
August 31, 20205 yr 7 hours ago, Calvin said: I would be happy to share , but most of what I did was based on the excellent work documented on this page: https://learn.openenergymonitor.org/pv-diversion. If you google "instructable arduino triac" (without the inverted commas) there are many well documented examples that will give you an idea of the work involved. If you read through these and are still interested I can give you the details of what I did - circuit diagram, board layout, components source, code etc. It is quite a simple build (I used a bit of veroboard), but anything involving 220V and high current needs to be soldered VERY carefully. I used BTA41-600 triacs and MOC3021 opto couplers. One could use the (much cheaper) BTA26-600 triac. One warning - If you are not familiar with the world of Arduinos and C++ it is quite a learning curve. Good luck - let me know if you want the details. Thank you very much, that’ll get me on the right path. I used to be a hardware and software developer in a past life, but on the hardware side it was only low current stuff. Power electronics is a different animal altogether hehe. Only real issue at the moment for me is talking to my Goodwe inverter. There are ways to scrape the SEMS website, but it only gets updated every 5 minutes; I’m looking at ways to get much faster (thus More relevant) info off the inverter to drive something like this.
August 31, 20205 yr 4 hours ago, gbyleveldt said: Only real issue at the moment for me is talking to my Goodwe inverter. There are ways to scrape the SEMS website, but it only gets updated every 5 minutes; I’m looking at ways to get much faster (thus More relevant) info off the inverter to drive something like this. I have Axperts that give information at 2 second intervals, but even that has problems. The basic issue is that the inverter will clip output to match demand: whatever the batteries will take + any actual loads. How to know if there is potential extra PV that could be harvested? One way is by increasing the loads slowly, (by sending more power to the geyser in this case) and monitoring the inverter - once it starts taking energy from the utility or battery, you are at maximum. The problem with this approach is on days with intermittent clouds - the system cannot react fast enough to the varying PV irradiation level. I ended up making a pyranometer (a 5W panel with a load resistor, calibrated to match my panels' output) to measure the actual PV power available at any time. On the AC overload side (which is the part that @JustinSchoemanwas interested in) even the 2 second update is a bit too slow for detecting potential overloads caused by motor starts etc. I have a current transformer on the AC outputs that give me a reading 100 times a second (at each zero-crossing). If that reading is too high the geyser triacs will reduce loads to compensate. in theory you could get around the Goodwe by: Measuring potential PV as described Measuring AC in and out (either directly with a microcontroller or using a power meter like this https://www.banggood.com/PEACEFAIR-Single-Phase-RS485-Port-Modbus-Smart-Digital-Electric-Energy-Meter-p-1331578.html) Reading battery power directly from your Pylons All of this could be done by the same Arduino that you might use for switching the triacs. Edited August 31, 20205 yr by Calvin
August 31, 20205 yr Author Not sure if this is the correct protocol, but it seems you can get the details directly from the inverter: http://yamasun.com.tw/upload/F_20170313191367UrC8jo.PDF Goodwe allows 50% overload for 10s, so you have 10s to shut down extra loads before the inverter shuts down everything. So you should not really need any extra hardware to make it all work.
August 31, 20205 yr On 2020/08/29 at 9:00 PM, JustinSchoeman said: 2) The PSU of the geyser timer is a linear regulator from rectified mains to 3.3v... As you can imagine, current output is extremely limited. Got the circuit consumption down to an average of 3uA though with some more 'interesting' techniques. I just hope reception in the DB box is good enough for this to actually work! I assume you don't have anything you can touch since you don't have any isolation... I bought a bunch of these: https://www.banggood.com/10pcs-AC-DC-5V-700mA-3_5W-Isolated-Switching-Power-Supply-Module-Buck-Regulator-Step-Down-Precision-Power-Module-220V-to-5V-Converter-p-1542714.html?rmmds=detail-left-hotproducts__4&cur_warehouse=CN They are tiny. That is a bundle with 10 of them. Pretty close to the size of a R5 coin (but less wide). One guy online took them apart and the isolation between primary and secondary was on-par for typical high frequency switch mode circuits you can buy from reputable companies. (ie. paper barrier, not quite the same as the older transformers that have plastic bobbin separating the two). But compared to your circuit which I assume has no isolation, I would say it is significantly better. It does not feature a class Y decoupling capacitor (probably to save money), so the noise is on the higher side (60mV ripple). You can always add a decoupling capacitor but that will obv. increase the footprint. No issues using it on STM32, ATTiny or ESP32 however Edited August 31, 20205 yr by Gnome
August 31, 20205 yr Author 26 minutes ago, Gnome said: I assume you don't have anything you can touch since you don't have any isolation... It is inside the existing geyser timer switch, with the housing completely intact, so no issues there. But those look like really nice PSUs. Will order a bunch next time .
August 31, 20205 yr 8 minutes ago, JustinSchoeman said: It is inside the existing geyser timer switch, with the housing completely intact, so no issues there. But those look like really nice PSUs. Will order a bunch next time . Ah ok gotcha. Still generally you won't see anything mains related without isolation, apart from the no-isolation/shock problem, it can cause fire quite easily if you go out of range. The operating range of your circuit is very narrow I assume (ie. very close to exactly right AC voltage required). At least I can't think of any products I've bought that uses DC without isolation. (expect perhaps an indicator LED with a resistor in series) EDIT: Also, I'm not raining on your parade here. I think you did an excellent job with this circuit. See this as constructive feedback. I'm building some high voltage sensors and I actually find these mains voltage circuits are much tougher than people think. So kudos! Edited August 31, 20205 yr by Gnome
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.