
Part of the series: Arduino Projects for Sustainable Development: 10 SDG-Aligned Builds
Table of Contents
- Prototype Repository
- SDG Alignment
- Why a Solar Powered Arduino Charger Matters
- What This Project Does
- Parts List
- Safety Notes Before You Begin
- How the System Works
- Basic Wiring Overview
- Voltage Divider Example
- Arduino Code: Advanced Monitoring Sketch
- How This Code Helps You Get Started
- Optional Upgrade: Add LED Status Indicators
- Build Steps
- Practical Calibration Notes
- Limitations
- Possible Upgrades
- Why This Matters for Sustainable Development
- Conclusion
Prototype Repository
This project is published as an open prototype so that engineers, researchers, students, and advanced makers can reproduce and extend the design. All firmware, documentation, wiring notes, and example monitoring data are available in the project repository.
GitHub Repository:
Solar Arduino Charger Prototype – Source Files and Documentation
The repository contains the complete prototype build materials:
- Arduino monitoring firmware (.ino)
- bill of materials
- setup guide
- calibration notes
- example battery voltage readings
- wiring and power-flow diagrams
Engineers can clone the repository, fork the design, or download the complete project using GitHub’s Download ZIP feature.
All materials are released under the MIT License to support reuse in research, education, and prototype engineering work.
SDG Alignment
This project connects most directly to SDG 7: Affordable and Clean Energy, which aims to expand access to reliable, sustainable, and modern energy.
It also relates to several additional goals:
- SDG 9: Industry, Innovation and Infrastructure — through experimentation with renewable energy technologies
- SDG 11: Sustainable Cities and Communities — by supporting decentralized energy resilience
- SDG 13: Climate Action — by demonstrating low-carbon electricity generation
Small renewable energy systems are particularly useful in remote locations, disaster recovery environments, and educational settings where access to electricity may be limited or unreliable. For reference, the United Nations SDG 7 framework emphasizes expanding access to affordable, reliable, sustainable, and modern energy for all.
Why a Solar Powered Arduino Charger Matters
Most electronic devices depend on stable power supplies. In many parts of the world, that electricity comes from centralized power grids that still rely heavily on fossil fuels.
Solar power changes the equation by enabling energy generation directly at the point of use. Even small solar systems can support useful tasks such as charging phones, powering environmental sensors, or running embedded systems deployed in the field.
This Arduino-based prototype demonstrates four key principles of renewable energy systems:
- capture energy from sunlight using photovoltaic panels
- store electricity in rechargeable batteries
- regulate voltage so electronics can safely use stored energy
- monitor system state so the user can understand battery condition and system performance
Together, those components form a simple renewable energy system that is useful both as a hands-on build and as a teaching tool for sustainable development.
What This Project Does
This solar-powered Arduino system:
- captures solar energy using a small photovoltaic panel
- stores energy in a lithium battery
- uses a charging module to regulate battery charging
- boosts voltage to provide a stable 5V output
- monitors battery voltage using Arduino
- reports battery state as full, normal, low, or critical
- can be extended with LEDs, LCDs, data logging, or wireless telemetry
In practical terms, the device functions as a small renewable charging station and a solar-energy monitoring prototype.
Parts List
- Arduino Nano or Arduino Uno
- 6V–9V solar panel
- 18650 lithium-ion battery
- TP4056 lithium battery charging module with protection
- DC boost converter set to 5V output
- USB output module or USB breakout
- Two resistors for a voltage divider (for example 100kΩ and 100kΩ)
- Breadboard or small PCB
- Jumper wires
- Optional LEDs for status indication
- Optional 16×2 LCD or OLED display
Safety Notes Before You Begin
This project uses lithium-ion batteries, which must be handled carefully. A few important precautions:
- Use a TP4056 charging module with protection circuitry whenever possible.
- Do not connect a lithium battery directly to a solar panel without a charging controller.
- Do not exceed the charging module’s input limits.
- Verify the boost converter output with a multimeter before connecting any device.
- Do not short the battery terminals.
- Do not leave the system exposed to rain or high heat unless it is properly enclosed.
This is an educational prototype, not a certified consumer charger.
How the System Works
The solar panel converts sunlight into electrical current. That current flows into a charging module, which regulates the energy before it reaches the battery.
The lithium battery stores electricity during the day. When power is needed, the boost converter raises the battery voltage to a stable 5V output suitable for USB devices and small embedded systems.
An Arduino can optionally monitor battery voltage and report system status through the Serial Monitor, an LCD display, LEDs, or even a wireless dashboard.
This architecture mirrors the structure of much larger solar energy systems, just at a smaller scale: generation, storage, regulation, and monitoring.
Basic Wiring Overview
Solar Charging Circuit
- Solar Panel + → TP4056 IN+
- Solar Panel – → TP4056 IN–
- Battery + → TP4056 B+
- Battery – → TP4056 B–
Power Output Circuit
- TP4056 OUT+ → Boost Converter IN+
- TP4056 OUT– → Boost Converter IN–
- Boost Converter OUT+ → USB 5V
- Boost Converter OUT– → USB GND
Arduino Monitoring Circuit
- Battery positive line → Voltage divider → Arduino A0
- Battery ground → Arduino GND
Important: the Arduino analog pin should never receive the full raw battery or panel voltage unless it is safely scaled down through a voltage divider.
Voltage Divider Example
If you use two equal resistors, such as 100kΩ and 100kΩ, the voltage divider cuts the battery voltage in half before it reaches A0. That means a 4.2V battery will appear as approximately 2.1V to the Arduino, which is safe for a 5V Arduino analog input.
For a 2:1 voltage divider:
- Battery positive → resistor 1 → analog pin
- Analog pin → resistor 2 → ground
The code below assumes a divider ratio of 2.0. Adjust that value if your resistor values differ.
Arduino Code: Advanced Monitoring Sketch
The following sketch goes beyond a simple analog read. It averages samples, converts them into estimated battery voltage, classifies battery state, and drives optional LEDs that indicate system condition.
/*
Solar Powered Arduino Charger Monitor
-------------------------------------
Features:
- Reads battery voltage through a voltage divider
- Averages multiple samples for more stable readings
- Reports battery state: FULL, NORMAL, LOW, CRITICAL
- Optional LED status indicators
- Serial output for diagnostics
Assumptions:
- Arduino reference voltage is 5.0V
- Voltage divider ratio is 2.0 (example: 100k + 100k)
- Single Li-ion battery nominal range: ~3.2V to ~4.2V
*/
const int batteryPin = A0;
// Optional LED pins
const int ledFullPin = 4;
const int ledNormalPin = 5;
const int ledLowPin = 6;
const int ledCriticalPin = 7;
// Voltage calibration
const float referenceVoltage = 5.0;
const float voltageDividerRatio = 2.0;
// Battery thresholds for one Li-ion cell
const float batteryFull = 4.15;
const float batteryNormalMin = 3.70;
const float batteryLow = 3.40;
const float batteryCritical = 3.20;
// Number of samples for averaging
const int sampleCount = 20;
float readBatteryVoltage() {
long total = 0;
for (int i = 0; i < sampleCount; i++) {
total += analogRead(batteryPin);
delay(10);
}
float averageRaw = total / (float)sampleCount;
float measuredVoltage = averageRaw * (referenceVoltage / 1023.0);
float batteryVoltage = measuredVoltage * voltageDividerRatio;
return batteryVoltage;
}
void clearLeds() {
digitalWrite(ledFullPin, LOW);
digitalWrite(ledNormalPin, LOW);
digitalWrite(ledLowPin, LOW);
digitalWrite(ledCriticalPin, LOW);
}
void setBatteryStatusLeds(float voltage) {
clearLeds();
if (voltage >= batteryFull) {
digitalWrite(ledFullPin, HIGH);
} else if (voltage >= batteryNormalMin) {
digitalWrite(ledNormalPin, HIGH);
} else if (voltage >= batteryLow) {
digitalWrite(ledLowPin, HIGH);
} else {
digitalWrite(ledCriticalPin, HIGH);
}
}
const char* batteryStatusLabel(float voltage) {
if (voltage >= batteryFull) {
return "FULL";
} else if (voltage >= batteryNormalMin) {
return "NORMAL";
} else if (voltage >= batteryLow) {
return "LOW";
} else {
return "CRITICAL";
}
}
void setup() {
Serial.begin(9600);
pinMode(ledFullPin, OUTPUT);
pinMode(ledNormalPin, OUTPUT);
pinMode(ledLowPin, OUTPUT);
pinMode(ledCriticalPin, OUTPUT);
clearLeds();
Serial.println("Solar Powered Arduino Charger Monitor");
Serial.println("------------------------------------");
Serial.println("Reading battery voltage...");
}
void loop() {
float batteryVoltage = readBatteryVoltage();
const char* status = batteryStatusLabel(batteryVoltage);
setBatteryStatusLeds(batteryVoltage);
Serial.print("Battery Voltage: ");
Serial.print(batteryVoltage, 2);
Serial.print(" V | Status: ");
Serial.println(status);
// Optional advisory messages
if (batteryVoltage >= batteryFull) {
Serial.println("Battery is near full charge.");
} else if (batteryVoltage >= batteryNormalMin) {
Serial.println("Battery is in a healthy operating range.");
} else if (batteryVoltage >= batteryLow) {
Serial.println("Battery is getting low. Charging recommended.");
} else {
Serial.println("Battery is critical. Reduce load and recharge immediately.");
}
Serial.println();
delay(5000);
}
How This Code Helps You Get Started
This sketch is designed to be immediately useful for someone building the project for the first time.
- It gives you a stable voltage reading by averaging multiple analog samples.
- It converts the analog reading into an estimated battery voltage.
- It classifies battery condition in plain language.
- It provides optional LED indicators for quick physical feedback.
- It creates a foundation you can later extend with displays, data logging, or wireless telemetry.
If you want the fastest way to get started, upload this sketch, open the Serial Monitor, place the solar panel in sunlight, and watch how the battery status changes over time.
Optional Upgrade: Add LED Status Indicators
If you wire LEDs to pins 4–7 with appropriate resistors, the system can show battery state at a glance:
- Pin 4 — FULL
- Pin 5 — NORMAL
- Pin 6 — LOW
- Pin 7 — CRITICAL
This makes the build more practical in field or classroom use, especially if no laptop is attached.
Build Steps
1. Connect the Solar Panel
Attach the solar panel leads to the input terminals of the TP4056 lithium charging module.
2. Install the Battery
Connect the lithium-ion battery to the module’s battery terminals. Double-check polarity before powering the system.
3. Add the Boost Converter
Connect the TP4056 output to the boost converter input. Before attaching any USB device, use a multimeter to verify that the boost converter is set to approximately 5V output.
4. Build the Voltage Divider
Add the resistor divider between the battery positive line and ground, with the midpoint connected to Arduino A0.
5. Upload the Monitoring Sketch
Upload the advanced monitoring sketch and open the Serial Monitor at 9600 baud.
6. Test Charging Behavior
Place the solar panel in sunlight and observe how the measured battery voltage changes. Compare charging behavior in bright sun, shade, and indoor light.
7. Add LEDs or a Display
Once the basic system works, add LED indicators or a display to make the charger easier to read without a laptop.
Practical Calibration Notes
Battery voltage readings are only as good as your calibration. A few things to verify:
- Make sure your Arduino reference voltage is actually close to 5.0V.
- Check your resistor values with a multimeter if possible.
- Confirm the voltage divider ratio in code.
- Compare the Arduino reading to an external multimeter reading and fine-tune if needed.
If your system consistently reads too high or too low, adjust the referenceVoltage or voltageDividerRatio values in the code.
Limitations
This project is an educational prototype rather than a production solar energy system.
Limitations include:
- small solar panel output
- limited battery storage capacity
- lack of advanced solar charge control
- weather-dependent generation
- basic voltage-based monitoring rather than full power analytics
Despite these limitations, the system effectively demonstrates the core principles behind renewable energy infrastructure.
Possible Upgrades
Add Energy Monitoring
Measure both solar input and output current to estimate actual power flow and charging efficiency.
Add Data Logging
An SD card module can record battery voltage and solar production over time.
Add Wi-Fi Connectivity
An ESP32 could transmit solar production data to a cloud dashboard.
Add a Display
A 16×2 LCD or OLED can turn the charger into a standalone monitoring device.
Increase Solar Capacity
Larger panels and additional batteries can expand system capability and improve practical usefulness.
Add Load Switching
A MOSFET or relay could automatically disconnect non-critical loads when battery voltage drops below a safe threshold.
Why This Matters for Sustainable Development
Renewable energy is often discussed at the scale of national infrastructure. But the underlying technologies operate on the same basic principles whether they power a city or a small device.
Solar panels convert light into electricity. Batteries store that electricity. Control systems regulate how it is used.
Projects like this help demonstrate those principles in accessible ways. A student building a solar charging system is learning not only electronics but also the physical logic behind renewable energy systems.
That understanding is essential for the long-term transition toward more sustainable energy infrastructure.
This solar powered Arduino charger also shows why decentralized energy systems matter in policy terms: they improve resilience, expand access, and help make sustainability tangible at small scales.
Conclusion
A solar-powered Arduino charging system is a small project, but it demonstrates how renewable energy systems capture, store, and distribute electricity.
By combining a solar panel, lithium battery, voltage regulation components, and Arduino-based monitoring, the build creates a portable power system that can charge devices or support small electronics.
In educational settings, makerspaces, and sustainability research labs, projects like this help translate renewable energy concepts into practical experimentation.
This solar powered Arduino charger illustrates how renewable energy systems can operate at small scales while demonstrating the core principles behind decentralized power generation.
Ultimately, sustainable development depends not only on policy frameworks but also on the systems we build to generate, store, regulate, and understand energy.
