Charger
Using CN3065 Charger with ESP32
What is the CN3065?
What is the CN3065 solar charger?
The CN3065 is a charging chip for a single lithium-ion or LiPo cell, made for small solar panels. The boards sold under its name put it on a 40 × 20 mm PCB with two JST connectors (one for the panel, one for the battery) and a micro-USB port as a second way in. Plug a panel into one side and a cell into the other, and it charges.
Inside, it runs the usual lithium cycle. A gentle precharge starts a deeply discharged cell, then constant current until the cell nears 4.2 V, then constant voltage while the current tapers off. When the current falls to a tenth of the set value, it stops, and it starts again if the cell drops below 4.1 V. When the panel goes dark, the chip sleeps and draws under 3 µA from the battery.
The red LED shows charging and the green LED shows charged.
Danger
The module has no battery protection. It will not stop a cell from over-discharging, and it does not protect against a short on the load side. Use a cell with a protection board, such as a protected 18650. It charges to 4.2 V only, so it is for a single Li-ion or LiPo cell, never LiFePO4 or a multi-cell pack.
Solar-friendly, but not MPPT
A small panel cannot always deliver the current a charger asks for. If it is forced to, its voltage collapses and the charge stalls. The CN3065 has an 8-bit ADC that watches the input and lowers the charge current to what the panel can supply, so the panel keeps working instead of sagging. That is why you can set the current for the best case and still charge under cloud.
This is not true maximum power point tracking. An MPPT controller such as the CN3791 steers the panel to its best operating point and converts the difference efficiently. The CN3065 is a linear charger, so everything above the battery voltage is burned as heat:
Heat (W) = (Vin − Vbat) × charge current
From a 6 V panel into a 3.7 V cell at 500 mA that is (6 − 3.7) × 0.5 = 1.15 W, on a board the size of a stamp. From 5 V it is 0.65 W. The chip has thermal feedback and will reduce the current when it gets hot, so nothing breaks, but charging slows down. Give the board some airflow and keep it out of direct sun.
Choosing a panel
Two numbers matter: voltage and power.
Voltage. The input range is 4.4 to 6 V. A panel's open-circuit voltage (Voc) is higher than its working voltage, and it shows up when the charger draws little current, for example just before charging starts. Check the Voc on the label, or measure it in sun, and keep it at or below 6 V. A panel sold as 6 V can exceed that in bright light, so a 5 V-class panel is the safer match. Below about 4.4 V the chip does not start.
Power. The charge current can never be more than the panel's watts divided by its volts. A 1 W panel at 5 V gives at most about 200 mA, so a 2000 mAh cell needs about 10 hours of full sun, and in practice more. To reach the module's full 500 mA you need roughly 2.5 W. A larger panel of the same voltage does no harm. It only reaches the current limit sooner.
Charge current
On common modules the charge current is fixed at 500 mA by a small resistor between the chip's ISET pin and ground. The chip can be programmed up to about 1 A, and the resistor value sets it. A larger resistor means less current, as on most charger chips.
The usual rule is to charge at no more than the cell's capacity per hour (1C), so 500 mA suits a cell of 500 mAh or more. For a smaller cell, such as a 150 mAh LiPo, you need to lower the current. Look up the resistor table in the CN3065 datasheet before changing anything, and read the marking on your own board, because makers use different values.
What the LEDs tell you
| Red | Green | Meaning |
|---|---|---|
| On | Off | Charging |
| Off | On | Charge finished, or a full cell sitting on the charger |
| Off | Off | No input (dark panel, or below about 4.4 V) and the chip is asleep |
| On for many hours | Off | Something else is taking the charge current: a load on the battery, or a worn cell |
- 1Measure the panel's open-circuit voltage in sun with a multimeter. It must be 6 V or less.
- 2Check the polarity of every JST connector against your panel and cell before plugging in. The pin order is not standard between makers, and you may need to swap the wires in the plug.
- 3Plug the protected cell into the battery connector first, then the panel.
- 4Wait for the red LED, and measure the cell voltage to confirm it rises toward 4.2 V.
- 5For a 5 V board, take wires from the battery connection to the input of an MT3608. With nothing connected to its output, set it to about 5.1 V, then connect the board to the output.
- 6Expect the load to share the charge current. If it draws more than about a tenth of the set current, the charger may never reach its end-of-charge point and the red LED stays on. The cell is still held at 4.2 V, so this is harmless, but you will not see the green LED.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| No LED at all | Panel voltage below about 4.4 V, or a polarity mix-up | Measure at the panel in sun and check the JST polarity |
| Red LED stays on for hours | A load on the battery takes the charge current, or the cell is worn | Disconnect the load and see if the green LED comes on |
| Charging is slow | Panel cannot supply the set current, cloud, or the board is hot and has cut the current | Use a bigger 5 V-class panel, better sun, more airflow |
| Board gets hot | Linear charger loses (Vin − Vbat) × current as heat | Use a 5 V panel rather than 6 V, lower the charge current, add airflow |
| Cell stays dead after a deep discharge | The cell or its protection board has cut out | Do not force it. Try USB charging, and replace the cell if it does not recover |
Frequently asked questions
Can I charge from USB instead of a panel? Yes. The micro-USB port feeds the same charger at 5 V.
Can I power my project while the cell charges? Yes, the load goes in parallel with the battery. It shares the charge current, though, as explained in the steps above.
Is the CN3065 an MPPT charger? No. It lowers the charge current when the panel cannot keep up, but it does not track the maximum power point. The CN3791 does.
Can it charge a LiFePO4 cell or two cells in series? No. It terminates at 4.2 V for one Li-ion or LiPo cell.
Which cell should I use? A protected 18650 or a LiPo with a protection board, with a capacity in mAh of at least the charge current in mA.
Setting Up CN3065 with ESP32
Wiring
| Component pin | ESP32 pin | Note |
|---|---|---|
| SOLAR+ / SOLAR- (JST) | Solar panel +/- | Open-circuit voltage must be 6 V or less |
| BAT+ / BAT- (JST) | Protected single-cell Li-ion or LiPo | Use a cell with a protection board. The module has none |
| BAT+ / BAT- (same battery connection) | MT3608 IN+ / IN- | Boosts the 3.0-4.2 V cell to 5 V. Set the MT3608 to about 5.1 V before connecting the board |
| MT3608 OUT+ | 5V / VIN pin | Taken from the MT3608 output, not from the CN3065 |
| MT3608 OUT- | GND | Common ground |
Swipe sideways to see every column →
The CN3065 charges the cell and has no regulated output of its own, so a 5 V ESP32 board needs a boost converter such as the MT3608 between the cell and the 5V/VIN pin. The ESP32 suits solar nodes that sleep most of the time, but an MT3608 idles at roughly 100-200 µA, which can use more than the ESP32 does in deep sleep. For deep-sleep nodes, consider a low-quiescent-current 3.3 V regulator that works across the cell's 3.0-4.2 V range instead.
Related Components
18650 Holder
Single-cell 18650 holder for portable project power.
LiPo 2000mAh
Slim rechargeable LiPo cell for compact wearable and drone builds.
MT3608
Adjustable step-up converter for boosting low battery voltages to component requirements.
Solar 5V USB
USB-output solar panel for direct 5V device charging.
Solar 6V 1W
Small solar panel for trickle-charging low-power outdoor projects.
TP4056
Single-cell Li-ion charging module with protection — the standard for USB-powered lithium charging.
Related Guides & Projects
MicroPython vs Arduino on ESP32: Which Should You Learn First?
An honest comparison for beginners: where MicroPython is easier, where Arduino C++ is faster, how libraries and memory differ, and how to choose based on your project instead of hype.
MicroPython ESP32 Web Server: Control an LED or Relay from Your Browser
Create a working web server with the socket module, parse requests, serve a responsive control page for an LED or a relay, keep the displayed state truthful, choose a safe relay startup state and make the server survive bad or repeated requests.
MicroPython on ESP32 and Raspberry Pi Pico W: The Complete Guide
A structured MicroPython learning path for ESP32 and Pico W. Set up your tools, control GPIO, read sensors, connect to WiFi, build web servers, publish MQTT data and make projects reliable. Start here, then follow the links by level.
boot.py vs main.py in MicroPython: What Runs, When and Why
Understand the difference between boot.py and main.py in MicroPython, startup order, Wi-Fi setup, project structure, and recovery from boot errors.