# solar power ESP8266 microprocessor circuit to turn off when low voltage

I intend to run an esp8266 microprocessor on only solar panels so it is on during the day and off/disabled during low light conditions that do not supply sufficient power.

Is there a circuit that will hold the esp8266 reset low until voltage is sufficient (>3v) to power the esp8266? Hysteresis would be beneficial.

• Why are solar panel specs in mAh (milliampere-hours)? Feb 4, 2016 at 6:34
• @Lendog: I think you've asked a good first question but the actual question is lost amongst all the surrounding text and you're getting some down-votes. Edit it again using the answers and comments below as hints to clarify. Separate the important stuff and the real question from all the supplementary information. Feb 4, 2016 at 7:32
• Don't cut the power, toggle the CH_PD (or Reset) line. That's the chip enable. Pull it low to turn the esp off. Its a standard high impedance input so it shouldn't have the problems your experiencing. Feb 4, 2016 at 8:26
• @NickAlexee confusion between Ah and A is very common with people who lack throughout knowledge of electrical theory but who do work with batteries, such as the radio controlled model community. To clarify, Ah is a unit of electric charge (equivalent to 3600 coloumbs, so 1 Ah = 1 Ampere for 3600 seconds), while A (with no "h")is the unit of electric current.
– jms
Feb 4, 2016 at 10:08
• Thanks for the input and suggestions. I've reworded the question to make is simpler and easier to understand. Also i apologise for the mAh typo, i meant mA (to much fiddling with rc lipo's) Feb 5, 2016 at 11:43

## 4 Answers

simulate this circuit – Schematic created using CircuitLab

Figure 1. Voltage detection circuit.

I suggest that you need a circuit to hold the reset pin on your micro until solar output is high enough to reliably power the circuit. Figure 1 uses a comparitor to do this function. When the supply voltage divider, R3 - R4, exceeds the R1 - R2 setpoint the micro will be enabled. (You need to figure out setpoints and whether to invert the logic or not.)

Note that you may need to add some hysteresis to this to prevent rapid cycling as you load / unload the solar cell.

• Yes, this is the kind of circuit I would suggest. You can add hysteresis to this circuit by connecting a resistor between the + input of the COMP and the COMP's output. This resistor needs to have a value of about 10x to 20x the value of R4. Feb 4, 2016 at 7:34
• Adding hysteresis would be great, otherwise the esp8266 might be switched on and off multiple times during the transition due to minor fluctuations in panel voltage.
– jms
Feb 4, 2016 at 9:55
• Looks like what I'm after. Any suggestion on what compactor to use? Thanks for your useful comments and guidance. really appreciate your help. Should i tick that as 'accepted this answer' or wait till I've tested it? Feb 5, 2016 at 11:52
• Is a lm324n an overkill for the job? I already have a spare one but it has 4 comparator on the one chip Feb 5, 2016 at 12:22
• If you have one then use it! Feb 5, 2016 at 12:54

When the solar panels provide no power you need to get that power from elsewhere. Circuits do not generate power, they only store and/or consume it. That power can be stored in a battery or capacitors. Capacitors cannot store large amounts of power unless they are very large. Rechargeable batteries are more economic in that respect.

For a full night without sunlight you need to use batteries or you could use a power adapter to provide the power from mains. Silly options are: a (diesel) generator, animal or human on a treadmill, something mechanical to store/release electrical energy.

In the end a (rechargeable) battery is the simplest solution. So that is why almost everyone is using that.

How to connect the solar panes and batteries so that switching between them is automatic is asked and answered many times already on stackexchange, just search for that.

Edit: after a comment it appears that this is not what you're looking for. I was confused because you sort of steered your question into the "maintaining power" direction while you don't need that !

What you need is a circuit that keeps the uC in reset when the voltage from the solar panels is too low. You can do this with an opamp or comparator. It also depends how the esp module needs to be reset (active low or high).

Switching on/off the power to the esp module like you suggested in your question is not a good idea as it allows the system to enter in an improper state. Normally the esp module will perform a "power-on reset" when power is applied but it is not good practice to rely on that when the power goes up and down as in your case. What you need to do is keep the ESP in reset while power is not OK.

• I think you've misunderstood the question. He doesn't want overnight running of the micro - just when the sun shines. He does want clean switch off and on with changing light levels. Feb 4, 2016 at 7:11
• Probably, it is not so clearly stated what he wants. Feb 4, 2016 at 7:14
• OK, he needs a sort of "reset until power OK", but he babbles on about other irrelevant things. Feb 4, 2016 at 7:17

So far, there's no such thing as as a perpetually free lunch and, as FakeMoustache has already stated, you need an arrangement to ensure that power to the ESP8266 will be cut off until such time as the PV can deliver the ESP8266's maximum rated current and then connect the PV quickly enough to the 8266 to bring it out of RESET.

You'll also have to deal with the fact that when the sun goes behind a cloud and the PV can no longer support the 8266 you'll have to do the same thing as when the sun first came up, unless you don't mind power outages to the 8266.

If you do mind, then you'll need some sort of storage in order to run the 8266 during those "brownouts", which is where your otherwise free lunch gets expensive.

The most logical choice, it seems to me, would be a rechargeable battery, and which type of battery would be best would probably depend on the rooftop environment.

Also, keep in mind that the capacity of the PV will now have to be increased in order to provide power to the 8266 as well as simultaneously charge the battery.

Lastly, I think, you'll have to provide some means to distinguish day from night so that when the sun goes down your widget will power down instead of thinking that the sun just went behind a very large cloud and run on into the night.

Take a look at this, it might be what you are looking for. It can turn the mp on based on light level. https://www.amazon.com/Icstation-Channel-Control-Switch-Photodiode/dp/B01GCOHUTQ/

• This isn't a very general solution and looks like it's intended to control larger loads than a single microcontroller. An external voltage monitor would probably be a much better with a similarly low-power light monitor, if also needed. Jun 22, 2016 at 23:07
• Not to mention it's a link-only answer with essentially no extra information, making it completely useless when the link goes away.
– pipe
Jun 23, 2016 at 0:32