#400 The Best Power Source for ESP32/ ESP8266 Projects

Andreas Spiess
5 Sept 202114:29

Summary

TLDRThis video script offers a comprehensive guide for powering small projects with a focus on 3.3-volt microcontrollers like the ESP32. The presenter discusses five common use cases: mains-powered devices, solar-powered devices, battery-operated continuous usage, devices running 24/7 with periodic wake-ups, and event-triggered devices. Solutions include USB power for mains, solar panels with battery backup for outdoor use, and various battery options for portable and low-power applications. The script also addresses design considerations, such as power regulators, deep sleep modes, and non-volatile memory for data retention. A decision tree is provided to help viewers choose the best power solution for their specific project needs.

Takeaways

  • 🔌 The video discusses powering small projects with a focus on 3.3-volt microcontrollers (MCUs), using the ESP32 as an example.
  • 🛠️ There's no one-size-fits-all power solution, so the video presents different strategies for five common use cases.
  • 🏠 For mains-powered devices, the author recommends using standard USB or 5-volt powered development boards and a USB power brick for compact setups.
  • 🌞 Solar power is suggested for outdoor applications, with small solar panels and a 3.7-volt battery to store energy, along with a 3.3-volt regulator for the MCU.
  • 🔋 Portable battery-operated devices for short operations can use boards with built-in displays and GPS, like the TTGO boards, which are favored for their compactness and features.
  • 🕒 Devices that run 24/7 and wake up periodically should focus on low power consumption, often using replaceable batteries due to the simplicity and longevity.
  • 🛑 For devices triggered by events and working in short moments, two approaches are presented: deep sleep mode or complete shutdown with a mechanical switch.
  • 🔋 The video mentions the use of LiFePO4 batteries as a good alternative to Li-ion batteries for low power consumption devices due to their chemistry and availability.
  • 📶 The author advises caution with different versions of development boards, especially regarding pinouts and power requirements, to avoid compatibility issues.
  • 🛠️ Additional circuitry may be needed for mechanical switch-based devices to ensure reliable operation and message transmission.
  • 🔄 The importance of using non-volatile memory or EEPROM for storing data in devices that completely power off is highlighted to prevent data loss.

Q & A

  • What are the five most popular use cases for powering small projects mentioned in the script?

    -The five use cases are: 1) Devices powered by mains; 2) Solar-powered devices; 3) Battery-operated devices for continuous usage with short operations; 4) Battery-operated devices that run 24/7 and wake up regularly; 5) Devices that monitor an event and work for short moments.

  • Why does the script focus on 3.3 volts for powering MCUs and sensors?

    -The script focuses on 3.3 volts because most current MCUs and sensors work on this voltage, and it uses the ESP32 as an example for the concepts.

  • What is the recommended power supply for mains-powered devices in the script?

    -For mains-powered devices, the script recommends using cheap standard USB or 5-volt powered development boards and a USB power brick for power.

  • How does the script suggest dealing with power outages for mains-powered devices?

    -For dealing with power outages, the script suggests using battery-operated ports tested in a previous video, which have the needed circuitry to charge a Li-ion battery and can survive power outages for many hours.

  • What type of solar panel and battery combination is suggested for outdoor applications in the script?

    -For outdoor applications, the script suggests using a 5.5 or 6-volt solar panel with a TP-4056 Li-ion charger and a power path to charge a 3.7-volt battery.

  • Why is a 3.3-volt regulator needed when using a 4.2-volt maximum battery with a 3.3-volt MCU?

    -A 3.3-volt regulator is needed to step down the battery voltage because most 3.3-volt MCUs are not rated up to the 4.2 volts maximum of those batteries.

  • What is the preferred method for powering portable devices used for short operations like weather balloon receivers?

    -The preferred method is using TTGO boards with a built-in display and, if needed, an SMA connector for antenna connection.

  • How does the script suggest optimizing battery life for devices that run 24/7 and wake up periodically?

    -The script suggests omitting a built-in charging circuit and using replaceable batteries, as replacing batteries annually is often easier than recharging remote devices.

  • What is the advantage of using mechanical switches for devices that are triggered externally, like a mailbox notifier?

    -Mechanical switches allow the device to be completely off and not consume current when not triggered, which is excellent for situations where triggers are infrequent.

  • How can data be retained when the MCU is switched off in devices that use mechanical switches?

    -Data can be retained by storing it in non-volatile memory or EEPROM before the MCU is switched off, although this method has a limited number of write cycles.

  • What is the purpose of the flow diagram provided at the end of the script?

    -The flow diagram is intended to help users decide the best power solution for their projects by answering a series of questions related to their specific use case.

Outlines

00:00

🔌 Powering Small Projects with Various Use Cases

The speaker introduces a video focused on powering small projects, highlighting a curated list of solutions for five common use cases. The video aims to guide viewers on choosing and building power solutions for their projects. The presenter, known for his Swiss accent, emphasizes the importance of focusing on different use cases rather than a one-size-fits-all approach. The discussion primarily revolves around 3.3-volt microcontrollers (MCUs), using the ESP32 as an example. The speaker also mentions the importance of subscribing to the channel for regular updates on sensors and microcontrollers.

05:02

🌞 Solar and Battery Power Solutions for Outdoor Devices

This paragraph delves into the specifics of powering outdoor devices, such as solar-powered light sensors. The speaker recommends small and affordable solar panels paired with a battery to provide continuous power even when sunlight is not available. A 5.5 or 6-volt solar panel is suggested, along with a TP-4056 Li-ion charger and a power path management circuit. For voltage regulation, a 3.3-volt regulator is necessary due to the maximum voltage of 4.2 volts of the battery, which is higher than the voltage rating of most 3.3-volt MCUs. The use of a PCB with an HT7333 regulator and capacitors is recommended for minimal power consumption during deep sleep. Programming is facilitated through a USB-to-serial adapter with a 3.3-volt feature, and the speaker advises caution when using standard battery-operated boards due to voltage limitations.

10:04

🔋 Options for Battery-Operated Devices with Continuous and Event-Based Usage

The speaker discusses two types of battery-operated devices: those used for continuous operations and those that operate on event triggers. For continuous usage, the focus is on minimizing power consumption, with the speaker suggesting the use of replaceable batteries due to the ease of replacing over recharging, especially for devices that run for extended periods. For event-based devices, two approaches are presented: keeping the MCU in deep sleep mode to conserve power or completely switching off the device with a mechanical switch. The latter is advantageous for infrequent triggers as it eliminates power consumption when not in use. The speaker also addresses the challenge of ensuring that a mechanical switch provides sufficient power to transmit a message and proposes a solution involving additional circuitry with FETs. Lastly, the importance of storing data in non-volatile memory before the MCU is switched off is highlighted.

Mindmap

Keywords

💡Powering

Powering refers to the process of providing electrical energy to a device or system. In the context of the video, powering is central to the theme as the creator discusses various methods to supply energy to small projects, such as using mains power, solar power, or batteries. The video aims to guide viewers on how to choose the appropriate power source for different use cases.

💡ESP32

ESP32 is a microcontroller unit (MCU) that is widely used in small projects due to its Wi-Fi and Bluetooth capabilities. The video uses the ESP32 as an example to illustrate how different power solutions can be implemented for various applications. It is mentioned as a common component that requires a 3.3-volt power supply.

💡Mains Power

Mains power, also known as mains electricity, is the general term for the standard AC electrical supply found in many countries. The video discusses using mains power for devices like a weather station receiver, emphasizing its convenience for projects that do not require energy conservation.

💡Solar Power

Solar power is the energy derived from sunlight, typically captured by solar panels. The script mentions solar power as a viable option for outdoor applications, such as powering a light sensor, where a small solar panel combined with a battery can provide a sustainable power source.

💡Battery-Operated Devices

Battery-operated devices are those that run on batteries as their primary power source. The video outlines different scenarios for battery use, such as devices used for continuous operation, short operations, and those that run 24/7 but wake up periodically.

💡3.3 Volt Regulator

A 3.3 volt regulator is a component that ensures a stable 3.3-volt output, which is necessary for many microcontrollers, including the ESP32. The video explains the need for a 3.3 volt regulator when using batteries that can exceed this voltage to prevent damage to the MCU.

💡Deep Sleep

Deep sleep is a power-saving mode in which a device or microcontroller consumes minimal power. The video highlights the importance of deep sleep for extending battery life in devices that need to operate for extended periods without frequent charging.

💡Microcontroller Unit (MCU)

A microcontroller unit (MCU) is a small computer that integrates a processor core with memory, and programmable input/output peripherals. The video focuses on MCUs that operate on 3.3 volts, discussing how to power them efficiently for various applications.

💡USB Power Brick

A USB power brick is a compact power adapter that provides power to USB devices. The script describes using a USB power brick for powering mains-powered devices, offering a simple and cost-effective solution for projects that do not require energy conservation.

💡LiPo Battery

LiPo, short for lithium-polymer battery, is a type of rechargeable battery known for its high energy density and small size. The video discusses using LiPo batteries for devices that can handle the charging circuitry and need to survive power outages.

💡TTGO Boards

TTGO Boards are a series of development boards that often include features like built-in displays and wireless communication modules. The video mentions TTGO boards as a preferred choice for portable devices used for short operations, highlighting their versatility and compactness.

💡AXP192 Chip

The AXP192 is a power management chip that can handle various power-related functions, including charging and power path management. The video describes the use of the AXP192 chip in devices like the T-Beam, which is designed for location-based applications and requires efficient power management.

💡Non-Volatile Memory

Non-volatile memory is a type of memory that retains data even when power is not supplied. The script suggests using non-volatile memory or EEPROM to store information in devices that may be completely switched off, ensuring data is not lost.

Highlights

Introduction to the video on powering small projects with a focus on 3.3-volt microcontrollers (MCUs) and sensors.

Discussion on the lack of a one-size-fits-all power supply and the importance of focusing on different use cases.

Explanation of the first use case: mains-powered devices, utilizing standard USB or 5-volt powered development boards.

Recommendation of a mini board for mains-powered projects due to its small size and availability of many pins.

Suggestion to use a cheap USB power brick or a compact 5-volt power supply for power in mains-powered projects.

Introduction to the second use case: solar-powered devices, emphasizing the use of small and cheap solar panels.

Recommendation of a 5.5 or 6-volt solar panel with a TP-4056 Li-ion charger for solar-powered projects.

The need for a 3.3-volt regulator between the battery and the MCU in solar-powered projects.

Use of a USB to serial adapter with a 3.3-volt feature for programming solar-powered projects.

Introduction to the third use case: battery-operated devices for continuous usage without sleep.

Recommendation of TTGO boards for portable devices due to their built-in display and compact size.

Explanation of the fourth use case: battery-operated devices that run 24/7 and wake up periodically.

Discussion on the benefits of using LiFePO4 batteries over Li-ion for low power consumption devices.

Introduction to the fifth use case: devices that monitor an event and only work for short moments.

Suggestion to use deep sleep mode or a mechanical switch for event-triggered devices to save power.

Recommendation of the TRIG board for extremely low current draw and periodic wake-ups.

Discussion on the use of non-volatile memory or EEPROM to store information before the MCU is switched off.

Conclusion emphasizing the importance of distinguishing use cases to determine the best power solution.

Call to action for viewers to comment with their use cases or better solutions for community learning.

Presentation of a simple flow diagram for decision making regarding power solutions for different use cases.

Transcripts

play00:00

are you interested in my way of powering

play00:02

small projects

play00:04

after many discussions and evaluations i

play00:07

created a favorite list with solutions

play00:09

for the five most popular use cases

play00:13

why did i choose them and how can you

play00:15

build them

play00:17

after the video you should have a

play00:19

decision tree for your future projects

play00:22

gritsy youtubers here is the guy with

play00:25

the swiss accent with a new episode and

play00:27

fresh ideas around sensors and

play00:30

microcontrollers

play00:31

remember if you subscribe you will

play00:34

always sit in the first row

play00:37

because most of the current mcu's and

play00:39

sensors work on 3.3 volts i will

play00:42

concentrate on this voltage and use the

play00:44

esp32 as an example

play00:47

however all concepts can be used for

play00:50

other 3.3 volt mcus

play00:52

unfortunately there is no

play00:55

one-size-fits-all power supply this is

play00:58

why i do what we always should do

play01:00

i focus on different use cases

play01:03

the first use case is about devices

play01:06

powered by mains like this receiver for

play01:08

my weather station or the bluetooth

play01:11

receiver for my xiaomi body scale of

play01:14

video number 307

play01:17

number two

play01:18

solar-powered devices like my light

play01:21

sensor

play01:22

number three battery-operated devices

play01:25

for continuous usage like these tiny

play01:27

receivers for weather balloons or this

play01:30

lora tracker

play01:31

both devices are only used for short

play01:34

operations

play01:35

use case number four battery-operated

play01:38

devices that run 24 x 7 and regularly

play01:42

wake up

play01:43

like temperature and humidity sensors

play01:46

number five

play01:47

devices that monitor an event and only

play01:50

work for short moments like this mailbox

play01:53

notifier or this amazon dash button what

play01:56

is my solution for the simplest use case

play01:59

the mains powered devices

play02:02

i use cheap standard usb or 5 volt

play02:05

powered development boards because these

play02:07

boards do not have to save energy for

play02:09

this application

play02:11

they also offer a usb connector for

play02:13

programming and debugging

play02:15

by the way this mini board is my current

play02:18

favorite because it offers many pins and

play02:20

is small

play02:22

most of the time i solder the wires

play02:24

directly onto the pcb without pin

play02:27

headers

play02:28

for power i usually use a cheap usb

play02:31

power brick and

play02:33

if i want everything in a single and

play02:35

compact case i add such a small 5 volt

play02:38

power supply right in the project case

play02:41

as i did for this home automation

play02:44

watchdog of video number 385

play02:47

by the way you find all links to the

play02:50

products i use in the video description

play02:53

if you fear power outages i suggest

play02:55

using one of those battery-operated

play02:58

ports tested in video number 387

play03:01

they all have the needed circuitry to

play03:04

charge a lion battery

play03:06

such boards will survive power outages

play03:09

of many hours without problems

play03:11

here my favorite has the same form

play03:13

factor with additional battery circuitry

play03:16

please pay attention to use either a

play03:19

short or a quality usb cable otherwise

play03:22

the esp32s can create brown outs because

play03:26

of the cable loss

play03:27

what about use case number two

play03:30

it is mainly for outdoor applications

play03:32

where we can use solar power

play03:35

these days small and cheap solar panels

play03:37

provide enough energy for a typical

play03:39

project

play03:40

of course we need a battery to bridge

play03:43

times without sun

play03:45

no not a tesla powerball just a small

play03:48

single lion sill

play03:51

in this scenario we do not have to save

play03:53

every microampere i suggest using a 5.5

play03:57

or 6 volt solar panel then we can use a

play04:01

simple

play04:02

tp-4056 lyon charger with a power path

play04:05

as shown in video number 383 to charge a

play04:08

3.7 volt battery

play04:10

because the maximum voltage of those

play04:12

batteries is 4.2 volts and most 3.3 volt

play04:16

mcus are not rated up to this voltage we

play04:19

have to add a 3.3 volt regulator between

play04:22

the battery and the mcu

play04:25

the best solution is to use such a pcb

play04:28

with a bare module an ht7333

play04:31

regulator and one or two capacitors as

play04:35

suggested by the datasheet

play04:37

these boards only consume microamperes

play04:40

during deep sleep

play04:41

for programming i use such a usb to

play04:44

serial adapter make sure you have a

play04:46

model with a 3.3 volt feature

play04:49

you could also use standard battery

play04:51

operated boards because the chips on

play04:53

these sports should support up to 6.5

play04:56

volts but again please consult the

play04:59

diagram and the data sheets before you

play05:01

try

play05:02

by the way i usually remove all leds on

play05:05

those boards because they just consume

play05:07

power if deployed in a case

play05:10

can you also use standard development

play05:12

boards without the battery

play05:15

yes but i suggest using an hd 7333

play05:19

regulator and connect power to the 3.3

play05:22

volt because the standard

play05:24

ams-1117 regulators stop working at

play05:27

about 4 volts

play05:29

low dropout is only marketing in this

play05:31

case keep in mind that these boards need

play05:34

quite some power during deep sleep

play05:36

because of the additional parts on the

play05:39

board

play05:40

next is use case number three portable

play05:42

devices used for short operations like

play05:45

the receiver to search for weather

play05:47

balloons or mapping gateway coverage

play05:50

they are battery operated and do not

play05:52

sleep at all

play05:53

here i love those ttgo boards because

play05:56

they have a built-in display

play05:58

you even get versions with the laura

play06:00

chip on board then you can decide if you

play06:02

want an sma connector mounted on the

play06:04

board or connected via a pigtail

play06:07

creating cases is easier for the version

play06:10

with a pigtail however i prefer the sma

play06:13

version

play06:14

for all location-based applications the

play06:17

t-beam is perfect it has a battery a gps

play06:21

and a lora chip on board and is very

play06:23

compact if you want to add an oled

play06:26

display please pay attention to choose

play06:28

the right one with the correct pin out

play06:31

maybe you order it together with a board

play06:34

then you know at least who is

play06:35

responsible if it does not fit by the

play06:38

way it uses the axp192

play06:42

chip for powering

play06:43

this is a very capable chip which also

play06:46

has a built-in on off function for

play06:49

example

play06:50

the only pain in the butt for most tt go

play06:52

boards is the different versions with

play06:55

different pin outs

play06:56

their naming is not at all intuitive and

play06:59

you have to pay extreme attention to

play07:02

find out which version you have and

play07:04

which pin out you have to use

play07:07

be also aware that they often do not use

play07:09

standard pins for i square c

play07:12

so you have to select the right board in

play07:14

your ide otherwise the pin definitions

play07:17

are wrong and your display will remain

play07:20

black or your sensors will not work

play07:23

at least they have all information

play07:26

including diagrams published on github

play07:29

i really hope they will learn something

play07:31

and give their boards clear names and

play07:33

print them on the boards it seems that

play07:36

the newer ones at least have the

play07:38

versions marked on the silk screen what

play07:41

about use case number four which is also

play07:43

battery operated but runs 24 times 7.

play07:48

to get a decent battery life these

play07:50

devices sleep most of the time and

play07:52

periodically wake up

play07:54

here every micro ampere counts because

play07:57

it reduces battery life

play07:59

after some iterations i concluded that

play08:02

because these devices run for month or

play08:05

even years on one battery omitting a

play08:08

built-in charging circuit considerably

play08:10

reduces the complexity of our design and

play08:13

increases its autonomy

play08:15

maybe you even use disposable batteries

play08:18

instead of rechargeable ones

play08:20

replacing batteries once a year is often

play08:22

easier because charging a battery takes

play08:24

much longer than just replace it

play08:28

unfortunately i do not see a lot of

play08:30

ready-made boards for this use case

play08:32

maybe we will see a change in the future

play08:36

the simplest version uses a live fipo 4

play08:38

battery instead of a lighon battery and

play08:41

connects it directly to a bare bone

play08:43

module

play08:44

because live f4 batteries have a maximum

play08:47

voltage of 3.6 volts we do not need a

play08:50

regulator and so we can avoid its losses

play08:53

liveapo4 batteries became more popular

play08:56

over the years and you get them in

play08:58

various versions

play08:59

i will show you the proper usage of such

play09:02

batteries in a future video

play09:04

to extend battery life even further you

play09:07

can use the trig board which is

play09:09

optimized for extremely low current draw

play09:11

and offers periodic wake ups without

play09:14

deep sleep

play09:15

if you want to use disposable batteries

play09:18

you have the choice of two or three aaa

play09:21

or 3 volt

play09:22

cr123a lithium cells

play09:25

because the maximum voltage of 3 aaa

play09:28

cells is more than 3.6 volts you need a

play09:31

voltage regulator and with only two of

play09:34

them your processor will stop working

play09:37

before they are empty but they have a

play09:39

lower sales discharge current

play09:42

than rechargeable batteries and also do

play09:44

not need a low voltage protector that

play09:46

also consumes a few microamperes

play09:49

deep sleep has two advantages the mcu

play09:52

can wake up without an external trigger

play09:55

and the rtc memory in the esp32 keeps

play09:58

its information during deep sleep

play10:01

other chips like the old atmel also keep

play10:03

their data during deep sleep

play10:06

what is left

play10:07

a use case similar to the one just

play10:09

discussed the main difference is that an

play10:12

external source triggers it

play10:14

good examples are this amazon dash clone

play10:17

or this mailbox notifier maybe i will

play10:20

show you my newest design in a future

play10:22

video

play10:24

here we have two possibilities we can

play10:26

deep sleep the board and wake it up with

play10:28

an external triggering pulse

play10:30

or we switch it completely off with a

play10:32

mechanical switch

play10:34

if we use deep sleep the design

play10:36

considerations are the same as in use

play10:38

case number four because the mcu is

play10:41

always on and most of the time in deep

play10:43

sleep however if we can use a mechanical

play10:46

switch we can get an additional

play10:48

possibility we can switch the board

play10:51

completely off and switch it on with a

play10:53

mechanical switch

play10:55

this has the advantage that it does not

play10:57

consume current if not triggered

play11:00

especially for situations we do not

play11:03

expect many triggers per time this is an

play11:05

excellent solution

play11:07

a window sensor against burglars for

play11:10

example will hopefully not trigger too

play11:12

often or my mailbox notifier only

play11:15

triggers twice a day once for my wife's

play11:18

newspaper and once for the packets from

play11:20

china for me

play11:22

the rest of the time it is completely

play11:25

switched off

play11:26

one problem has to be solved for many

play11:28

applications

play11:30

if the mechanical switch is on too short

play11:33

for transmitting a message we have to

play11:35

add some additional circuitry

play11:37

in video 101 i showed you a possibility

play11:40

with only one p-channel fit

play11:43

however it is not reliable because it

play11:45

depends on the inner circuit of the mpu

play11:49

this is why i propose to add a second

play11:51

fit here is the diagram

play11:54

these transistors are connected in

play11:56

parallel to the mechanical switch and

play11:58

are operated by a pin

play12:00

as soon as the mechanical switch powers

play12:02

the mcu it switches the n-channel fit on

play12:06

now the gate of the p-channel fet is at

play12:09

nearly zero volts and a parallel path

play12:12

exists to power the mcu

play12:15

when the switch is off the esp32 still

play12:18

is powered through the p-channel fit

play12:20

as soon as all tasks are done the mcu

play12:23

switches itself off and waits for the

play12:26

following mechanical trigger

play12:28

if you use a to-220 and an smd fit you

play12:32

can easily create such a small pcb

play12:35

the threadboard also works for this use

play12:37

case

play12:38

and tobias built the microwave capper

play12:41

for the same purpose

play12:43

these boards also switch the mcu off and

play12:46

therefore it loses all data

play12:48

suppose you want to keep the information

play12:50

store it in a non-volatile memory or

play12:53

eeprom before the mcu is switched off

play12:56

keep in mind that ee prompts wear out

play12:59

and you probably cannot do this for more

play13:01

than ten thousand times

play13:03

but this is enough for my mailbox

play13:05

notifier

play13:07

did i forget your use case or do you

play13:09

have better solutions

play13:11

please comment and we will learn

play13:13

together

play13:14

i promised a simple flow diagram for

play13:16

decision making here it is

play13:19

just answer the questions and you will

play13:21

get the use case and what solution i

play13:24

propose

play13:25

what do we have to remember

play13:28

there is no one size fits all but if we

play13:31

distinguish use cases we can determine

play13:34

the best solution for each case

play13:36

most current boards and projects use

play13:38

lion batteries however liveapo 4

play13:41

batteries often are the better choice

play13:44

they become more and more available

play13:46

devices with low power consumption do

play13:49

not need an onboard charging circuit it

play13:52

is often better to use replaceable

play13:54

batteries for them because replacing a

play13:56

battery every year is easier than

play13:59

recharging remote devices

play14:01

unfortunately we still do not find many

play14:04

such devices on the market

play14:06

the trick board and the microwave copper

play14:08

are interesting boards for special cases

play14:11

however they are not cheap

play14:14

as always you find all the relevant

play14:16

links in the description

play14:18

i hope this video was useful or at least

play14:20

interesting for you if true please

play14:23

consider supporting the channel to

play14:24

secure its future existence thank you

play14:28

bye

Rate This

5.0 / 5 (0 votes)

Related Tags
Power SolutionsMicrocontrollersESP32DIY ProjectsSolar PowerBattery OperatedMains PoweredIoT DevicesTechnical GuideElectronics Tutorial