Solar Power for Arduino, ESP8266 and IoT: Complete Guide to Energy Independence

Introduction

In the age of Internet of Things (IoT) and embedded technology, solar power for Arduino and other types of devices (such as, for example, ESP8266 and ESP32) have become a top priority to ensure continuous operation. Projects distributed in remote locations, far from the electricity grid, require a sustainable and reliable energy source. This is where solar energy comes in.

Solar energy offers an eco-friendly solution for powering these devices, allowing them to operate independently and long-term without the need for expensive battery replacements or electrical wiring. In this article, we will comprehensively explore the world of solar power for Arduino, ESP8266 and IoT projects, offering practical advice, design tips and clear information on how to make the most of this revolutionary technology.

You will learn how to properly size your solar system based on your specific needs, choose the right components such as photovoltaic panels, charge controllers and batteries, and configure everything to ensure reliable operation. The most common applications of solar power in IoT projects also include remote sensors, autonomous weather stations, environmental monitoring systems, and so on.

The transition to solar energy not only reduces long-term operating costs, but also contributes to environmental sustainability and energy access in remote and rural areas.

Get ready to discover how solar energy can revolutionize your Arduino, ESP8266 and IoT projects, offering long-lasting and responsible energy independence. Read on to gain all the knowledge you need to fully exploit the potential of the sun and take your projects to new levels of autonomy and efficiency.

What advantages do such systems bring?

We have long seen a growing demand for solar panel-based power systems for Arduino, ESP8266, and other similar devices in the Internet of Things (IoT) and embedded applications. The reasons are multiple:

  • Sustainability: solar energy is a renewable and clean energy source, making it a sustainable choice for powering energy-efficient devices such as Arduino, ESP8266 and similar. These systems can operate autonomously for a long time without the need to change batteries or connect them to an electrical network.
  • Remote Applications: many IoT and embedded applications are located in remote or inaccessible locations. Using solar energy eliminates the need for electrical wiring and makes it possible to deploy devices in remote locations such as weather stations, agricultural sensors, environmental monitoring systems, automatic sprinklers, etc.
  • Power Saving: Arduino, ESP8266 and similar are designed to operate with low power consumption. This makes them ideal for solar-powered systems, as they require less energy than more powerful devices.
  • Reliability: with the correct design and implementation, solar-powered systems can be very reliable, reducing the need for frequent maintenance.
  • Reduced operating costs: if you have a network of devices spread across a large area, using solar energy can significantly reduce long-term operating costs, such as battery replacement.
  • Applications in areas without electricity: in many parts of the world, there are rural or remote areas that do not have access to electricity from the grid. Solar energy offers an opportunity to power devices for useful purposes in these communities.

How is a solar power for Arduino generally composed?

  • Photovoltaic panel: the photovoltaic panel must be chosen based on the amount of energy you need and the position in which you will install it. It is necessary to verify that the panel has a nominal voltage and current compatible with the system to be powered.
  • Solar charge controller: a charge controller is necessary to manage the battery charge and protect it from overcharging and deep discharge. The regulator must be compatible with the voltage and capacity of the battery.
  • Battery: the battery must be suitable for capacity and voltage needs (i.e. the mAh delivered and the voltage in volts). Lithium batteries are often a good choice for such applications. The battery is used to power our device (Arduino, ESP8266 etc) when the energy supply from the photovoltaic panel is insufficient (for example on particularly cloudy days and at night).
  • A DC/DC converter (optional): if the voltage supplied by the battery is lower than the operating voltage of the device to be powered, it is best to use a DC/DC converter which raises the voltage to the desired value. A typical case is that of a battery that delivers 3.7V but the device requires 5V to function. In this case the module will raise the continuous 3.7V of the battery to 5V continuous.
  • Inverter (optional): If the device you want to power requires AC voltage instead of DC, you may need an inverter to convert the battery’s DC voltage into AC voltage (but this is not the case for us).
  • Arduino, ESP8266 or ESP32: the device you want to power.
  • Cables and Connectors: you will need cables to connect all the components and connectors to facilitate connections.

Let’s see in more detail how these components work

The photovoltaic panel

The photovoltaic panel is the main component of a solar energy system and works to convert solar energy into usable electrical energy. Here is a description of how a photovoltaic panel works:

  • Photovoltaic Cells: a photovoltaic panel is made up of numerous photovoltaic cells. These cells are mainly made of semiconductor materials. The cells are designed to capture sunlight and use the photovoltaic effect to generate direct current (DC).
  • Absorption of Sunlight: when sunlight hits the photovoltaic panel, photons (particles of light) interact with atoms in the semiconductor material of the cells. This interaction causes the release of electrons from their atomic bonds, thus generating positive and negative charges within the cell.
  • Creation of Electric Field: inside the cell, there is an electric field created by a potential difference between the positive and negative charges. This electric field forces the freed electrons to flow in a specific direction, creating an electric current. This current is initially direct current (DC).
  • Internal Circuits: the internal circuits in the photovoltaic panel collect the direct current generated by all the cells and converge it towards a single output. This is the point at which the direct current produced by the panel is made available for use in a power system or to charge a battery.
  • Voltage and Current: the voltage and current produced by the panel depends on the amount of sunlight hitting the panel and the configuration of the cells. Typically, a photovoltaic panel produces a nominal voltage of around 12V, but this can vary depending on the design. The current is determined by the size and quantity of cells in the panel.
  • Electricity Production: the electricity produced by the photovoltaic panel can be used directly to power electrical equipment or charge batteries. Additionally, if energy production exceeds consumption, excess energy can be stored in batteries or returned to the electrical grid in a connected solar power system.

In short, the photovoltaic panel works by converting sunlight into electrical energy via the photovoltaic effect within its cells. It is a clean, renewable energy source that can be harnessed to electrically power a wide range of devices and systems.

Let’s see in the following photos the behavior of the panel depending on the lighting:

In low light the panel generates approximately 2.7V
In low light the panel generates approximately 2.7V

With higher lighting the panel generates approximately 4.4V
With higher lighting the panel generates approximately 4.4V

This panel, when exposed to full sunlight, generates an open-circuit voltage between 5V and 6V.

The charge regulator

The charge controller (also known as a solar charge controller) is a critical component in a solar power system. Its main purpose is to manage the charging of batteries connected to solar panels, ensuring that the batteries are charged safely and efficiently. Below are the main features:

  • Voltage Regulation: the charge controller is designed to adapt the voltage of the solar panel to the charging voltage needed for the battery. This is important because solar panels can produce varying voltages depending on sunlight conditions, but the battery must be charged to a specific voltage (for example, 3.7V for a lithium battery). The charge controller will lower or raise the solar panel voltage to match the battery charging voltage.
  • Battery Voltage Monitoring: the charge controller constantly monitors the battery voltage. This allows the controller to know when the battery is low or full.
  • Charge Management: during the day, when the solar panel produces energy, the charge controller decides how much of this energy should be used to charge the battery. Typically, it charges the battery to a certain “draw voltage” and then switches to a “float” mode to keep the battery fully charged without overcharging it.
  • Battery Protection: a solar charge controller also offers battery protection. Avoid overcharging the battery, which can damage it or cause dangerous overheating. It also prevents over-discharging, which can shorten the life of the battery. Some charge controllers also offer protection against reversed polarity and other fault conditions.
  • Indicators and Monitoring: many charge controllers are equipped with LED indicators or LCD screens that show the status of solar charging and battery. These can be useful for solar system monitoring and debugging.
  • Programmable Charging Modes: some charge controllers allow users to program charging modes based on their specific needs. For example, you can configure the regulator to operate in fast charge or slow charge mode, depending on your system needs.

In summary, the solar charge controller plays a crucial role in solar energy management and battery protection. It ensures that solar energy is used efficiently to charge the battery and prevents damage due to overcharging or overdischarging. It is therefore an essential component in a reliable solar power system.

The battery

A lithium battery is a common type of rechargeable battery that works through chemical reactions within its cells. Here is a description of how a lithium battery works:

  • Cell Composition: a lithium battery is made up of one or more cells, and each cell is made up of several key components:
    • Cathode: the cathode is one of the two ends of the cell and contains a lithium material that can give and receive electrons during chemical reactions.
    • Anode: the anode is the other end of the cell and contains a different material that can give off and receive electrons. In lithium batteries, the anode material is often graphite.
    • Electrolyte: the electrolyte is an ionic liquid or polymer that allows lithium ions to pass between the cathode and anode. The electrolyte is essential for the functioning of the battery as it facilitates the conduction of lithium ions.
  • Charging and Discharging: the operation of a lithium battery is based on the charging and discharging process. When charging the battery, an external voltage is applied to the cell which pushes lithium ions from the cathode to the anode through the electrolyte. The lithium ions are then stored in the anode in the form of lithium metal.
  • Energy Release: when the battery is used to power a device, lithium ions begin to flow from the anode to the cathode through the electrolyte. This flow of ions generates an electric current that can be used to power the connected device.
  • Chemical Reactions: during the charging and discharging process, reversible chemical reactions occur within the cell. These reactions involve the migration of lithium ions between the cathode and anode through the electrolyte. During charging, lithium ions move from the anode to the cathode. During discharge, the process is reversed, with lithium ions moving from the cathode to the anode.
  • Charge and Discharge Cycles: a lithium battery can be recharged and discharged many times before its capacity decreases significantly. This is known as a charge and discharge cycle. The overall useful life of a lithium battery depends on the number of cycles it can withstand before losing capacity.
  • Safety Management: lithium batteries require careful safety management as they can become unstable if overcharged, excessively discharged or physically damaged. Therefore, they are often equipped with battery management systems (BMS) that monitor and regulate voltage, current and temperature to prevent dangerous situations such as overheating or explosion.

In summary, the operation of a lithium battery relies on chemical reactions of lithium ions between the cathode and anode via an electrolyte. These reactions produce electrical energy that can be used to power devices. The ability to cycle through charging and discharging makes lithium batteries a popular option for a wide range of applications, from cell phone batteries to electric vehicle batteries.

The DC/DC converter

The DC/DC converter, also known as a voltage converter or DC/DC regulator, is a crucial component when you need to adapt the battery voltage (3.7V) to the 5V required by your device (for example, Arduino, ESP8266 or ESP32). Here is a description of how a DC/DC converter works:

  • Voltage Regulation: the DC/DC converter is designed to increase or decrease the input voltage (in this case, 3.7V from the battery) to obtain the desired output voltage (in this case, 5V). It is a voltage regulator that ensures that the output voltage is stable and suitable for the needs of the device.
  • Converter Topology: there are several topologies of DC/DC converters, but a common one is the Buck converter (or step-down voltage regulator). In a Buck converter, the input voltage is reduced to the desired output voltage. Other types of DC/DC converters, such as the Boost converter, increase the input voltage to the desired output voltage.
  • Duty Cycle Control: the DC/DC converter regulates the output voltage by manipulating the duty cycle. Duty cycle refers to the fraction of time the converter is active relative to its total switching cycle. By adjusting the duty cycle, the converter can increase or decrease the output voltage.
  • Efficiency regulation: DC/DC converters are designed to be efficient, which means that they minimize energy losses during voltage conversion. This is especially important in a battery-powered system, as an inefficient converter could cause excessive energy usage.
  • Protection and Safety: some DC/DC converters incorporate protection functions, such as over-voltage protection, short-circuit protection and over-heat protection, to ensure safe and reliable operation.
  • Current Adjustment: some DC/DC converters can also adjust the output current if necessary for your device.

In summary, a DC/DC converter is an electronic component that changes the input voltage to match the voltage specifications required by your device. It ensures that your device receives the correct voltage, allowing correct operation even when the battery voltage is different from the voltage required by the device. This is essential to ensure stable and reliable operation of your battery-powered projects.

The inverter

An inverter (which however is not part of this project as we do not need an alternating supply voltage) is an electronic device used to convert direct current (DC) into alternating current (AC). This is useful when you want to power electrical equipment that requires alternating current from an energy source that provides direct current, such as batteries or solar panels. Here’s how it works:

  • DC Input: the inverter receives direct voltage (DC) input from a power source, such as a battery or solar panel. This DC voltage can vary depending on the source and can be low voltage (for example, 12V or 24V) or higher voltage.
  • DC/DC converter (optional): in some cases, especially when the input DC voltage is very low, it may be necessary to use a DC/DC converter to increase the voltage before sending it to the inverter. This is common in solar systems, where solar panels can produce a relatively low DC voltage.
  • Voltage Inversion: the heart of the inverter is a switching circuit that inverts the DC voltage into a sinusoidal or modified alternating voltage (square wave or modified sine wave) output. The frequency of the alternating voltage produced (for example, 50 Hz or 60 Hz) is generally compatible with that of the local electrical grid.
  • Amplification and Control: the inverter amplifies the input DC voltage to the desired output AC voltage. This amplifier can be controlled to provide the AC voltage needed to power specific electrical devices.
  • AC Output: the inverter then provides the output alternating voltage, which can be used to power electrical equipment such as home devices, electronics, home appliances, power tools and so on. AC output is usually provided through standard outlets or appropriate connectors.
  • Waveform: the AC output waveform may vary depending on the type of inverter. Some inverters produce pure sine wave AC voltage, which is ideal for powering sensitive devices such as computers and audio equipment. Other inverters can produce square wave or modified sine wave AC voltage, which may be suitable for less sensitive devices but may cause interference on more sophisticated devices.
  • Additional Protections and Features: inverters may include protection features such as overvoltage protection, overcurrent protection and temperature sensing to ensure safe operation. Some inverters may also offer advanced features such as interfacing with a monitoring system.

In summary, an inverter is a device that converts direct current (DC) to alternating current (AC) to enable powering electrical equipment that requires alternating current (AC) from a direct current (DC) power source. It is widely used in applications such as solar systems, emergency backup systems, to name a few examples.

Component estimation

To understand what characteristics the components of the system must have, we must necessarily make some assumptions. Suppose we want to power an ESP8266 that transmits data for 5 seconds every 10 minutes and receives data sporadically the rest of the time. To calculate the battery life for this scenario, we need to consider the average current consumption during operation and the total operating time per day. Here’s how to do the calculation:

  • Average Current Consumption: let’s say your device draws around 70 mA when transmitting and receives sporadically the rest of the time, with an average current draw of around 50 mA. Please note that these values ​​are rough estimates and may vary based on your specific device configuration.
  • Operating Time per Day: the device transmits data for 5 seconds every 10 minutes. So, each transmission cycle lasts 5 seconds + the sporadic reception time. The operating time per day is given by: Operating time per day = (5 seconds transmission + reception time) x Number of cycles per day. The number of cycles per day is given by (60 minutes / 10 minutes) * 24 hours, so there are 144 cycles per day. So Operating time per day = (5 seconds + reception time) x 144
  • Total Power Consumption per Day: multiply the average power consumption by the operating time per day: Total Power Consumption per day = Average Power Consumption x Operating Time per day
  • Battery Life: to calculate battery life, we divide the battery capacity by the average hourly power consumption: Battery Life (in hours) = Battery Capacity (in mAh) / Average hourly power consumption

Thus, with the specified consumption values and transmission interval, you can calculate the approximate life of the 2000mAh battery for your device. For example, let’s say the sporadic receive time is 2 seconds (so the total cycle is 7 seconds) and the average consumption is actually 50 mA:

Example calculation:

Operating time per day = (5 seconds + 2 seconds) x 144 cycles per day = 1008 seconds per day

Total current consumption per day = 50 mA x 1008 seconds = 50400 mAs (or 14 mAh)

Battery life = 2000 mAh / 14 mAh = approximately 5.95 days (approximately 143 hours)

So, with the specified usage profile, your 2000mAh battery should last around 143 hours before requiring a recharge. Please note that these calculations are approximate and may vary based on actual usage conditions and the exact specifications of your device.

What current draw does an ESP8266 have at idle and in transmission?

The power consumption of an ESP8266 module varies greatly depending on the operating modes. Here is a rough estimate of power consumption for an ESP8266:

  • At Idle (Deep Sleep): in “deep sleep” mode, the ESP8266 is in a state of low power consumption. Current consumption can be reduced to a few microamps (µA), depending on specific settings and circuit design. This mode is ideal when you want to save energy and can program the device to “wake up” at specific intervals or in response to certain events.
  • In Standby (Wi-Fi mode active but not transmitting/receiving): when the module is active but not transmitting or receiving data, power consumption is generally in the order of a few tens of milliamps (mA). Consumption may vary based on various factors, including the Wi-Fi transmission power and the update rate of any sensors. In this mode, the ESP8266 is still consuming power, so it is important to manage power consumption efficiently.
  • In Transmission: when transmitting data via Wi-Fi, the power consumption of the ESP8266 increases significantly. Depending on the transmit power and duration of network activity, consumption can vary from around 70 mA to more than 100 mA or even more. This is the most demanding mode in terms of power consumption.
  • Receiving: the current consumption when receiving data via Wi-Fi is similar or slightly less than in transmit mode, but can still exceed 70mA.

These are rough estimates and actual power consumption may vary based on numerous factors, including specific firmware, Wi-Fi transmit power, frequency of operation, distance from the modem, use of external components, and so on . To optimize energy efficiency, you should carefully consider how to manage your device to minimize the time spent in high-power modes and maximize the time spent in low-power modes, such as “deep sleep” when possible.

The components chosen for the project

Given the considerations made, the choice fell on the following components:

  1. Photovoltaic Panel (5V, 3W): the photovoltaic panel is capable of generating 5V at 3W when fully illuminated. This corresponds to a current supplied equal to 600mA (since P = V * I it is deduced that I = P/V i.e. I = 3W/5V = 0.6A. The photovoltaic panel is used both to power the device (Arduino, ESP8266 etc ) and to recharge the battery. To manage these aspects it is connected to a charge regulator like the one in the next step.
  2. TP4056 Charge Controller: the TP4056 chip is a charge controller with protection function for lithium batteries. The output of the photovoltaic panel is connected to the input of the TP4056, the battery is connected to the output of the TP4056 module. This module will charge your 3.7V 2000mAh battery safely. The module has two LEDs, one red and one blue. When in operation, the red LED will light up indicating that the battery is charging. Once the module has fully charged the battery, it will automatically stop charging and the red LED will turn off. At the same time the blue LED will light up to indicate the completion of charging.
  3. Battery (3.7V, 2000mAh): the battery must be connected to the output of the TP4056. Obviously, the correct polarity must be respected when connecting.
  4. DC/DC Converter: the DC/DC converter is placed between the battery and the device you want to power. It is based on the MT3608 chip which, according to the datasheet, is capable of delivering voltages up to 28V with a maximum current of 4A (although this module is unlikely to be able to deliver currents of this intensity). It has an adjustment screw. This screw is then adjusted to raise the voltage from 3.7V to 5V. The converter must be able to handle the current required by your device (Arduino, ESP8266 or ESP32). Connect the output of the DC/DC converter to your device.
  5. Device (Arduino, ESP8266 or ESP32): connect your device to the DC/DC converter’s output voltage, which is now 5V.

PLEASE NOTE: it is obviously possible to increase the current supplied by the photovoltaic panel by connecting another identical one in parallel. In this way, with full lighting, you will have 5V and 6W corresponding to a maximum current of 1.2A. It is clear that, given the greater current available, battery charging times will decrease considerably.

Let’s now look at the chosen components.

The 5V and 3W photovoltaic panel:

The 5V and 3W photovoltaic panel
The 5V and 3W photovoltaic panel

The TP4056 charge controller:

The TP4056 charge controller:
The TP4056 charge controller:

The 3.7V and 2000mAh battery:

The 3.7V and 2000mAh battery:
The 3.7V and 2000mAh battery:

The MT 3608 DC/DC converter:

The MT 3608 DC/DC converter:
The MT 3608 DC/DC converter:

The wiring diagram

To create this system it is necessary to connect the various components by soldering wires. If you are not familiar with soldering I recommend you take a look at the article Yet another tutorial on how to solder. You will see that it is a fairly simple operation. Please pay attention to the polarity of the battery (and all connections).

As usual, the electrical diagram is created using Fritzing:

Complete wiring diagram of the solar power for Arduino
Complete wiring diagram of the solar power system for Arduino

Once done, if you haven’t made any mistakes, the circuit should work right away. When you measure the output voltage from the DC/DC converter you will notice that it is almost the same as the input voltage. This situation is common, and is due to the fact that the potentiometer is, by default, set to minimum. In fact, the trimmer is of the multi-turn type and has a very short adjustment stroke. Therefore, you will need to rotate it a little before reaching the desired calibration point. This feature can be misleading and make you think that the module is defective, but in reality it is a normal adjustment operation (this is my personal experience).

Testing the system

In this video there are three simulations:

  • Insufficient brightness: to simulate the absence of brightness, the photovoltaic panel is turned towards the table top. Measuring the voltage generated at its ends, it is in fact equal to approximately 0.55V but the output voltage from the DC/DC converter is approximately 5V. In this case it is the battery that supplies the voltage at 3.7V which will then be raised to 5V
  • Medium brightness: in this case I turned the panel upside down so as to expose its sensitive elements to ambient light. The voltage generated is now around 3.5V. The voltage at the output of the DC/DC converter continues to be approximately 5V.
  • Full (or almost) brightness: in this case I expose the panel to the light of a table lamp. The voltage generated is just over 4V while the voltage at the output of the DC/DC converter continues to be around 5V.

In full light conditions (panel exposed to full sunlight) the open-circuit voltage generated is between 5 and 6V.

Usage suggestion

This project goes particularly well with the one described in the article How to make an automatic sprinkler with ESP8266 controlled by Arduino Cloud and allows you to make the irrigation system independent of external power sources. All you have to do is connect the output of the DC/DC converter to the system power supply and in particular:

  • disconnect the USB cable as it is no longer necessary
  • connect the negative pole (black wire) to the sprinkler ground
  • connect the positive pole (red wire) to the Vin terminal of the ESP8266

This is what the automatic irrigation system powered by the photovoltaic system looks like (in this photo the solenoid valve is disabled):

The system powered by solar energy (in this photo only the datalogger part is working while the solenoid valve is disabled)
The system powered by solar energy (in this photo only the datalogger part is working while the solenoid valve is disabled)

The dashboard shows the values ​​detected in real time by the device powered by the photovoltaic system
The dashboard shows the values ​​detected in real time by the device powered by the photovoltaic system

Newsletter

If you want to be informed about the release of new articles, subscribe to the newsletter. Before subscribing to the newsletter read the page Privacy Policy (UE)

If you want to unsubscribe from the newsletter, click on the link that you will find in the newsletter email.

Enter your name
Enter your email
Scroll to Top