This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Failed to load latest commit information.
ESP-12 based Solar Panel Monitoring System
This system helps you to remotely monitor the power of your solar panels, batteries and the DC load with a smartphone from anywhere. It’s based on the Nodemcu ESP-12 Wi-Fi module and Blynk application. The battery and solar voltage with the temperature will be displayed. It’s also possible by using buttons on installed app to decide witch batteries should be charged.
The charger is positive ground controller. (And this provide me a lot problems with negative grounded ESP.) To measure the currents I’m using two ACS712 modules (hall effect device). The ACS712 has to be fed with 5V and the analog outputs voltage is proportional to measured current on the sensing terminals. This sensor is bi-directional so it will give 2.5V output even if not current is flowing through it. The module gives a sensitivity of 0.1V/A in 20A and available in 5A, 20A and 30A.
I’m using ADS1115 in two channel and in GAIN_ONE mode. The ADS1115 is a 16-bit analog-to-digital converter. It can be addressed with one of four I2C addresses. (0x48, 0x49, 0x4a, 0x4b). In GAIN_ONE mode the voltage can be measured up to maximum 4V and provides a resolution of 0.125mV per bit. (4.096 volts / 32767 bits)
Visualizing the data on a Blynk Android App
The system is accessible through a Blynk app. The switching the batteries will sent from app by using virtual pins and the data can be easily access on app.
ESP32 on Solar
The ESP32 is a tiny, powerful, and inexpensive micro controller from Espressif. It has Wi-Fi and Bluetooth built in which makes it great for IoT projects. In this post I will talk about running an ESP32 on solar power. This post is not specific per-se to ESP32s and could be applied to any small 3v device.
My family has several ponds on our property that require periodic spillway cleaning. One way to determine when it is time to clean the spillway is by looking at the water level in the pond. I wanted to create device that could periodically report the water level to the Cloud so that I could monitor it remotely. I will talk through this build in later post, but here I will just talk through the power circuitry.
I needed my device to turn on for a few minutes at a time, a few times a day to collect data samples and then report them to the Cloud.
- Survive year-round outdoor weather conditions (-10°C to 40°C ambient).
- Supply well regulated 3.0v @ 100ma average, 500ma max for 3 minutes.
- Design life of 10 years.
- Predominantly through hole components.
I broke down the problem into 3 parts: energy storage, solar panel selection, and voltage regulation.
Lithium polymer batteries are a mainstay for IoT applications however due to freezing temperatures and the high cycle count, I chose to use a super-capacitor instead. Super capacitors usually are manufactured as 2.7v cells. Stacking 2 in series would provide sufficient voltage to feed a linear regulator to power the ESP32. Using this site I calculated that a 15F capacitor (with 100mΩ ESR) could supply 140ma when discharging from 5v to 3v for 3.5 minutes. I found a suitable dual capacitor module from AVX, specifically the SCMU33F156SRBB0. It is rated to 5.5v max. One thing to consider with super capacitors is they get very angry (and smokey) if you over voltage them. It seems to be a common approach to use a Zener diode across the capacitor to serve as a protection circuit for applications like this. An even better approach is to use a device like a TL431 which is an adjustable shunt-type voltage regulator. Basically the TL431 begins to conduct at a specified voltage acting as an ideal Zener diode with an adjustable Zener voltage. It can sink up to 100ma. I chose a NCP431 as it requires less power than the TI part. I setup the voltage adjust to limit the capacitor voltage to 5.2v.
I did consider some ready-made solar charge controller chips such as the SPV1040 from ST, but I felt that they were a bit expensive and would require more external passive components. I also felt that there was little to be gained in implementing MPPT as efficiency was not a driver for this project.
Solar panel and charging circuit selection
I bought a 10 pack of 5v/30ma solar panels from Amazon. In my testing under full sun they seemed to be closer to 6v/25ma. I initially wired 2 together in parallel but later went to a 2×2 configuration to allow charging at lower sun intensities. Because my charging circuit was super simple (no boost converter) the capacitor only charges if the panel voltage is greater than the capacitor voltage. I added panel discharge protection via Shottkey diode (1N5817). Again, this is not the best choice for efficiency, but they’re super simple.
Here is the charging circuit I ended up with:
Normally ESP32 modules are powered off of 5v USB and the core itself is powered via a 3.3v regulator. However, the core can run as low as 2.7v per the data sheet. I chose to use a 3.0v low-dropout linear regulator as a compromise and provide some headroom over the core’s minimum voltage. To enable and disable the voltage regulator I selected a MCP65R41 comparator. This comparator has a built in voltage reference, reducing the component count.
I initially was going to have the ESP32 boot up when the capacitor reached around 3.6v (before the capacitor was completely charged) and wait in deep sleep until the capacitor was charged, but I wasn’t able to get the ESP32 modules I had on hand to get below 9ma in deep sleep. I believe this is because the USB to serial bridge chips on these modules are powered by the 3.3v bus rather than the USB bus. This is a shortcoming of the hardware design as the CP2102 USB to serial chips can be wired to run off of USB bus power. It seems that this poor design decision comes from the reference design from Espressif itself. To work around this I adjusted the comparator to turn on only once the capacitor was nearly full. While this doesn’t remove the power drain from the CP2102 chip while the regulator is enabled, it allows the capacitor to fully charge before enabling any load.
Here is the circuit for the comparator and low-dropout regulator:
I built the circuit and it works great! I’ve had it deployed for a few months now and in daylight it turns on once an hour or so for ~4.5 minutes at a time. This runtime is achieved without using any of the low power modes of the ESP32, which could further boost the sampling time.
Stay tuned for a deeper dive on how I put this circuit to work in the board above.
If your torch is actually as described (with a rechargable battery and a connected panel) please let us know! If not, you’re going to have to fit a proper rechargeable battery to it.
- Carefully unsolder all the components from the board
- Put two blobs of solder between the solar panel and the PCB. finally connecting everything up!
- Get your old phone battery and figure out which pin is and which is Often it will be marked, but you could use a voltmeter. Check the solar panel as well.
- Get some wire and solder the panel and the JST battery connector to the battery. For more information about the JST connector, see EspruinoBoard
Now, you should have a solar-powered battery! You can always glue the torch’s top back onto the top of the battery to help protect the panel (as in the image at the top of this page).
Note: Li-Ion batteries are not supposed to be charged past 4.2v and there is no circuitry to protect against this. However the solar panel produces so little power that this is unlikely to be a problem.
Let’s look at how much power is going in to and out of the battery:
So it’s not looking good. We’re 20uA short on power (unless you’re near the equator where the solar panel will work better). We could wake up less often and for less time, and that would help. It’s also not the end of the world. with a 20uA power draw, a charged 750mAh phone battery will still last for 4 years!
The issue here is the solar panel. At 150uA, the panel (with no Espruino) will still take over 6 months just to charge the battery!
We can do better with Espruino though. in Deep Sleep, the majority of the power draw on the Espruino board is from the voltage regulator. If we’re running from a Li-Ion battery we don’t need the regulator and we can save a lot of power. See the Power Consumption page for details on how to remove the regulator. This brings our power draw down as follows:
Great! We’re now at the point where Espruino will run off the tiny solar panel. and the battery gets charged.
Now for the software. Enabling deep sleep mode is as easy as calling setDeepSleep(1);. Here we’re going to flash an LED every 10 seconds, and we’ll also log the battery voltage into an array. Note that we add 0.7 to the battery voltage, because when the voltage regulator was removed we added a diode instead (which lowers the voltage by 0.7v). it’s not a very accurate measurement of the voltage, but it’s a good example.
var history = new Uint8Array(64); var currentHistory = 0; function onTimer currentHistory = (currentHistory1) % history.length; history[currentHistory] = E.getAnalogVRef0.7; digitalWrite(LED1, 1); setTimeout(function digitalWrite(LED1, 0);. 10); setInterval(onTimer, 10000); setDeepSleep(1);
Now just unplug the USB connector and you’re sorted. Espruino should run forever!
As we mentioned earlier, Li-Ion and Li-Po batteries shouldn’t be charged past 4.2v. Given that the solar panel produces so little power, we can ensure that the battery never gets charged past this level just by detecting when the voltage gets too high and the turning on an LED (which draws more power than the solar panel produces).
If you use the following onTimer function, that’s what’ll happen:
function onTimer var voltage = E.getAnalogVRef0.7; digitalWrite(LED2, voltage4.2); currentHistory = (currentHistory1) % history.length; history[currentHistory] = voltage; digitalWrite(LED1, 1); setTimeout(function digitalWrite(LED1, 0);. 10);
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.
Step 8: Prepare Solar Panel
Follow my Instructable to splice the cable for your solar panel with the plug side of the waterproof DC power cable set.
Plug in your battery and turn on the circuit by pressing the power switch.
Test it out and be sure it’s reporting to the internet before closing up the enclosure and installing the sensor in your herb garden, precious potted plant, or other soil within signal range of your Wi-Fi network.
Once the data from the sensor is being logged online, it’s easy to set up a recipe for email or text alerts on the API gateway site If This Then That. I configured mine to email me if the soil moisture level drops below 50.
To test it without waiting for my plant to dry out, I manually entered a data point to my humidity feed on Adafruit IO that fell below the threshold. A few moments later, the email arrives! If the soil’s levels fall below my specified level, I’ll get an email every time the feed is updated until I water the soil. For my sanity, I updated my code to sample the soil much less often than every 15 minutes.
Step 10: Use It Outside!
This is a fun project to customize based on your plant’s hydration needs, and it’s easy to swap out or add sensors or integrate the solar power features into your other Arduino projects.
Thanks for following along! I’d love to hear what you think; please post up in the Комментарии и мнения владельцев. This project is part of my free Solar Class, where you can find easy backyard projects and more lessons on working with solar panels. Check it out and enroll!
If you like this project, you may be interested in some of my others:
To keep up with what I’m working on, follow me on YouTube, Instagram and Snapchat.
Be the First to Share
Did you make this project? Share it with us!
Wear It Contest
Комментарии и мнения владельцев
I like the way a humidity sensor is used to measure soil moisture. All this cheap resistive probes corrode and destroy themselfs with electrolysis.
Indeed these are very nice instructions. Really great work. Love it.
One question. can this support sensor (ESP8266 moisture sensor) a 6 volt Water pump, or we will need to add another battery to it?
If your enclosure is not 100% air-tight (they never are) you’re eventually going to end up with too much humidity inside and the inevitable condensation. Based on my own experience I’d never deploy an outdoor enclosure without a pressure vent.
I know firsthand that depending on where you live it may be hard to source those parts. It starts with the name; they’re called different names by different manufacturers in different parts of the world. I’ve seen “pressure vent”, “pressure compensation valve”, “vent plug”, “protective vent”, “Gore vent” and others.
I learned this while building an outdoor LoRaWAN gateway: https://frightanic.com/iot/build-a-lorawan-gateway.
In my career as a scientist, I made lots of sensors for outdoor work. My mantra was: If you can’t hermetically seal the enclosure, ventilate it. Ventilation means 2 holes at least, otherwise changes in air pressure or temperature will allow moist air in, and in accordance with Murphy’s Law, it will condense on circuit boards and not escape. So I filled connectors (for ocean use to 200m) with vaseline, pushed (flowable) silastic into the voids between conductors in a cable, potted electronics etc.
Great tips, folks! I’ll consider drilling some tiny holes on whichever side ends up facing down in my final installation. What do you think of the idea of adding a silica gel packet inside the enclosure? Here’s a tutorial I made a while back about rugged-izing electronics projects for wearables purposes, too:
You don’t want to have any uncovered holes in the enclosure. No matter which side it’s going to end up over time water and all sorts of living creatures are going to find the way in. You want humidity air pressure exchange without up the enclosure directly. This is want a pressure vent gives you. thanks to the membrane inside. Think of it as a Gore-tex jacket for your enclosure: protected from the elements but breathable.
I meant holes to install a vent. But thanks for further explaining the benefits!
Exactly my point (assuming I correctly understood yours), that’s why I added the pressure vent. I doubt they work under water, though. In case of that gateway I integrated a BME280 temp/pressure/humidity sensor /inside/ the enclosure. The data collected every 10min shows that the ambient temperature and humidity graphs are pretty much inverse. a clear sign the pressure vent is working fine.
My point was that 2 holes were needed, not just one. To illustrate: I had to troubleshoot a meteorological Cloud searchlight (a light aimed up at 45 degrees so that an observer some distance from the base of the light could measure the elevation angle of the spot where the light hit the clouds, and using some tables could estimate the Cloud height. Superseded by laser and radar methods these days) But I digress. The problem was that the searchlight glass misted up which caused the light do diffuse too much. I found that the asbestos seal (yes. it was a long time ago) had just one notch cut out at the bottom as a drain hole. I simply cut another at the top to let water vapor out. Solved.