Power board

Published: Updated:
Published: Updated:

Zak well explained how to add a MOSFET that will help with situations like

  • using only battery
  • USB connected, charging battery, battery is not used for powering the load. What USB cannot provide enough power, will charging suffer?
  • USB connected but battery is missing (MOSFET has nothing to do here, this is on MCP73831)

MCP73831 loadshare

Which is in its turn an adaptation of a note from Microchip (Designing A Li-Ion Battery Charger and Load Sharing System With Microchip’s Stand-Alone Li-Ion Battery Charge Management Controller by Brian Chu)

Interesting that I found these links in one very long rant on a EEVblog forum. Very confusing discussion full of MOSFET dyslexia ()

But it was much more constructive discussion than on Electronics Stackexchange where I found very confusing topics:

  • How to add MOSFET to switch between battery and external source. Doesn't look like the source is connected right
  • Two diodes or MOSFET? but the answer is to buy a board. Otherwise, mind bending schematics without ground. No ground at all!
  • Idea with the comparator. And also with two comparators that detect a voltage range (window comparator curcuit). Though it's interesting but doesn't look flexible: first you need to understand the window and comparators, then calculate values (take into account battery charged and discharged states, and difference between USB and battery voltage), then why one MOSFET is not enough?

On hackster.io I found some concerns about LDO voltage regulator (suggesting HT7333 as a solution)

most boards such as Wemos, NodeMCU and others have an AMS117 voltage regulator that has an extremely high drop-out voltage of 1.3V, which makes them unusable for battery power

and proper battery level readings (this is about separate LipoFuelGauge system)

In order to be able to accurately measure the state of the battery, you cannot do it through resistors and ADC Pins, because the voltage of lithium-ion batteries does not drop linearly, while this chip has a special algorithm that calculates the state of the battery.

More complex control - voltage multiplexer from Power Electronics Technology magazine


Power distribution boards


  • search for a prototype board for ESP32
  • add USB connector
  • voltage stabilizer (buck converter)
  • battery charger chip
  • solar panel connector
  • battery connector
  • SPI line connectors and power for display
  • voltage divider between ADC and battery (to read battery level)

Power source

Motors normally require higher voltage (6V, 12V, 24V) and current, and it's a good practice to keep motors, LEDs (like very long strips of LEDs), switches electronically seperated from the logic (3.3V). But how do you decouple it when the whole project should work from the battery?

Do you use two batteries? Just imagine what a headache is to keep two separate batteries charged. I can only think about sophisticated system where there is an assumption that motors can kill the battery often, but at the same time the main brain must continue operating, therefore it remains only one option: to send a signal about help to other robots. But I've never seen such design.

So what normal people use instead?

Power supply needs to be protected from Back EMF when motors abruptly stop or reverse the rotation direction. But rechargeable battery only wins from this effect. The only concern will be values above maximum ratings especially for li-poly batteries that are very sensitive.

Read more: Operating an Arduino for a Year from Batteries

Battery charger

Let's design our custom board for powering the robot from one lithium polymer battery, say 3.7V and 2500mAh.

First of all, even before using the battery in any way, we should think about charging it. Here's a battery charger from Adafruit based on MCP73833 (evaluation board doc). For a second I thought that I found cheaper option - MCP73831 on Digi-Key in a 5-lead SOT-23 package, but it consumes 4x times less current during charging which means that it's going to charge much slower and has less indication signals. The datasheet provides PCB layout example.

Old alternative for these chips is MAX1555 and TP4056.

battery charger typical application

Additional components:

  • 3x indicator LEDs: 2x yellow and 1x white
  • 2x capacitors 4.7uF - Voltage Rating 10VDC
  • 3x resistors 470 Ohms - for LEDs, so for 20mA the Power Rating would be >100mW
  • 1x resistor (to set maximum charging current) 1K - for 25mA current (?), therefore the Power Rating >125mW
  • 1x resistor (to skip temperature control) 10K - for 50uA and 1.25V = 62.5uW

Load sharing

Even an LED can cause the battery to never finish charging.

USB should work as input and charge the battery too.

Power multiplexer. Add diodes to prevent flow from solar panel to USB (as they will share input lines). What MOSFET specs to use?

Step up voltage regulator

We need to boost 3.7V voltage from our battery to 5V level where Arduino and motors can work. Preferably we should supply 3.3V to logic board and separate 5V or 6V or even more to motors. But we must keep the first version simple.

Again we start with a popular at this time breakout board and look at the main chip (TPS61030). For logic board AND motors I found 1.8A TPS613222 and 3.6A TPS61032 switch current boost converters from Texas Instruments. The datasheet provides PCB layout example.

Old alternative for these chips is TPS6109.

voltage regulator typical application

Additional components:

  • 1x coil (inductor) 2.2uH (max DC current > 1.18A)
  • 1x schottky diode (alt) (required for >250mA loads) - find average and peak current from the inductor (1.8A, 2.4A)
  • 1x resistor 5 Ohms (for RC snubber) - power dissipation of the snubber is calculated as CV^2f = 150pF x (5V)^2 x 1MHz = 3.75mW (frequency of the circuit is calculated by the formula in datasheet with values V_in = 4V, V_out = 5V, n = 0.9, L = 2.2uH, I_lh = 0.5A)
  • 1x capacitor 150pF (for RC snubber) - x3 of schottky diode capacitance (45pF x 3 = 135pF) and voltage rating 10V
  • 3x capacitors 10uF - voltage Rating 6.3VDC


  • Arduino uses barrel jack connector, and more precisely 2.10mm ID (0.083"), 5.50mm OD (0.217")
  • Power for Arduino or Raspberry Pi (1/2 - in theory) - Micro USB Type B Male Vertical - connector is perpendicular to the board's surface thus it connects to Arduino or Raspberry Pi perpendicular as well. Raspberry Pi 1/2 where lower power consumption. Some components not rated for the current greater than 1A, so with Raspberry Pi 4 it can fry them)
  • Battery to the board - JST PH Connector
  • For charging USB cable let's be modern and use type C - USB Type C Female

Don't forget

  • Programmer connector. Two options: USB to UART with chips like CP210x or CH340, and see DevKitM for WROOM; or COM port (or USB to Serial converter) directly connected to RXD and TXD pins (this might not work on every system, maybe because DTR and RTS which just automatically trigger Reset and Boot buttons)

Picture from Last Minute Engineers showing form and marking difference between CP210x and CH340

  • Add several buttons in a joystick formation plus functional buttons (for setup, menu)

Solar Panel

And then carefuly think about power consumption and try to save on some functionality that you don't use. For example, here an amazing list from

  • Run the processor at a lower frequency
  • Run the processor at a lower voltage
  • Turn off unneeded internal modules in software (eg. SPI, I2C, Serial, ADC)
  • Turn off brownout detection
  • Turn off the Analog-to-Digital converter (ADC)
  • Turn off the watchdog timer
  • Put the processor to sleep
  • Don't use inefficient voltage regulators - if possible run directly from batteries
  • Don't use power-hungry displays (eg. indicator LEDs, backlit LCDs)
  • Arrange to wake the processor from sleep only when needed
  • Turn off (with a MOSFET) external devices (eg. SD cards, temperature sensors) until needed


  • Do you know that batteries can have multiple cells. One cell is 3.7V. 2 cells (2S) - 7.4V. 3 cells (3S) - 11.1V

  • Why capacitors are basically everywhere?

schematics with many capacitors

Capacitors are everywhere. Or at least in many places where the power is applied


Rate this page