Thursday, March 2, 2017

MPPT Solar Charger - Introduction

Please note: This project is probably 90% completed. The remainder was giving me hell, but I'm back at it. Currently it should only be considered for reference but I be updating it soon. 

First off I want to acknowledge and thank "soldernerd" for the inspiration and education. His blog posts on his MPPT charger are nothing short of fantastic. They are one of the most thorough writeups I've seen for any project, and his hardware and software design are totally professional. If you are interested in any solar MPPT project you should go through his blog - which is here. In fact some of the below will assume that you are familiar with it.

So I have borrowed from his project heavily, but I have also adapted it to my own needs and skills. Here are the main differences . . .
  • The main processor is an ESP8266 rather than a PIC. Besides that fact that I'm not familiar with the PIC, the ESP8266 allows me to easily monitor the performance of the charger on IOT sites. It also has all the memory I'll need, and is programmed with the Arduino IDE.

    The main disadvantages of the ESP are that they are power hungry and have limited I/O. To address the power issue, the ESP will sleep through the night and will only control the buck circuit intermittently during the day. However, since the buck needs a continuous PWM signal to operate, the PWM is supplied by an ATtiny85. The only job of the ATtiny85 is to read it's analog input coming from the ESP and set the duty of the PWM it supplies.

    The lack of I/O is handled by two I2C chips that I use a lot - the PCF8574  GPIO, and the PCF8591 - DAC / ADC. Between them they provide 8 digital inputs or outputs, 3 analog inputs, and 1 analog output.
  • An MPPT charger needs to know the voltage of the solar panel and the battery. In addition, it's nice to know the current from the panel and to the battery. I originally used the INA219 modules available from Adafruit or the knockoffs available on eBay (example). It was handy having an I2C interface for voltage and current. However after smoking about 8 of these I went back to a simple voltage divider for voltage and the ACS711 for current. A nice breakout board for this chip is available at Pololu. It is a lot hardier than the INA219.
  • I think soldernerd may incorporate an RTC at some point, but for me it is essential. Since it's a connected device, I am able to set the time from the NTP server. This allows the ESP to calculate the times for sunrise and sunset so it can sleep accordingly.
  • I added a pot to manually control the PWM duty. This is handy for testing. When running, the duty is controlled in the software for the optimum performance. This is a good time to acknowledge and thank another MPPT project where that idea came from. Julian Ilett has created a series of 20 videos which walk you through his Arduino based MPPT project. It's really amazing to see the work he has put into the models he uses to explain it. The first video in the series is here.
  • I used an I2C OLED display (example) for the ESP as I'm familiar with it and it's pretty readable in sunlight. The display will normally be off and only on when a button is pressed.
  • Rather than put everything on one board, I already had boards for my "ESP Swiss Army Knife" that I used for my garden watering project. These boards have the ESP8266, OLED, RTC, and the GPIO and DAC / ADC on them. I made a separate MPPT board that fits under it to provide the buck converter and other goodies for the MPPT charger.  
There are other changes of course. Note that even with the big head start I got from soldernerd, I have a couple of months work into this project so far. This is not a project you can knock off in a short time. It's also very unforgiving! I was stuck burning out chips for quite awhile. It turned out I used a 'byte' instead of an 'int'!

OK, if you've read this far you are probably ready for some pictures!

First, here is the "ESP Swiss Army Knife" that I have already used in my watering project shown on top of the MPPT board ...
As mentioned this board supplies the ESP8266, OLED, RTC, and the GPIO and DAC / ADC. There are a few parts on this board that are not used for this project - namely the moisture sensor, MOSFET, and SD card.
You can also see a bit of the MPPT board at the bottom.

You can find the schematic and board layout for this board in this post.


Here is a photo of the Rev. B MPPT board.


Since I was burning out MOSFET drivers during development I have it mounted on a green carrier board temporarily. There are also 2 variations of the MIC4605 driver - one only for a synchronous buck, and one that can support asynchronous as well. I will likely only be able to use a synchronous buck due to not having the knowledge to do mirrored PWM on the ATtiny85.

The ATtiny85 is in the lower center. It simply reads the requested duty from the DAC output as analog in, and supplies the MOSFET driver the PWM at 122.5kHz. Note that the DAC supplies its analog signal even when the ESP is sleeping so the buck converter will still run.

Beyond that are are the MOSFETs for the buck and additionally; 2 more for aux power, one to disconnect the panel, one to disconnect the load, and one to control power to the buck converter.

The 2 ACS711 modules are on the left.

Here is is screenshot of the data set by the MPPT Charger to the Sparkfun IOT site ...


OK, you may be wanting to see schematics, board files, and source code. A word of warning. At this point I do not suggest trying to build off what I have here, and indeed, I am not ready to cooperate. When I'm further along this project will be open source, but lets wait for the goal post to quit moving. I may even have some PCBs available. Another warning is that a project like this will likely cost more than you can buy a pretty good MPPT charger for.

Having said that, here is the schematic and board view for Rev. B of the MPPT PCB.




I have not mentioned the software yet. That will be a separate post and this is just an intro.

If you have general questions at this point, it may be best to wait until I am further along. Specific questions, and observations are welcome at any point however.