Regulators, Batteries and Solar
| Difficulty | Advanced |
|---|---|
| Category | Foundations |
| Supported boards | Arduino Uno R3, ESP32 and bare microcontrollers |
| Time needed | 55 minutes |
| Prerequisites | Powering Your Project |
| Tested board | Not yet verified |
| Tested on | Not yet verified |
| Arduino IDE version | Not yet verified |
| Library | Not yet verified |
What this covers
Powering Your Project was about the Arduino’s own sockets. This is about building the supply yourself: when a project runs from a battery, needs 3.3 V as well as 5, or has to last a season outdoors.
Three things, in order of how often you will need them: making a lower voltage, running from a battery, and charging that battery from the sun.
Before you begin
Required parts and tools
- An AMS1117 3.3 V regulator module. This is Siratek product 49878.
- A solar lithium charger module, Siratek product 49598, for the last section.
- A multimeter.
- A single-cell lithium battery with protection circuitry, if you follow the battery sections.
Making 3.3 volts: the linear regulator
The AMS1117 module is the simplest answer and the one to reach for first. Three pins, VIN, OUT and GND, an indicator LED, and 5 V in gives 3.3 V out at up to 800 mA.
It is a linear regulator, and understanding what that means decides whether it is the right part.
A linear regulator does not convert voltage. It behaves like a variable resistor that drops whatever is surplus, and the surplus becomes heat:
heat, in watts = (input volts - output volts) x current
So at 5 V in, 3.3 V out and 300 mA:
(5 - 3.3) x 0.3 = 0.51 W
Half a watt in a part the size of a fingernail. That is warm, and it works. Now the same regulator from a 12 V supply:
(12 - 3.3) x 0.3 = 2.6 W
Five times the heat, for exactly the same useful output. The module will get too hot to touch and will shut down or fail.
So the rule is: the smaller the difference between in and out, the better. The “800 mA” rating assumes a small drop and good cooling; on this little board, treat 300 to 400 mA as the realistic limit from 5 V.
And note what the arithmetic means for a battery: at 5 V in and 3.3 V out, a third of your battery is being turned into heat before your circuit sees any of it. For a mains-powered project that is a waste. For a battery project it is a third of your runtime.
When to use a switching regulator instead
A buck converter switches rather than drops, so it converts most of the surplus into useful current rather than heat. Typically 85 to 95 percent efficient against the linear regulator’s 66 percent in the example above.
Use a switching regulator when: the input is much higher than the output, the current is more than a few hundred milliamps, or the project runs from a battery and runtime matters.
Use a linear regulator when: the drop is small, the current is modest, or the circuit is sensitive to electrical noise. Linear regulators are quiet; switching ones put ripple on the output, which matters for analog measurement and radio.
A common and sensible arrangement is both: a buck converter to get close, then a small linear regulator to clean it up for the analog part.
Batteries
| Type | Nominal | Notes |
|---|---|---|
| Alkaline AA | 1.5 V | Cheap, no charging, falls steadily from 1.5 to about 0.9 |
| NiMH AA | 1.2 V | Rechargeable; four give 4.8 V, which is not quite 5 |
| 9 V block | 9 V | Tiny capacity. See the warning in Powering Your Project |
| Lithium, single cell | 3.7 V | High capacity, needs care. See below |
| Lead acid | 12 V | Heavy, cheap, fine for something that does not move |
Two practical points that catch people.
Nominal voltage is not the voltage you get. A “3.7 V” lithium cell is 4.2 V full and 3.0 V empty. A 12 V lead acid battery is about 12.7 V rested and over 14 V while charging. Design for the range, not the label.
Four NiMH cells give 4.8 V, not 6. That is below what a 5 V regulator needs and above what the chip wants directly, which is an awkward place to be. Either use five cells and a regulator, or run the microcontroller directly at 4.8 V, which an ATmega328P at 8 MHz is happy with.
Lithium cells, and the care they need
This is the section to read properly, because this is where a power supply can hurt someone.
A single-cell lithium battery holds a lot of energy in a small package. Mistreated, it can swell, vent, or catch fire, and once it starts it is very difficult to stop.
The rules, none of them optional:
- Use a cell with a protection circuit. Most 18650 cells sold for hobby use have a small board on one end that cuts off at over-charge, over-discharge and short circuit. Bare cells pulled from laptop packs usually do not, and should not be your first lithium battery.
- Charge with a charger made for lithium. The chemistry needs constant current then constant voltage, cutting off at exactly 4.2 V. A NiMH charger or a bench supply will not do this.
- Never discharge below about 3.0 V. A cell taken flat is damaged, and a damaged cell is the one that fails badly later.
- Do not charge unattended, and not on anything flammable. Not overnight, not on a carpet.
- A swollen cell is finished. Do not use it, do not puncture it, and dispose of it properly.
- Watch the temperature. A cell that gets hot while charging should be disconnected.
None of this makes lithium unusable. It makes it a battery that has to be respected, and a protected cell with a proper charger is genuinely safe in normal use.
Charging from the sun
The Siratek solar charger module, product 49598, does the whole job on one small board: it takes power from a solar panel or a USB socket, charges a single lithium cell correctly, and provides a system output.
From the silkscreen, the connections are:
| Connector | Purpose |
|---|---|
USB |
Micro USB input, for charging from a charger |
SOLAR + - |
The panel |
BATT IN + - |
The lithium cell |
SYS OUT + - |
Power out to your circuit |
CH LED |
Charging |
OK LED |
Charge complete |
The thing to understand about SYS OUT
SYS OUT is the battery voltage, not a regulated supply. It swings from about 4.2 V down to 3.0 V as the cell discharges.
So you cannot connect an Arduino’s 5V pin to it, and you cannot connect a 3.3 V device directly either, because 4.2 V is too much for one. What goes after SYS OUT is a regulator:
- For a 3.3 V circuit, a buck-boost converter, because the input crosses 3.3 V from both sides as the battery drains. A plain linear regulator stops working once the cell falls below about 3.5 V, taking most of the usable capacity with it.
- For a 5 V circuit, a boost converter.
This is the detail that turns a project that runs for two hours into one that runs all night.
Sizing a panel
Work out the daily energy first, in milliamp-hours:
average current x hours per day = mAh per day
An ESP32 node that wakes for ten seconds every fifteen minutes averages perhaps 3 mA, so about 72 mAh a day. A panel producing 100 mA in good sun needs roughly an hour of good sun to cover that, which gives comfortable headroom.
Then size the battery for the days with no sun. Harmattan haze and the rainy season both cut output significantly, so three days of autonomy is a sensible minimum: around 220 mAh for the node above, which a 1000 mAh cell covers with room to spare.
Panels are rated in bright perpendicular sun. A panel flat on a windowsill in haze may give a fifth of its rating, so being generous costs little and saves a service visit.
Measuring, rather than hoping
Three measurements settle whether a supply design works, and all three need a multimeter.
Output voltage, unloaded. Should be what the regulator claims.
Output voltage, under full load. If it sags, the regulator is at its limit or the input is.
Input current, under full load. Compare it with the output current. On a linear regulator they are nearly equal, and the voltage difference is the heat. On a switching regulator the input current is lower than the output current when stepping down, which is the efficiency you paid for.
Using a Multimeter covers the last one, including which socket the red lead goes in and why leaving it there is expensive.
Check yourself
- A linear regulator drops 12 V to 5 V at 500 mA. How much heat, and is that reasonable?
- Why can a plain 3.3 V linear regulator not run a circuit from a lithium cell for long?
- Four NiMH cells give 4.8 V. What are the two sensible ways to use that?
- A solar node averages 5 mA. Roughly what battery gives three days of autonomy?
Answers in order: 3.5 watts, which is far too much for a small module; use a buck converter. The cell falls below about 3.5 V long before it is empty, and the regulator needs headroom above its output; use buck-boost. Either five cells plus a 5 V regulator, or run the microcontroller directly at 4.8 V. About 360 mAh, so a 500 mAh cell or larger.
Troubleshooting
| Symptom | Likely cause | Check or fix |
|---|---|---|
| Regulator too hot to touch | Input far above output | Reduce the drop, or use a buck converter |
| Output sags under load | At the current limit | Check the heat; use a bigger regulator |
| Works on the bench, not on battery | Battery voltage range | Design for the full range, not the label |
| Circuit dies with the battery half full | Linear regulator out of headroom | Use buck-boost |
| Analog readings noisy on a switching supply | Switching ripple | Add a small linear regulator for the analog part |
| Battery never charges fully | Panel too small, or sited badly | Measure the panel current in real conditions |
| Cell swollen | Overcharged or damaged | Stop using it; dispose of it properly |
| Charger warm, cell hot | Fault | Disconnect at once |
| 5 V from four NiMH cells | It is 4.8 V | Five cells, or run at 4.8 V directly |
| Node dies after two cloudy days | Not enough autonomy | Size for three days without sun |
Next steps
- Easier first: Powering Your Project, for the Arduino’s own supply routes.
- Related: Using a Multimeter, for all three measurements above.
- Next: Running an ATmega328P Without the Board, where you choose the supply from scratch.
Sources and attribution
All text in this tutorial are original Siratek work.
- AMS1117 datasheet for the dropout behaviour and current rating; the heat formula is Ohm’s law applied to a linear regulator.
- The three-pin
VIN OUT GNDmodule and the solar charger’sUSB,SOLAR,BATT INandSYS OUTconnectors with theirCHandOKindicators were read from the Siratek product photographs for items 49878 and 49598.
Lithium battery handling guidance follows standard practice for single-cell lithium chemistry and is not specific to any product. Panel and battery sizing figures are worked examples; local conditions, including harmattan haze and the rainy season, change them considerably. No third-party tutorial text, diagrams, photographs or code has been reproduced here.

