Tuesday, 17 November 2015

Battery UnBalancing

When I put this system together I did wonder whether the charger would affect the balance of the cells in the battery.

The charger is a proper LifePO4 charger, CC/CV (with the CC part being adjustable from about 5A upto 100A which is what makes it perfect in this application - I can adjust it on the fly to consume the spare power that the solar panels are generating).

However, it has no monitor leads for the cells, just the two leads going to the +VE and -VE battery terminals.

The maximum voltage where it changes from CC mode to CV mode is 29V, and so the cells with slightly less capacity will reach their max V first (no two cells in the world will be exactly the same capacity, manufacturing tolerances, etc). The battery as a whole won't have reached 29V so the charger will stay in CC mode, overcharging these smaller capacity cells. Any time a cell is overcharged will unbalance that cell very slightly.

After being in use for 6 months (intermittent use, about 3 months total), the difference between the lowest cell V and the highest cell V is 0.4V - 3.12V upto 3.54V, so I'm guessing this is limiting the usable battery capacity by maybe 20% of the total capacity.

So time to balance it.

I know how to bottom balance, and it's a very long, boring process.

* For each cell
* Connect shunt resistor
* Monitor voltage, when it falls to 2.85V, disconnect shunt resistor
* Wait 30 mins and measure voltage
* If voltage > 2.95V, goto step 2.
* Otherwise that cell is bottom balanced

Now, if that doesn't lend itself to being automated, I don't know what is.

So I've built a little board with 8 x 0.47 ohm, 25W resistors and 1 x 8 way relay board, connected to the Arduino.

Added a little bit of software to perform the above steps (on all cells simultaneously).

This "bottom balance cycle" code is built into the main Solar System software, and for the moment can only be run manually by me entering diagnostic mode and starting it.

For the final version I think I will add code that, at the end of each nightly discharge, checks the lowest and highest cell voltages, and if the difference is greater than some threshold, kicks off a bottom balance cycle - with a failsafe that if the last bottom balance was less than one (or two?) months ago, it logs a warning and alerts the user that the battery might have a problem with one or more of its cells.

I am aware that I've now added something that in the case of a fault - if the relay jams on - it will completely drain a cell. But apart from solutions like using two relays in series, or massively overrating the relays (they will conduct about 5A and they're rated at 10A), all I can do is test the relays when I first get the relay board, and try to make sure the boards I buy have decent relays in them, with good MTBFs. I have added checks into the bottom balancing software that detects if the cell voltage continues to drop, and if it detects this it "rattles" the relay, trying to free it up, halts the system and tries to alert the owner. Not much else I can realistically do I think.

Apart from this, everything is working nicely.

Saturday, 26 September 2015

Initial performance data

Just a quick blog about charge / discharge times.

Battery is 28V 4KWh LifePO4.

Inverters are 2 x 500W and 1 x 1KW. (500W inverters seem to supply about 350W, 1KW supplies about 700W, so all together they can supply roughly 1.4KW, although the power they supply does drop when they get warm/hot)

Had bright sunshine in the mornings the past few days, charging the battery up fully in ~5 hours.

System switches to discharge mode when the output from solar panels stops, ~7pm.

With a full battery the system can supply the house (upto 1.4KW demand) from 7pm to ~2am, so runtime is ~7 hours.

Usual demand during that time:-

* 7pm to 10.30pm: 1KW : 3.5KWh
* 10.30pm to 11.30pm: 750W : 0.75KWh
* 11.30pm onwards: 500W : (KWh upto 2am) 1.5KWh

Total KWh: 5.75KWh


Which is interesting.

My guess is the inverters drop down to about half their rated power when they're hot, or the Wattson is overreading consumed power quite a bit.

I'll know which when I add the extra bits to monitor the power going into and out of the solar storage system, and the code to log the readings (from everything) to a file on an SD card.

Right, the battery is full again, time for me to pull the two little breadboards to bits and rebuild them on a bigger one so I can add the third current sensor and an RTC.

Sunday, 20 September 2015

Random thoughs & next steps

Arduinos are quite good, aren't they?

When I first heard about them and saw the Arduino IDE with it's 'sketches' I had a very brief look and formed an opinion that they were very basic with a very primitive language suitable for starting to teach kids about basic programming techniques with the ability to connect some LEDs and buttons.

After digging into the AtMega specs, the hardware capabilities, SPI, I2C interfaces and the tons of libraries that are out there for the add on boards, all in C or C++, they care certainly a lot more capable that I first thought.

Takes me back to my days playing around with Z80s, 6502s or early Linux and DIY MPEG software.


Well the storage unit is chugging along nicely now, the charge rate is controlled by the free power so it does its best to keep exported power between 50W and 100W with everything else going into the battery. Night time the three inverters are switched in and out according to demand.

A couple of odd things I've noticed so far:-

* The 2.2" TFT display on the Arduino has a command that rotates the output in 90 degree steps. Occasionally the output is rotated by 90 degrees by itself. I think it's just noise on the data lines going to it, and a proper PCB or shielded cables will sort it.

* The LiPo / LiFEPo4 charger has a current control knob on the front which lets you set the current in the CC stage between 6A and 100A. I struck a home run as this is a simple 5V feed into the charger control PCB! So a nice direct connection from the filtered PWM output from the Arduino to the charger input. One thing that is a little annoying is the charger is a one cycle charger - if it's left connected to a charged battery it doesn't detect if the battery needs topping up and turns it self back on. It'll charge it up and then sit there until the mains power is cycled. Also if the charge rate is set to zero, it sets charger current to 0A causing the charger to think the battery is fully charged. Got round this by using an absolute minimum charger control value that equals ~7.5A so the charger will only think the battery is full when it actually is.

* The Frontius grid inverter cuts out when it's running at high power. In bright sunshine at midday it can run for a minute and then cut out and then take maybe 3~4 minutes before it kicks back in again. Not good. Must call the installer out.

I still have no way of measuring how much charge is in the battery. I know if it's full or flat, but from 20% to 85% charge the battery voltage is virtually constant.

Will use an opamp to boost the voltage across the current shunt which will allow me to work out that info.

I also want to measure the efficiency of the sytem, and to this end I have another current sensor and enough spare channels and parts to add another power sensor which will measure the power going to/from the charger / inverters which will tell me the loss in the charger / battery / inverters. I suspect it'll be around 50%!

Lastly this coming week I'll be leaving the system on and recording the electricity meter readings, and then turn it off next week and record the readings again. Well, I want to do it on two weeks with approximately the same weather, so it may not be those weeks, but close together.

Sunday, 13 September 2015

Up and running!

The Solar Storage System is up and running (in a basic form).

The Raspberry PI was replaced by two Arduino boards.

Arduino #1 is an Arduino Nano clone (£3.50p) which is calculating the grid and solar power. Inputs are two current sensors and a 240V AC to 9V AC power pack which is just used to supply an AC waveform to calculate the power correctly. Outputs are two PWM analog values representing the grid and solar power. 2.5V is 0W, with each 1V = 1KW of power, so configured to measure plus or minus 2.5KW of power.

Arduino #2 is an Arduino Mega clone (£9) plus a 2.2" TFT screen along with the 8 way relay and 2 way relay board I already had, and the 12 line potential divider that all the input voltages are fed through, connected to the battery cells and temperature TDRs.

Software is the software I was running on the R PI with a few changes to accommodate the different hardware.

In it's current state it'll happily charge the battery during the daytime (but it isn't using variable rate charging yet) and feed the house during the evening / night time providing ouput that can be 350/700/1050/1400W.

Things still to add or improve:-
* Build a teeny circuit to control the chargers 'charge rate' input. The output to drive this is already being output from the Arduino Mega, just needs connected up.
* Create a hard coded "Voltage > Capacity" look up table for the battery so I can easily display bettery percentage remaining rather than just voltage as it does at the moment.
* I'll probably play around with a few algorithms to control the three inverters so they will better match the requirements, it's fun trying to control them as they reach full power output anywhere from 20 seconds (hot) to 2 minutes (cold) after being turned on, so if you think more power is required, is it because the ones turned on haven't come online fully yet, or do you need to turn another one on? No easy way to find out, apart from only do updates once every 2 minutes. (which is what I'm trying now)
* Everything is breadboarded at the moment, so once happy with it, design and build a single PCB.

Anyway, some pics of the system running at the moment.

The breadboards + relay boards + Arduinos:-



Status display, cell voltages, grid and solar power, battery voltage, and three inverter and charger status (DC and AC power and temperatures):-


 Waveform showing the grid and solar power - solar is in blue, grid is in yellow. A horizontal line 1/4 of the way up the screen is 0W. The timebase (time to sweep one cell horizontally) is set to 20 seconds, so this represents about 6 minutes:-


The rest of it, inverters, charger, main control relays, battery in the background:-



Friday, 21 August 2015

Raspberry Poo

Re-format the micro SD card.

Copy Raspbian to it.

Boot in RPi and set up.

Uninstall loads of unwanted stuff, and prepare to make it a read only FS.
https://hallard.me/raspberry-pi-read-only/

Set up WiFi static connection.
http://omarriott.com/aux/raspberry-pi-wifi/

Install required stuff (after finding out what it is again).
http://hertaville.com/interfacing-an-i2c-gpio-expander-mcp23017-to-the-raspberry-pi-using-c.html
plus installing libi2c-dev

Get VisualGDB connecting and building to the RPi again.
(different version of Raspbian so need to resync libs and include files)


Call it a good days work, reboot the RPi before shutting it down to backup the SD card.

Kernal panic... unhandled exception in interrupt handler... can't boot it at all...

Yet another trashed FS, this time it didn't even take a power cut, just a reboot.

<sigh>


That micro SD card has now been stabbed and thrown in the bin. Faulty card? Poor micro SD to SD card adapter? RPs just don't like micro SD cards?


Time to investigate which Arduino has 16 analog inputs, one PWM output (they all have) and another 11 digital outputs.

For now I've dug out an old 4GB proper SD card, see if that will work for more than 48 hours.

Monday, 10 August 2015

10th August 2015 Update - Software, micro controllers, solar panel incidence angles.

Been a while but I'm back working on this now.

Didn't have enough time to dedicate to this so I'm now working a 4 day week at my main job and working on this on day 5.

What's happened since my last post?


Software

Finished for now! Ready for soak testing. Incorporates a full status screen and diagnostic screen when run from a terminal. Still Todo: LCD screen status + LCD screen button control.


Raspberry Pi

Every time I have a power cut the filesystem on the RPi gets corrupted and I have to flash the SD card back to the stock image. Looking into using a read-only file system with /tmp and /var on a ramdisk - I was intending to have my software keep a log of past data but this can't happen with a read only filesystem. I could put the log on a USB stick, or create a remote log server (that could additionally host a web page, etc). Another alternative is to give up with the RPi and use an Arduino.


Power Sensing

I designed and built a little PCB that used a couple of 100A current clamps that read the power being used and produced a simple DC voltage that indicated how much "spare" power there was which would be fed into the RPi.

Designed and tested the circuit using the LT Spice software, worked great in that. Unfortunately I forgot that the current waveform isn't a nice sine wave and is as ugly as heck, which means that the premise that I used to design the circuit was wrong and it doesn't work at all.

So plan B is to use a current sensor and an AC to AC power brick transformer and an Arduino to calculate the power accurately and feed the "spare power" DC signal to the RPi.


Other thoughts

Looking at the data from the Wattson meter I'm wondering just how much charge the battery will get in a normal day. During the day when no one is in, there is approximately 500W load, white goods, fish pond pump (on a timer), Dell server PC (being tweaked to hopefully draw less power), all the little things on standby, etc.

And during a typical overcast day the solar panels generate between 200W > 700W. If I get 250W spare power it'll take 16 hours to charge the 4KWh battery.

So my guess is it'll get 50% charge on a typical overcast day, 100% on a nice sunny day, and 0% on a horrible rainy day.

Leading on from this I've been looking at making brackets + small motors + a simple driver driven from an annual timer for the solar panels (on a panel by panel basis) that can tilt the panels side to side to optimise their angle to the sun. This will create a small shaded area on each panel (apart from the leading edge), but I think the generation falloff caused by the angular error will be greater than 0% to maybe 10% shaded area.

Will probably buy a couple of small solar panels of the same technology that my main installation uses and implement the brackets (manually controlled) on these and take some measurements to see if it'll be worth doing it on the main panels.

Wednesday, 9 July 2014

Solar Storage System : System testing

Yesterday I finished all the wiring on the control board, the high power DC wiring, AC distribution wiring and sensor and fan control.

The only thing left to do is add the Raspberry PI and it's I/O boards and finish writing the software. I'll start on that next week, I've ordered a case for the R-Pi, ribbon cable and a few plugs and sockets to connect all the boards - annoyingly only two of the I/O boards have a hole to add a mounting post, the largest I/O board (PiFace) doesn't, and the smallest (2 in, 2 out analogue channels) is too small to have one, so I'll have to mount them in their own case and figure out some way of keeping them stable.

So in the meantime I wanted to test the assembled hardware. 9 SSR relays plus associated heatsinks, temp sensors and cooling fans, the three inverters, DC fuseboard, AC fuseboard, AC distribution block, and all the wiring and crimped connections.

I dug out nine nice old chunky switches to control the relays, fitted them to a bit of wood lying around, connected all the wiring up, used my DC PSU to provide the 12V for the relays and fans and, after a final check for short circuits, connected the battery and charger and turned the input mains power on.

I'm happy to say that everything works fine. At least to start with!

All three inverters running consumed about 45A, which is about half of what they should be drawing.

A quick check revealed that the main battery disconnect SSR was dropping about 1V, the 1KW inverter DC SSR was dropping about 0.7V, and the 500W SSRs dropping about 0.5V.

So the 1KW inverter voltage was 1.7V down, and both 500W inverters were 1.5V down. Not ideal, as the inverters are producing about 1KW between them. Without any voltage drop they produce approx 1.5KW. It'll do for now, my typical evening usage is 900W so it will cover that nicely.

The main battery disconnect relay did get nice and toasty, which tested the temp sensor and cooling fan which worked perfectly. Cut in at about 70 degrees C and turned back off at about 60 degrees C.

After running the system for 20 minutes the two smaller inverters turned their cooling fans on at an internal temp of about 45 deg C, and I know that the 1kw inverter cooling fan works when I tested it in isolation.

So, happy that everything was working properly I turned off both inverters, checked the battery charger and it's relays (both good), and was just turning everything off to finish for the evening.

The battery charger was on and charging at it's minimum of 6.6A. I turned the main battery SSR off, and the charger current sat at 6.6A. Uh? What's it charging? The battery is disconnected. Oh no it's not! The SSR has fried itself and short circuited. I was monitoring it's temperature and it only got upto about 80 degrees C, and I have checked the specs of reputable brand SSRs and they are good for 125 degrees C. Just goes to show that if you buy cheap SSRs, you need to derate their maximum current and their maximum temperature by a lot!

Not a big problem, as it was dropping 1V across it I think I will change it for a good old fashioned 300A physical relay. I didn't want any moving parts anywhere (yes, I know, the fans are moving parts!), but to get the system working at maximum output power it's looking like I'll need to change all the DC SSRs for normal relays.

If any readers know of any eBay sellers selling decent 300A relays (and 100A relays too) please do let me know.

Well, it is a prototype system so finding out parts aren't suitable is part of the game! :)

Piccy of the controller board (excuse the mess at the bottom of the board - this is all the controller wiring connected to the switches, this will all be tidied up when the R-Pi and I/O boards are installed)





Components from left to right, top to bottom:-
Top row
* DC current shunt (partially hiding behind the black box)
* DC fuse box (the black box just under the DC current shunt), 250A main fuse, 75A for 1KW inverter, 60A for each of the 500W inverters, 100A for the charger)
* Main battery SSR (fried)
* Charger DC relay
* DC ground distribution block (hey, it's huge I know, it's what I found on EBay and I couldn't be bothered to chop it down :) )
2nd row down
* DC relays for 1KW inverter
* DC relay for 500w inverter #1
* DC relay for 500w inverter #2
3rd row down
* 1kw inverter
* 500w inverter #1
* 500w inverter #2
4th row down (just below the 500w inverters)
* AC relay for 500w inverter #1

* AC relay for 500w inverter #2
* 4 x main fuses for the AC connection for the three inverters and the charger
* Main AC distribution block
5th row down
* Main 240V AC grid connection (almost off picture to bottom left)
* Charger 240V AC connection (almost off picture to bottom left)
* AC relay for 1kw inverter
* AC relay for 2.5kw charger
* Temporary manual switches used to test the other components