In a previous post I have presented a design for an MPPT Solar Charger. In the mean time I have built a prototype and also wrote some software for it. So today I’ll go through my findings of what works well and what needs to be improved. And yes, there are some flaws in the design…
The software is far from final but with the notable exception of USB all the basic functionality has been implemented.
Power Supply
One of my main goals with this design is to archieve very low standby current, somewhere in the tens of microamps. The basis for this is a low-power buck on the basis of a Texas TPS62120 where the microcontroller can switch the output voltage between 2.2 and 3.3 volts nominally. This works as intended. With no load and the output voltage low, the supply consumes 12.9 microamps at 12V input voltage. With the high output voltage the idle current goes up to 14.3uA. Quite a bit of that current is due to the voltage divider that sets the output voltage. The regulator itself consumes about 9uA in both cases.
Microcontroller
The PIC18F26J50 starts up using the primary oscillator’s 8MHz crystal with the internal PLL disabled. It can then switch to 48MHz operation by enabling the PLL or to the secondary oscillator running at 32.768kHz. The latter is always running since it also serves as the clock source to the real-time clock and calender (RTCC). Switching between clock sources as well as the RTCC have been implemented in software and work fine.
I2C Multiplexer and Port Expander
The microcontroller doesn’t have enough GPIO pins so a I2C port expander (Microchip MCP23008) is used to give us another 8 pins. The display is connected via I2C as well but since the display is entirely powered off when not in use, the display cannot be on the same bus. Otherwise it will pull the SCL and SDA lines low and block the bus. The NXP PCA9546 multiplexer takes care of that. Both devices, the mux as well as the port expander work as they should.
Voltage Reference, Temperature Sensors and Fan
There is a total of 3 temperature sensors, one on the board and 2 external ones. The temperature is measured by the PIC directly so it has a 2.5V voltage reference in order to get meaningful results. At room temperature all three temperature sensors deliver very similar results, typically within a few tenth of a degree. Better than expected. The fan output can also be enabled if the on-board temperature gets too high.
Voltage and Current Measurements
The more important measuements, namely the input and output voltages and currents are performed by a MCP3424 4-channel 18-bit ADC. I was already familiar with that type so I quickly got it to work. In this application I don’t use its internal PGA (programmable gain amplifier) or rather I leave the gain at 1. All the measurements are done with 14bit accuracy which is reasonably fast (23ms worst case) and sufficient here.
User Interface
The debouncing of the rotary encoder works ok but I’ll tweak the resistor and capacitor values a bit when I get time. The push button is uncritical but there is a bit too much debouncing for the rotary encoder itself making it miss some very fast turns. But it already performs reasonably well as it is.
The display module is the first real flaw in my design. It has 5 wire connections: GND, VCC, SDA, SCL and Backlight. The idea was to turn the display off by simply cutting off VCC when the display is not needed. When in use, the brightness of the backlight is then controlled by the Backlight PWM signal.
Since the display needs quite a few supporting components (mainly 1uF capacitors) and has no mounting holes I made a little one-sided PCB for it. When I first tried it nothing worked. A ground connection was missing and I didn’t notice that in Eagle because in Eagle it was a double-sided board. That was easily fixed by a short piece of blank wire soldered in place. So far so good.
Unfortunately the display (a Midas MCCOG42005A6W-BNMLWI) still didn’t work. Besides the data sheet being a nightmare it needs to be reset after having powered up. So you need to power it up, wait for a while and then do a reset by pulling its reset pin low. So just pulling the reset pin high with a resistor like I have done won’t work. My solution for now was to connect the backlight signal to the reset pin. So I can now use the display but the backlight brightness is permanently at it’s maximum.
I already have a new and hopefully better version of this display unit in the making and there will be a separate post on that. My idea is to have a rather universal module that I can use in other projects as well.
USB Charging
The USB charging module works reasonably well. When pulling the full rated current of 2A it gets rather warm but doesn’t overheat. I was able to pull 2.5 amps for a prolonged period of time without any issues. I only had a Samsung A5 to try but at least that phone charged perfectly fast pulling around 1A of current. With that load the module only gets slightly warm.
Turning the USB charger on and off in software also works as planned. This can now even be done via the user interface – see above.
Power Outputs
The 4 power outputs can be controlled in software. In order to save power, the mosfet drivers can be powered off if none of the outputs is on . All that is already implemented in software and the outputs can be turned on and off individually via the user interface.
I plan to implement a low-frequency (say, 100Hz) PWM functionality for these outputs in order to e.g. control some LED lighting but that has not been done yet.
EEPROM
I haven’t implemented any data logging functionality yet but I have written a few library functions for the EEPROM. When the date and time is set via the user interface those values are saved to EEPROM and restored after a reset. Reading from and writing to the EEPROM therefore works.
Solar Charger
Yes, I’ve left the main thing for last. Don’t know why.
When I first assembled the board I noticed that I had ordered the wrong mosfet driver – a MIC4605-2 instead of a MIC4605-1. They are near-identical except the fact that the -1 has two independant inputs while the -2only has one PWM input plus an enable signal. That also works but doesn’t give us the option to run the converter in asynchronous mode. So I’ve unsoldered the chip again and replaced it with the MIC4605-1 that I had in mind when I designed this thing.
As you can see on the photos above, I’m now using a 22uH coil, not a 68uH coil as shown in the schematic. The reason for that is that I’m using a relatively high switching frequency of 48MHz / 256 or 187.5kHz. That high switching frequency enables me to use a lower value inductor which massively increases its current rating while pyhsically being the same size. Since the inductor was the limiting element in this design before this significantly increases the power rating of this solar charger. The previous version was (very conservatively) rated at 30 watts only. With the new 22uH inductor this very similar design can handle something like 75 watts. I need a more powerful power supply to do some serious testing but at 35 watts it’s getting slightly warm at the most. I’ve only done some quick and dirty testing but efficiency at 35 watts is around 97%. That means we are only losing about 1 watt which is the reason the charger barely gets warm.
There will likely be another post focussing only on the charger itself so I won’t go into more details here. The code regarding the buck is extremely basic and potentially dangerous at this point. I’ve killed the bottom mosfet twice due to the not very graceful way the buck turns off. If it turns off while the bottom fet is on, that fet will stay on, effectively shorting the battery to ground. At least that’s my explanation at the moment.
Oh yes, there’s another issue with the buck as well. With the battery at its output there will always be the battery voltage minus a diode drop at its input where the panel is connected. So when there is no sun, the battery is powering the panel. I’ve tried that with a small 30W panel and the panel draws 8mA at 12 volts which several magnitudes more than we are willing to use when the charger is sitting idle. So the next version will have to disconnect the panel when the charger is off. And we will also need to disconnect the voltage divider at the charger’s input when we’re not measuring the voltage, just like we’re doing at the battery.
Summary
There are a lot of features on this board and getting them all to work properly requires quite a bit of work. But most of the heavy lifting has been done so I can now focus on improving the software.
First and foremost I need to work on the way the buck is controlled. First there needs to be a strict and safe procedure how this thing is turned on and off. I’m confident that there won’t be any blown-up mosfets once that’s done. Then I also need to improve the algorithm of how the maximum point of power is tracked. And I also want to implement asynchronous operation at low loads in order to improve efficiency. I’ll spend some time on all these issues next, looking at the signals on a scope and trying to improve things.
But all-in-all I’m quite happy with how how this design has performed so far. Yes, there are some issues but nothing that can’t be fixed with relative ease.
For those of you interested, the code can be found under downloads on the overview page. In my next post we will take a closer look at the display unit / user interface.
Thank you for your posting the design and blog of this project. I’m curious why when you began running out of pins you just didn’t use one of the other 18F series with more pins. I didn’t look at their page to compare, but normally they go up to many ports and pins with continuing expansion of capabilities same power (almost). If you have never been to their Master Conference, I highly recommend it! Also, there are several cheap touchscreen displays that provide more flexibility than the 4X displays. I’m just always curious about choices. But I understand using whats on hand also!
Thanks again
Hi Mitchell
The PIC18F46J50 is the top-of-the-line model of this series. I’m not even sure if there’s a PIC18 with more than 44 pins. But for sure upgrading would mean moving on to a different series which would mean more changes in software.
Lukas
very excellent project! can i get the arduino or pic coding
eklavyainfo@yahoo.com
Hi Vinod.
Thank you. All the PIC code is on github: https://github.com/soldernerd
The Arduino code can be found on the blog as a .zip file together with other files I believe.
Lukas