Close

Solar Charger - First Prototype

A project log for Roadwork Warning Lamp Solar Power Station

Hacking a roadwork warning lamp into a solar power station

tiefpunkttiefpunkt 04/14/2021 at 21:580 Comments

After digging through more and more parts bags, I finally found 2 P-channel MOSFETs, so I can actually start prototyping the circuit for the solar charger. The instructable the charger is based on uses a normal 16x2 LCD, but that's too bulky for the lamp. I instead wanted to use a much smaller OLED screen, controlled via I2C.

The particular display I have seems to use a non-standard I2C address, so it wouldn't show anything at all at first. Luckily, there's an example in the Arduino IDE which can scan the I2C bus for devices and show their addresses, so this was not too troubling.

The Arduino libraries for the 16x2 LCD and the OLED seemed mostly compatible, so this was a fairly easy replacement. One interesting issue is that the "setCursor" function of the LCD library thinks in lines, while the OLED library thinks in pixels, so instead of printing something to the second line, I initially wrote the second line almost completely above the first, offset only by a single pixel. This as a bit irritating and took me a second to figure out, but the fix was quite easy, just multiplying line values by 8, column values by 6 (the font is 6x8 including borders).

For my first try, I skipped the load switching MOSFET completely, and used a beatup lead acid battery instead of my Li-Ion pack, as to not blow stuff up right away. And surprisingly I actually got it to charge a little bit.

In the full sun however, the algorithm responsible for switching the charging MOSFET went a bit crazy, and I had to add a PID controller lib to smooth things out. I used the Serial Plotter in the Arduino IDE to quickly display some values from the Charge Controller, and that worked wonderfully. Seems like there's little documentation on that Plotter functionality, maybe I need to write a separate blog post on that.

So we have a working charge controller now. Next steps will be putting the code up somewhere, adding the rest of the circuit onto the proto board and sketching the changes in the circuit. Let's see when I find the time to do that.

Discussions