Exploring Solar Power - Are sure the safety is on?
OK, so we are getting closer to reality here. Since the last article, I have made some small changes, which helped things out.
Firstly, I added a 1000uF/63V filter capacitor to the battery output. This practically eliminated the serious "hunting" issue that caused the software to rapidly ramp PWM values up and down almost constantly.
Next I added two relays to the control circuit. The first is a battery cutoff, which will disconnect the battery if it is above 15V or below 9V, as these would indicate some kind of fault has occurred.
The other relay disconnects the solar panel on the same principal. If either of these events occur, the LCD indicates the nature of the fault.
In order for battery monitoring to work effectively, the voltage divider must be located between the relay and the battery. This way the battery can be reconnected automatically when the fault clears. I have elected NOT to do this on the solar panel side as an over-voltage condition probably means a serious fault has occurred and the panel is attempting to feed an open circuit.
The code has been updated on GitHub and you can simply make the necessary connections between arduino, relays and power.
Please note that there was a typo in the previous schematic diagram. The MOSFET device is an IRF4905. I have updated the image with the correction.
If you look closely at the photo of the prototype you will see there is a rotary encoder installed. Right now it does nothing (not even connected), but I want to add some more UI functionality and it was easier to drill the holes and mount the encoder at the beginning.
On the code side I have made another big change. I have moved from the Arduino Uno/Mega to an ESP32. There's a number of reasons for this:
- I want to add data reporting over the network, and it's just easier to SSL connections with an ESP32 than an add-on board.
- The ESP32 has a 12-bit ADC, so I get better resolution.
- The ESP32 is a lot faster (means I can do average sampling to eliminate noise from the ACS712)
- The ESP32 is a dual-core device. Hopefully, I can get the monitor/control one core and the network communications on the other. Control won't get hung up because of a network outage.
- The ESP32 is generally a lot smaller, so I can cram more stuff into the chassis.
The only downside is that the LCD display is supposed to run on 5V, and while it works on 3.3V, sometimes the I2C interface board seems to go "off with the pixies". I may need to add some level shifters to correct this problem.
The next step will see a bigger (60W) solar panel replace the tiny ones I have been using so far