Showing posts with label Solar. Show all posts
Showing posts with label Solar. Show all posts

In praise of Adafruit IO

After a long delay on the delivery of the solar panels I want for my solar mesh nodes, I finally got around to doing some testing with them.

Unfortunately I was away from home and relying on tethering to a mobile phone for access to the Internet so using my home MQTT server for logging wasn't impossible, but was going to be inconvenient.


It occurred to me to give Adafruit IO a spin as it's designed for making generic IOT logging easy to set up.

Quick and easy to get working it has been logging just fine and I've not swapped back now I'm home. The dashboard is basic but all I need for this test.

In the first graph you can see the VPCC feature of the MCP73871 working well to avoid flatlining the voltage from the solar panel under load. It has a target voltage (arbitrarily set to ~5.3v here) and reduces current draw if the supply voltage drops below this. I've added a small trim pot to my test board to allow me to tweak this and do some runtime comparisons.

VPCC isn't MPPT but it will get better efficiency out of the panel than simply drawing until it can give no more and the voltage sags below a useful level. In the second graph you can see how without VPCC set the load on the same panel causes cycling like this, which also won't be doing the LiPo cells any good.

I have an idea ruminating to use an I2C controlled potentiometer along with a current sensor to make adjustments on the fly to try and optimise the solar output but it may be a minimal return compared to doing the tests once and picking a set value for VPCC. It will certainly increase component count.

There are packaged up MPPT solutions around, but there seems to be a gap in the market with them either super-efficient energy harvesting for tiny panels, or for large domestic/industrial power solutions. My scenario of ~4W panels with a ~100mA load isn't something I've spotted a good packaged solution for.

It wouldn't be impossible to roll my own MPPT boost convertor in front of the MCP73871 but like I said very likely to involve diminishing returns over careful use of VPCC.

Solar charging ESP-Now BATMAN prototype 6

Prototype 5 sucked, trying to bodge in the ESP32-S2 breakout to the old board just didn't work well, so I did another prototype. Also as I now have the Nordic Semiconductor Power Profiler II, testing and measuring power use is so much easier and I could ditch the INA219 current sensors. These added a lot of mess to the previous prototypes.

As it's easy to adjust the voltage from the PPK2 it almost stands in as a dummy solar panel, although you can't current limit the output.

This latest prototype mostly came about because I designed a new schematic in EasyEDA, had a crisis of confidence about pin choice and how well it would work and resolved to just build it. Also it's Chinese New Year and I'm not in a hurry to order the boards.

I'm now absolutely set on using the ESP32-S2 for this project but I'll run this prototype off the panels for a few days and see how it behaves.

Update: I can't continue using the PAM2301 buck regulator I had intended to, testing showed it 'trips out' when panel voltage is ~6v. Which is fair enough given that's what's in the data sheet, but my expectation was charging load would keep voltage on a 5.5v panel below that, even though no-load voltage can be quite high. This is not true.

Solar charging ESP-Now BATMAN prototype 5

 After generating some good data on power use of the ESP8285, I've finally got around to sticking an ESP32S2 into the same board using a hand-soldered adaptor based around a programming board. The board has LEDs on but I can probably account for this extra load. Mostly I want to know a rough equivalent power usage.

With a little tweaking of the code it runs fine, so I'll conduct a charge test over 24 hours and see what the graphs look like. If it's promising I may be migrating the project to an ESP32S2 because of the extra pin count and resources. Squeezing an SD card slot in along with the connections to the charge controller uses almost every usable pin the ESP8285 has.

Also, while I don't want to include a USB FTDI chip on the board, a spot for an OTG USB connector is another matter as by itself it uses no power. It would allow my board to also run CircuitPython, which is quite popular and were I to stick some on Tindie broaden interest I think. It's also a nice 'desk charging connector' and the 5V could go straight to the charge controller. The added component count would only be the socket itself and a resistor I think.


In winter, this is what you resort to.

I've been doing more work with the MCP73871 charge controller today, initially playing with my bench PSU and taking readings from the INA219s I've built into the board to simulate varying amounts of available supply from solar panels.

This didn't quite work as VPCC reduces the load on the supply but as the voltage from my bench PSU isn't actually sagging it keeps reducing the current until it hits zero because the voltage never recovers.

With very little daylight on an overcast winter day I resorted to an old school halogen spotlight playing directly on some solar panels to test how it really behaves.

Starting out with a fixed resistor network for VPCC I could see that it was doing some form of load regulation but not what difference it makes as it varies, so this got changed for an old guitar potentiometer I had kicking around.

It's very tricky to set by tweaking the pot. As you change the VPCC threshold for the voltage from the panel it does change the load on the cell slightly but beyond a very narrow range, it stops charging.

Grabbing the data once a second I put this into a spreadsheet and did a scatter of the power provided vs the voltage from the panels, which is moderated by the VPCC threshold.


I'm no scientist but this seems to make it reasonably clear the best power was extracted from the panels when at about 4.5-4.7v under load. This is completely at odds with my initial thinking to set the VPCC threshold at or slightly under the nominal voltage of the panels I'm using, which is 5.5v.

Below about 4.4v we start running into the problem of there being not enough headroom above the battery voltage to allow for charging and it stops dead. More headroom could be had from a higher voltage panel, but then you start approaching the 7v limit on supply for the MCP73871, the highest I'd like to go is 6v.

I also visualised how the power is used over a day of real usage. Even when there is not enough sun to power the board, the panels support the battery, reducing the amount of power taken from it. This is exactly the behaviour I wanted from the charge controller. Anything 'negative' is where panels are powering the ESP8285 and charging the battery. Which now I look at it, feels pretty good for a winter day. The big spikes are when the sun came out briefly and made for a bright afternoon. It's the great stretch of darkness in the evening that really sucks the life out of the battery.



The main outcome of all of this testing is it's shown me that VPCC has little beneficial effect with the panels I have and had I set it by instinct it would have severely compromised charging. Bypassing VPCC and allowing the MCP73871 to draw as much power as it wants lands them in the 4.5-4.7v range which is where they appear to be most efficient anyway.

The other outcome is I have ordered some larger (165x165) 6v panels as all this was making me come around to the idea I just need larger ones. This may help offset things further so the dark evening doesn't leave such a charge deficit overall.

Interestingly during this testing when charging from USB I'm seeing one bit of behaviour that doesn't match the data sheet.

In the datasheet it says..

The MCP73871 device USB-Port current regulation set input (PROG2) is a digital input selection. A logic Low selects a one unit load input current from the USB port (100 mA) while a logic high selects a five unit load input current from the USB port (500 mA).

In practice with PROG2 high I see it max out at 400mA. No matter, I won't often see this as an issue with the little solar panels I expect to use in normal conditions.

Solar charging ESP-Now BATMAN prototype 4

After the last test run, I decided I wanted to investigate the supply load tracking feature of the MCP73871 charge controller to see if it improves charging. With a small solar cell in winter, it will be very easy for the charging circuit load to drag down the voltage from the cell such that it ceases to be of use.

In order to see how well this works you also really need a good measure of the voltage and current at both the battery and the charging input. Which means adding the INA219 modules back again after I took them out.

Having considered reworking the previous board it's just too untidy and with the SD card reader attached the ESP8285 doesn't have enough pins to go around. Using socketed modules allowed me to just make a new carrier board and swap them over. I also made a big effort at tidier wiring, the last one was offensive.

The supply load tracking feature on the MCP73871 is called Voltage Proportional Charge Control (VPCC) and reduces load to the supply if the voltage drops below a threshold. VPCC needs a simple voltage divider that provides 1.23v (or more) at a pin while the supply is OK. If this voltage drops, it reduces current draw to bring it back up. On the new board I've fitted a small socket header so I can fit different values to the voltage divider.

We're also getting to the time of year where it might go below freezing and the thermal protection circuit needs testing. So I've added another header for the thermistor network, temporarily bypassed with a resistor while I fiddle with the VPCC in isolation. I'm going to move my test location to near an indoor window where there's more sun for more of the day and hang the solar cell out of the window. Once I've investigated the practical worth of VPCC I'll add the thermistor network and do some tests with heating and cooling it.

Solar charging ESP-Now BATMAN prototype 3

After the component selection failure with my last solar prototype, I resolved to have another go.

This time, I decided to build as close an equivalent as possible on stripboard despite the presence of several SMD-only components. For this I needed a QFN20 breakout and with the buck convertor, I used one of the first boards I had made, cutting off the large empty sections. The QFN20 was not fun to solder but it works.

I'm glad I went through this step as it showed up a poor selection of GPIO pins for the connection to the MCP73871 charge controller. My very first prototype used an evaluation board and not all the connections are broken out on it. Moving the status connections to the ESP8285 did what I wanted but dragged one of the pins low and stopped it from booting in some states. This is one of those things that again I should have picked up from reading the datasheets, but didn't.

With a little shuffle of pins, the prototype is ugly but seemingly nicely functional so I've dropped it into the shed to test. Late November is a bad time for solar power in the UK, so it's a bit of a 'torture test' of charging viability. It's quite likely to fail as I've not put much in the way of smarts yet about when it sleeps or switches off the radio.

In the meantime I've bought an ESP32S2 module and breakout adapter from a Tindie seller. I may build a second prototype based around this as the S2 is like an ESP8266++ with Bluetooth support and lots more resources without seemingly much more power draw. The extra GPIO pins won't be unwelcome too, the ESP8285 has few and I've ended up re-using the UART pins. Not a big deal but it means you can't have Serial debug info with the charge controller working and you need to rely on OTA updates after an initial upload of the code.

Update

This prototype ran for roughly 66 hours before the battery got low and it started sleeping in an attempt to allow the sun to charge them. That's plenty enough for my requirement of a full weekend's service.

However, from the logs it looks like it only spent 4 hours actively charging the battery, which is shockingly low even given its shady position in the low winter sun. As the MCP73871 only has three binary status indicators I don't feel I have enough data to be clear what contribution the solar panel was making to the runtime so I am going to modify this prototype and add an INA219 current monitor inline with the battery.

Rookie SMD mistake

 

I received the new boards from JLCPCB and they look great, but I've made a real rookie mistake when ordering.

Working in EasyEDA, component selection defaults to 0201 packages for things like the resistors.

These are tinyReally really tiny.

This is something I already knew and just missed it when laying out the board.

I realised my mistake when ordering the components but thought, let's give it a go. I have made an attempt to solder these but with my ageing eyesight I can barely see and handle them, let alone apply paste and hot air to successfully solder them.

Now with the ongoing pandemic I don't have any immediate application for these boards, so I'll pause a little while before coming back to them and producing a new version. Either I'll choose larger components or have JLCPCB do PCB assembly for me, which is increasingly affordable.

Solar charging ESP-Now BATMAN prototype 2

After over two weeks continuous running my first prototype of the solar charged prototype proved itself with a 2W panel. So I spent a chunk of time designing the next iteration in EasyEDA and ordered five PCBs from JLCPCB in China.

I've taken a small gamble with this design as I haven't built it on breadboard first and have added a number of new features.
  • Thermal protection for the 18650 cells, a feature available but omitted from the MCP73871 evaluation board. They will now only charge in temperatures of 0-50C, which is a default safe option. I don't feel this will kick in often in the UK except perhaps on a very sunny but cold morning however to omit this feature would be slightly negligent.
  • Replacement of the INA219 current monitors with a simple resistor ladder to measure supply voltage after the charge controller with the ESP8285.
  • Connection of the MCP73871 status pins to the ESP8285 rather than indicator LEDs.
  • A microSD socket for optional file storage.
This is quite a simple project compared to the people making their own small board computers or things based on FPGAs but it's only my second ever manufactured PCB. All the pins on the ESP8285 board are in use, although in principle IO0 which has a button attached for putting it into programming mode could be doubled up with for something else so long as it defaulted to a pullup.

Instead of going straight to the final run of boards I'd like to test these five before ordering more. I made absolutely no effort to keep it compact so even if no changes are needed I'll still move things around and tidy it up before the final order.

Once these arrive I'm hoping the extra efficiency of the PAM2301 regulator will make a 1W panel viable in the UK but if not, 2W panels aren't overly huge.

Solar panel doubling

 A bit of data logging showed a single 1W panel useful for supplementing battery power to my mesh network node, but not really enough to charge it meaningfully at the same time. My garden is south facing and the house blocks direct sun lots of the day so it was only the few hours where the panel was in strong direct sun that the result was acceptable. For something that spends a lot of the time asleep this would be reasonable but as I want each node to run for all the waking hours then I need it to do better. I did get 52 hours of runtime, which is technically enough for my needs if I fit two 18650s in the node, but I still don't like the thought of it running down constantly with only a tiny amount of headroom.

The data also shows the regulator board I took out of a drawer is an LDO, not a buck converter, so it's 60% efficient a lot of the time. I will make a pin compatible replacement with the converter I specified for the final boards and that should be a big help.

I've now set up two 1W panels in parallel to make an effective 2W panel. Only a few hours later it's clear this makes a massive difference as they spend lots of time charging the cell rather than just 'treading water'. I'll leave the test to run until the battery protection kicks in at 3.5V but it looks like 2W panels really are what's needed even if I were to replace the LDO. There are some really quite affordable 2W 5.5V cells on Banggood, so going up in size isn't a big deal.

Solar charger data logging


 After a little fiddling around today I had software on ESP8285 node so I can keep track of the battery use and how well the MCP73871 manages things.

Working at my desk it seems to seamlessly charge then swap over to battery if needed, but more importantly if there's roughly 0.5W charging capacity, which is what I'm expecting from the solar panels I have, available it'll run the ESP8285 and use excess to top up the single 18650 I've fitted for now. This is exactly what I was hoping for from the chip, but what's not clear yet is how well it works around dawn and dusk. Playing around with my bench PSU would give me some idea but with solar cells varying voltage under load I've just gone straight for a practical test.

The code I've put on isn't anything like the final application but it does sit there connected to WiFi pushing data to MQTT every 30s so it's a pretty reasonable test. I'm dropping the output into a .csv file on my server and I'll look at it periodically to see how the battery fares. As I wanted real timestamps on the data I used the quite nice ezTime library to sync with NTP but more importantly maintain a usable time based off the ESP8285's internal clock and only periodically update it. This is a feature I will need when things happen for real, although I'll probably have to use GPS and a local NTP server due to lack of guaranteed internet access.

Also Blogger has changed and all my layouts are broken. Sigh.

Solar charging ESP-Now BATMAN prototype

Putting a 'production' board together rekindled my interest in a solar charging prototype of my mesh network nodes.

A small solar cell in typical UK weather is not going to be able to run the node 100% of the daytime, but it will almost certainly work as a useful 'runtime extender'.

I started looking at this way back last autumn then like a lot of things my enthusiasm waned and it languished in a box for months. Today I finished off putting it together to a point where I could knock some software up and start logging charging/load data.

I'm using the same ESP8285 module I have for the nodes, with an MCP73871 development board for charging and power management. The naive approach would be to stick a conventional LiPo charger in parallel with the batteries but the load messes with the charging.

The MCP73871 manages the power path so that depending on the charging power available it will run the load from that while also charging the batteries, run the load from it, or once it it is too low run the load from the batteries. As the battery isn't directly connected to the load this can be done while maintaining proper charge behaviour for the LiPo. It is not proper MPPT tracking for the solar cell, but it does sensing of how much current it can draw before the voltage drops too low that will have a similar effect. For extra efficiency a DC-DC converter that does MPPT would help, but I'm going to suck it and see if this prototype is 'good enough'.

I've shoehorned several INA219 current/voltage sensors into the power path so I know the battery, charging and load detail. My plan is to stick this inside my shed, with a solar cell outside and simply log the data until it falls off the network because the MCP73871 has decided to protect the battery.