I have a solar light in the garden that is controlled by a microprocessor. A disadvantage of this project is that i cannot control the switching of the light. It automatically switches on when it is dark and v.v. at daylight. This means that in many cases the battery is drawn completely empty. Although it cannot deep discharge, there is a complete loadcycle involved. The battery has only a limited number of loadcycles so the life can be extended if we can lower the count of loadcycly. This brought me to the idea to use an ESP8266 for this purpose, because it knows the time.
The problems to overcome are:
The esp uses so much power that deepsleep is necessary to prevent deep discharge of the battery when the batteryvoltage is too low. But as a consequence of deepsleep nothing works anymore, the gpio pins float. So the design has to be such that the battery loading process is active during deep sleep.
How should this it work:
The ESP should prevent over- and underloading of the battery. We let it measure the voltage at time intervals. When the voltage is higher than 7.2Volt the charging stops by shorting the solar panel with a FET. When the voltage is lower than 5.4Volt the lamp is switched off, also with a FET, and the ESP goes into deepsleep for a period, say 3 hours. The wake-up implies a complete reset.
Furthermore, the ESP needs to know time in order to switch on configured times. The webpage shows information about the battery voltage, the condition of the loadcircuit and the configured switchoff time.
We can setup the timing as susch that the light switches on 10 minutes after sunset and goes out at 00.30hr, or in winter earlyer, thus limiting the number of cases where the battery is drawn empty. This should greatly extend the life of the battery. For the fun i also connected a ME280 temperature/humidity/pressure sensor that displays its information on the website.
What do we need.
- an ESP8266-12F
- a regulator 3,3v lm1117 or LM317
- 6 resistors
- 2 hexfets for the switching
- 1 tantalum capacity 0.10uF
- 1 electrolyte capacity 47uF
- a 6v solar battery and 5W solar panel.
Since the ESP works on 3.3 volt, we use FETS for the switching because they can switch with a very low gate voltage. The capacities are necessary to filter the power since long wires to the solar panel are used. Without them i had stability problems with the wifi connection.
I made a template sketch in arduino SDK that takes care for the network connection and configuration of the network credentials. This software scans the available networks and we can provide a password when needed.
With this template the development of functions that measure the battery voltage was easy. I soldered a little board and installed everything.
The ESP goes into light sleep for 30 secs, after each 30 secs it will check for requests on the webpage and measure the voltage. And checks if it has to switch the lamp or the load circuit.
Now what happens if in winter, on several days, there is no sun at all. Well, if the battery is empty it goes into deepsleep and uses very little energy. So the battery should survive this a couple of days. Assuming that even in winter on cloudy days, some energy will be produced by the solar panel. The light will stay out then.
Today i programmed a version that can be switched from the webinterface or with the tactile switch. Timers can be configured directly from the webpage. Now there is only radio needed at startup and for showing an information website. This is a rather complex programm that deals with daylightsavings time and sunset/sunrise times. The ESP deepsleeps for several hours after 02.00hr and when manually switched on, the lamp will always be switched off after one hour. So there is no danger of accidently drawing the battery empty.
For questions you can mail to firstname.lastname@example.org