Power Management Board With Solar Input and Powerpath Management

by 3590638750 in Circuits > Electronics

9 Views, 0 Favorites, 0 Comments

Power Management Board With Solar Input and Powerpath Management

3D_PCB1_2026-09-29  最终版.png

This Instructable is a deep dive into one part of our previous project, the Off the Grid Smart Watering System: the PCB design and fabrication work, which was Steps 15–20 back there. Here we'll cover the circuit architecture, the details of the PCB layout, and finally the brand-new optimized version of the board.

By the end of this Instructable, you'll have solved a circuit problem that turns up just about everywhere — converting one kind of power into another — and you'll have made your setup a little greener along the way: running small devices like the ESP32-S3 on solar.

Review and Analysis

step17.png

Let's start with a look back. In our Off the Grid project, we built a PCB that takes energy from the sun and turns it into power an ESP32-S3 dev board can actually use. The Instructable we wrote at the time didn't say much about that board — it got a paragraph and a photo. So here's the full version: our reasoning, the circuit architecture, and what we changed in the PCB design.

The reasoning

The ESP32-S3 is not a power-hungry chip. Unless you bolt on a pile of peripherals, it runs perfectly well on green power like solar. Which leaves one core problem, and everything else hangs off it: how do you turn solar's unstable output into stable DC?

That splits into two smaller questions:

  1. Solar voltage swings all over the place. How do you hold it steady?
  2. On cloudy days and at night, solar output more or less disappears. How do you keep the board powered when there's no input at all?

Our first-pass answers:

  1. Boost, buck, or buck-boost converters to condition the voltage.
  2. Let a lithium battery or a big capacitor — a supercapacitor, say — hold the charge. Think of a water tank: even when nothing flows in, you still have water when you turn the tap.
  3. Add a backup way to top up. In our last project, that was a hand-crank generator.


Version Ⅰ

焊接后.jpg
焊接后背面.jpg
PCB资料.png

For version Ⅰ, we had a two-route architecture in mind:

  1. Solar in: solar panel → voltage module → lithium battery
  2. Solar out: lithium battery → voltage module → power for the ESP32 board
  3. Hand-crank in: hand-crank generator → voltage module → lithium battery
  4. Hand-crank out: lithium battery → voltage module → power for everything else

After some research, we picked CN3791 for the solar input (a mature, purpose-built solution for charging a lithium battery off a solar panel), XL6009 for the hand-crank input, and MT3608 for the battery output (the workhorse DC-DC module you've probably seen a hundred times).

The result is a clean architecture: solar in, battery out. Hand-crank in, battery out.

We wanted one more trick, though — current path management, so the board could keep outputting while it was being charged. That's why we expeerimentally put a TP4056 with powerpath management on the hand-crank route, to manage charging and discharging intelligently.

To keep the PCB as simple as possible, we designed only the supporting components ourselves. The core modules got nothing but a footprint — you buy the finished module and solder it in. Which makes this PCB, honestly, a rather fancy piece of perfboard.


Failure and Lessons

Snipaste_2026-09-29_11-53-31.png
CN3791.png

However, the PCB never actually did its job. Only the two outputs behaved — solar out and hand-crank out. The inputs didn't. After debugging, I traced it to abnormal current.

I should be upfront here: I'm a PCB design beginner. This was a holiday project I did out of sheer interest, as a first-year electronic engineering student. So at first I had no idea what was causing that abnormal current. The failure pushed me to learn more — about PCB design in general (which turned out to be decisive for the optimizations that followed), and about the power of forums, where I went to ask for help.

Eventually I found the problem with solar in: when I drew the footprint(the selected pad were wrong), I had the input and output pin numbers reversed. Yes, a genuinely embarrassing mistake.

The hand-crank input, I still don't know the real cause. My best guesses are solder bridging two pads together during assembly, or a bad TP4056. Either way, that failure made me think hard about how this board was designed, and it led to every optimization that came after.

The failure taught me a lot:

  1. How to debug with a plan.
  2. Always prototype before you commit to a board.
  3. Don't cram too many features onto one board. Don't chase quick wins.
  4. How to read a datasheet properly.
  5. A pile of PCB design experience that I didn't have before.

It also deepened my interest in this design. I want to treat this PCB as a fresh start, so I've been putting extra care into it.

Next, I'll walk through each of my improved versions one at a time, and spend the most time on the final one.

Version II

3D_PCB1_2026-09-29.png

In this version I kept the original circuit architecture, and I kept the ready-made-module approach. What changed:

  1. I stripped out the unnecessarily bloated supporting circuitry — the Schottky diode stayed, the fuse didn't.
  2. Better ground copper, so the current return path stays clear — plus improved heat dissipation.
  3. Still ready-made modules, but now just headers: each module connects over jumper wires instead of getting its own custom footprint. Which means that if you wire something wrong, fixing it is easy.

These changes were only a first pass, and I knew that on their own they wouldn't be enough. On top of that, the circuit still needed the TP4056, and I had no idea whether that would actually work. (Boards aren't cheap to have made, so I didn't get this one fabricated to prove it out.)


Versions III and IV

3D_PCB2_2026-09-29 背面.png
3D_PCB2_2026-09-29 正面.png
3D_最终版_2026-09-29 背面.png
3D_最终版_2026-09-29 正面.png

I'm grouping these two together, because in both of them I ran head-first into the real-world problems of circuit design.

Version III

  1. I dropped the hand-crank route and focused on solar alone. (Focusing on one problem obviously gets you further.)
  2. I gave up on ready-made modules and designed the circuit myself, working from open-source designs and datasheets.
  3. I set aside the charge-and-discharge-in-one idea for now, splitting charging and discharging into two completely separate circuits — with two separate grounds, GND and GND_A.

On the design side:

  1. I moved the battery holder to the back of the board — easy to tell apart, and it saves space.
  2. Straight out of the CN3791 datasheet: the input filter cap, the output filter cap, and diode D2 (as the datasheet defines it) all need to sit on the same copper pour before that copper joins system ground, to keep high-frequency noise out. So I put the board's inner layers to work: inner layer 2 as high-frequency noise ground, inner layer 1 as system ground, and the bottom layer as both system ground and a heat-spreading layer.
  3. From the MT3608 datasheet's layout example, I learned that a PCB "trace" can simply be a copper pour. I redrew the MT3608 circuit following their example.

But this version was replaced fast, for three reasons:

  1. I used blind and buried vias (they only connect layer X to layer Y rather than going all the way through), which blew the cost up.
  2. I later realized that power circuits are actually very forgiving about grounding and trace layout. As long as the basics are covered, you don't need to agonize over ground placement, trace length, or via count. That level of care is for high-frequency signals.
  3. To keep the current loop as short as possible, I avoided a solid ground pour and left large areas without copper or vias. That over-caution turned out to be pointless: solid copper matters a great deal for system ground, and copper plus plenty of vias also spreads heat better and gives the current more return paths to choose from.

About copper pour, the only things really worth watching:

  1. Keep copper out from under certain parts — big inductors, for instance.
  2. Check whether the pour created a "fake connection": two copper regions joined by nothing but a narrow neck.
  3. Antenna effects: copper that narrows abruptly in some spot. (Not worth worrying about at these frequencies.)

So I designed Version IV. (Though while designing it, I hadn't realized most of the above yet — that came later, gradually.)

Version IV:

  1. Dropped inner layer 1. The bottom layer became system ground; inner layer 2 stayed as the first return path for high-frequency signals.
  2. No more blind or buried vias — all through vias.
  3. I did actual part selection. None of our earlier work had considered which manufacturer, or which type of part: the same capacitance comes as electrolytic, ceramic, tantalum; resistors come in 5% and 1%. Could the part I picked actually be ordered from a supplier? (If the part number doesn't match, I pick again — which might mean redoing the PCB.) And what package: SMD or through-hole, 0805 or 0603?


Version V — the Plan

I noticed Instructables is running a new contest — the Cutesy Creations Contest — and it fired me up all over again. I want to build a board that can power whatever adorable little thing I come up with. (Fingers crossed.)

First, pin down the interface, the output voltage, and the current. My initial estimate: output by USB + Type-C, 5V, 1A. But the board will drop some voltage along the way, so I also want an adjustable-voltage option.

Second, actually deliver on charge-and-discharge-in-one — which, in plain terms, means current path management.

Rsion V — the Architecture

Snipaste_2026-09-29_13-48-05.png
59a20d8c2112f4259a046e04c512f48b.jpg

The power path. Digging further into open-source designs (GitHub is a goldmine here — look for ones that ship both a schematic and a PCB), I found that you can do current path management with a single PMOS.

The idea:

  1. PMOS drain to the battery's positive terminal, gate to the solar input.
  2. A Schottky diode between gate and source.
  3. Solar present: Vgs sits at 0.3V (typical), so the PMOS is off. Solar charges the battery and powers the downstream circuit at the same time.
  4. No solar: Vgs drops to 0 (well, < 0), so the PMOS turns on and the battery takes over.

Charging. The battery side keeps the CN3791 and its supporting circuit.

The awkward part. Solar voltage swings from 2V to 12V, and the battery sits somewhere between 3.0V and 4.2V. Every time the current path switches, the output voltage is unstable — sometimes above 5V, sometimes below. A plain boost or a plain buck won't cut it. You need a buck-boost. So the MT3608 has to go.

Digging through open-source designs, I found a wide-input buck-boost built around the TPS63070.(2025 Make Blocks第五期阶段1 - 任务6 - 升降压转换模块)

Which leaves us with the architecture.

Version V — a New Problem

Snipaste_2026-09-29_12-52-40.png

But a real PMOS won't necessarily shut down one path and open the other the way the ideal version does. We probably needed a more mature solution.

After digging through documentation, I settled on the LTC4412. This chip is a proper "smart switch" — think of it as an ideal PMOS.

Once I'd picked it, the problems came thick and fast. Its switching logic: it switches over once the primary path (the solar panel) drops 20mV below the secondary path (the battery). Say the battery is at 3.7V — that means when the switch happens, the solar panel still has real voltage on it. And that voltage may still drive the CN3791 (undervoltage lockout notwithstanding), so now you have solar trying to charge the battery through the CN3791 with one hand, while the battery drives the load with the other. Charging and discharging at the same time isn't physically real, but the battery can still back-feed into the solar panel. Which is why we add a Schottky diode. (It's optional in the datasheet. In this case: add it.)

Version V — PCB Design

3D_PCB1_2026-09-29  最终版.png
SCH_Schematic1_1-P1_2026-09-29.png
SCH_Schematic1_2-P2_2026-09-29.png
Snipaste_2026-09-29_13-55-08.png

In the Off the Grid project we gave PCB design a broad summary and moved on. Let's get specific this time.

  1. Group first, place second. Start by gathering each functional block's parts together as one little unit, lay out each block on its own, then bring the blocks together.
  2. Satisfy the datasheet's hard requirements first. CN3791 hands down several.
  3. Then place the rest of the parts around the core chip, to keep traces from crossing.
  4. Handle special copper and keep-out areas early — the CN3791's high-frequency ground, no copper under inductors.
  5. Be explicit about what the schematic actually implies, because the drawing hides the real constraints:
  6. The filter caps, the decoupling cap, and the feedback network all hang off VIN on paper. In copper: the filter caps go first in line, the feedback tap must sit after the filter (that's what makes it stable), and the decoupling cap must be close to the chip.
  7. Signal traces — feedback, sense, that kind of pin — stay short, and should avoid passing near a big disturber such as an inductor.
  8. An LED, which couldn't care less about signal integrity, can go wherever.
  9. Once layout, routing, and pour are done, take a look: do the input filter cap's negative terminal, the chip's GND pin, and the output filter cap's negative terminal all land on one reasonably solid, wide piece of copper? Rough eye check is enough — and is anything cutting across that path? This is what keeps the current loop from taking the long way around.
  10. Standardize the parts — make sure every one of them can actually be bought. Anything that can't, change it now, not after a pile of fiddly rework.
  11. Refine the layout — nudge sizes and packages to claw back space.
  12. Inspect the copper — any orphan copper islands? Any current loop that's too long?
  13. Punch plenty of vias — near the main current path, under the chip, around the MOSFETs (that's for heat), and all over the pours (that's for current return).

Version V — the Details

detail1.png
Snipaste_2026-09-29_12-52-40.png
detail2.png
detail3.png
detail4.png
detail5.png
detail6.png
Snipaste_2026-09-29_12-54-36.png
Snipaste_2026-09-29_13-19-45.png

1. Input stage. A Schottky diode — blocks reverse current while dropping as little voltage as possible. This diode will run hot, so give it real thermal attention.

2. Power management module.

  1. Topology: see the figure.
  2. The STAT pin needs a pull-up resistor to report which state it's in. Tie it to a stable VDD (if you have another rail) or to the output pin.

3. Lithium battery charging module.

  1. The branch with R12 and R22 is the MPPT divider sense network. R12's value can be adjusted per the datasheet, or replaced with a trimmer. This branch has to sit after the filter cap.
  2. The input filter cap should sit close to the PMOS source. Keep the traces joining the input filter cap, the PMOS, the diode, the inductor, the chip, and the output filter cap as short and fat as you can.
  3. The input filter cap's ground, the positive terminal of diode D5, and the output filter cap's ground go onto one piece of copper first, and only then join system ground. That keeps high-frequency noise out of the system.
  4. Punch plenty of vias near and under the CN3791 and the PMOS, for heat. You can add a heatsink as well (mind the mechanical stress).
  5. Give heat-generating parts a little more breathing room from each other.
  6. Current-sense resistor R13 sits close to the chip, with fat traces.

4. TPS63070 buck-boost module.

  1. Choose the input and output filter caps carefully — better use of board area.
  2. VQFN pins are tiny. Route them sensibly.
  3. Both the input and the output current pass through the chip, so keep the traces wide and the thermals in order.

5. Active filter. A BJT that amplifies the effective capacitance, for better filtering (watch the phase margin). You can skip this circuit entirely if you want.

6. Other.

  1. No copper under inductors — the magnetic field causes trouble. And while pouring, watch for copper spikes, or connections between pours that are too narrow.
  2. Add test points, so you can check voltages.