Solar-Powered ESP32-C3 LED Lighting System with Deep Sleep Conservation
View and Edit Project In Cirkit Designer
Solar-Powered LED Circuit Documentation
Summary
This circuit is designed to power an LED using a solar panel that charges a 18650 Li-Ion battery. The system is controlled by an XIAO ESP32C3 microcontroller, which drives the LED and manages power consumption by entering deep sleep mode to conserve energy when not in use. The charging of the battery is regulated by a CN3065 Solar Charge controller, ensuring safe and efficient charging from the solar panel. The circuit includes resistors for current limiting and voltage reference purposes.
Component List
Solar Panel
- Description: A photovoltaic panel that converts sunlight into electrical energy.
- Purpose: To provide a renewable energy source for charging the battery.
18650 Li-Ion Battery
- Description: A rechargeable lithium-ion cell.
- Purpose: To store electrical energy for powering the circuit when solar energy is not available.
CN3065 Solar Charge Controller
- Description: A charge management controller designed for solar power applications.
- Purpose: To regulate the charging of the Li-Ion battery from the solar panel and provide power to the system.
XIAO ESP32C3 Microcontroller
- Description: A compact and powerful microcontroller with Wi-Fi and Bluetooth capabilities.
- Purpose: To control the LED and manage power through deep sleep functionality.
LED (Yellow, Two Pin)
- Description: A yellow light-emitting diode.
- Purpose: To provide visual indication or lighting controlled by the microcontroller.
Resistors
- Description: Passive electrical components with specified resistance values.
- Purpose: To limit current, divide voltage, and provide reference voltages in the circuit.
Wiring Details
Solar Panel
- Positive (+) connected to CN3065 Solar Charge Controller (SOLAR +).
- Negative (-) connected to CN3065 Solar Charge Controller (SOLAR -).
18650 Li-Ion Battery
- Positive connected to CN3065 Solar Charge Controller (BAT +) through a 27k Ohm resistor.
- Negative connected to CN3065 Solar Charge Controller (BAT -).
CN3065 Solar Charge Controller
- SOLAR + and SOLAR - connected to the corresponding pins of the solar panel.
- BAT + and BAT - connected to the corresponding pins of the 18650 Li-Ion battery.
- SYS + connected to XIAO ESP32C3 (5V).
- SYS - connected to the common ground net, which includes XIAO ESP32C3 (GND) and two resistors (56k Ohm and 100k Ohm).
XIAO ESP32C3 Microcontroller
- GPIO2/A0/D0 connected to LED anode.
- GND connected to the common ground net.
- 5V connected to CN3065 Solar Charge Controller (SYS +).
- GPIO3/A1/D1 connected to a voltage divider network formed by a 27k Ohm and a 100k Ohm resistor.
LED (Yellow, Two Pin)
- Anode connected to XIAO ESP32C3 (GPIO2/A0/D0).
- Cathode connected to a 56k Ohm resistor, which is then connected to the common ground net.
Resistors
- 27k Ohm Resistor connected between the 18650 Li-Ion battery positive and CN3065 Solar Charge Controller (BAT +), and to XIAO ESP32C3 (GPIO3/A1/D1).
- 56k Ohm Resistor connected between LED cathode and the common ground net.
- 100k Ohm Resistor connected to the common ground net and to XIAO ESP32C3 (GPIO3/A1/D1).
Documented Code
/*
* This Arduino Sketch is for an ESP32-C3 microcontroller that drives one or
* more LED lights. The microcontroller is powered by a 18650 Li-Ion battery,
* which is charged by a solar panel through a CN3065 Solar Charge controller.
* The microcontroller will use deep sleep mode during the day and when not in
* use to conserve power.
*/
#define LED_PIN GPIO2 // Define the GPIO pin connected to the LED
void setup() {
pinMode(LED_PIN, OUTPUT); // Set the LED pin as an output
digitalWrite(LED_PIN, LOW); // Ensure the LED is off initially
esp_sleep_enable_timer_wakeup(10 * 60 * 1000000); // Wake up every 10 minutes
esp_deep_sleep_start(); // Enter deep sleep mode
}
void loop() {
// This code will run after waking up from deep sleep
digitalWrite(LED_PIN, HIGH); // Turn on the LED
delay(1000); // Keep the LED on for 1 second
digitalWrite(LED_PIN, LOW); // Turn off the LED
esp_deep_sleep_start(); // Enter deep sleep mode again
}
Filename: sketch.ino
Description: The code configures the microcontroller to drive an LED connected to GPIO2. It uses deep sleep mode to conserve power, waking up every 10 minutes to briefly turn on the LED for 1 second before going back to sleep.