Thursday, March 2, 2017

MPPT Solar Charger - Introduction

Please note: This project is probably 90% completed. The remainder is giving me hell. So currently it should only be considered for reference. 

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 and current of the solar panel and the battery. Rather than using the devices that soldernerd used, I used INA219 modules available from Adafruit or the knockoffs available on eBay (example). These are also I2C and simplified things for me. However the jury is still out on these. During my fumbling with the circuit I managed to smoke severial of these.
  • 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.

OK, if you've read this far you are probably ready for some pictures! Not to disappoint you but those of the MPPT board are preliminary and not very well done. They will be replaced with my "Rev B" board when finished but they should give you an idea.

First, here is the "ESP Swiss Army Knife" that I have already used in my watering project on top of the MPPT board ...
You'll notice that I am not reading from the solar panel because I was missing a INA219 module.
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 terrible photo of the Rev. A 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.

The empty pads are for an 74LS14D Schmitt trigger which can be used to supply an inverted PWM signal in case I want to use the MOSFET driver that requires a high and low input rather than just a single PWM input.

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 empty space in the middle will hold the two INA219 modules.

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 current 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.