I'm building a toy for a baby that basically runs an ESP32, 2 class-D amplifiers, an SDCard module and a NeoPixel (a single one..). It has to be battery powered and so far I've found out that it's harder than I thought...

Here are the power requirements of all components (at least as I understand them). I tried to put together my design of how to power this using a rechargeable battery but would love to know if I'm doing it OK.

Component Input voltage Estimated current
Wireless charger receiver Rated for output of 1A
ESP32 Regulated 3.3V or 5-12V ~80mA
MAX98357A 2.7-5.5V ? (see question 3)
Adafruit SDCard Module 3.3V or 5V ~100-150mA ? (based on general estimations)
NeoPixel 5V (but seems to work fine with 3.3V) ~30mA

When I connected everything to a powerbank (5V) I noticed that voltage fluctuates when I play audio through the speakers. The powerbank wasn't the most quality one so I normally started with 4.8-5V and when started to play audio it dropped to 4.5V and sometimes just caused the ESP32 to reboot.

It seems that I can power all components using either 3.3 or 5V. I assumed that it's best to regulate voltage only once (all those boards have internal regulators), so I came up with this schematic. I hope it makes sense but I never built something like that before so have no idea if it is even practical or there is anything else I'm missing.


simulate this circuit – Schematic created using CircuitLab

  1. The TP4056 gives me a voltage between 2.4-4.2V. I first need to regulate it to 3.3V (mainly for the ESP32 and the SDCard which seem to be sensitive to voltage changes). What's the best way to do it in my setup? Is "buck-boost" the converter I need? It seems that I need it to have a pretty stable output. Is it better to only regulate voltage down and cut it off at 3.3V?

    Can anyone refer me to the recommended component? I'm overwhelmed by many types of regulators and many many different parts..

  2. Is it OK to connect the amplifiers to the raw battery voltage? I assumed that since they need the most current (and cause the spikes), maybe it's better to feed them separately from the sensitive components, and save some of the load on the regulator if it's not needed in their case.

  3. As for the amplifiers - They are rated for 3W. I tried to measure current while playing an audio file, and got an average of 200-250mA. But if I understand correctly, that only gives (250mA * 5V = 1.25W). Is that within normal range or did I miss anything? (I played a reasonably loud file).

  4. I'm mostly afraid for battery hazards. If I understand correctly, the TP4056 (with the DW01 protection chip) should be safe for use, right? I thought to add another 1A (or 2A) fuse on the main battery line to limit the total drawn current even more, but not sure if I'm not just too paranoid..

    I don't need fast charging (and the wireless receiver only gives 1A anyway). I saw there's a resistor I can play with to limit charging current. Is it safer if I lower it down to something like 500mA or it won't really make a difference?

    Is that battery (for example) suitable for me? Do I need to look for anything specific?

Many thanks!

  • \$\begingroup\$ Maybe you can supply more details about the schematics? Like, do you use bulk caps/decoupling caps to relieve spikes? And before you put this device next to a baby: in my opinion lipo's are dangerous without direct supervision. Even build with the best intentions, you wouldn't like to risk a fire. \$\endgroup\$
    – RemyHx
    Commented Sep 25, 2022 at 14:07
  • \$\begingroup\$ NB about the regulator: you use the regulator on a esp32 board? Do you power the esp32, neopixel and sd card by sharing the regulator output? And how do you measure current? \$\endgroup\$
    – RemyHx
    Commented Sep 25, 2022 at 14:15
  • \$\begingroup\$ Thanks @RemyHx! I don't have much more details as I just started to think about it. Since I'm inexperienced with electronics, I thought to ask before I actually build this. I can use caps if are helpful. Do you mean across the regulator GND and OUT? I thought to share the regulated output between all components, Is that a bad idea? I mainly wanted the large power consumers out of it. I measure current with a simple multimeter. I guess not the most accurate but gives me an estimate.. Again - would love to know what's the correct way. \$\endgroup\$
    – Zach Moshe
    Commented Sep 26, 2022 at 13:16
  • \$\begingroup\$ @RemyHx - Also - I'm concerned with the battery too, without it I would have just try to build this and see if it works.. What are the safer alternatives (assuming it's a mobile toy, not connected to a wall and I need a rechargeable battery)? IIUC most of the risk is when the battery is charged? At that time the toy is not being used, so is it riskier than my phone is being charged on a wireless charger? \$\endgroup\$
    – Zach Moshe
    Commented Sep 26, 2022 at 13:19
  • 1
    \$\begingroup\$ @ZachMoshe Sure you can use a fuse, but what does it protect from? If you put a fuse on PCB, it protects PCB but does not protect if the wires to battery pack short out. If you put a fuse to wires right at the battery pack it protects the wires but a mishandled battery can short out internally and it does not protect from that. Rechargeable batteries can simply release their energy in spectacular ways when mishandled or damaged. In a sense you are correct, engineering products is always a trade-off, and there are many other factors involved than just safety and sustainability. \$\endgroup\$
    – Justme
    Commented Sep 28, 2022 at 7:49

1 Answer 1

  1. You are on the right track with a SEPIC (Buck Boost) converter. They are not that much more and will work great with what you are doing. Running everything at 5V would be my choice as you will get extra filtering with the on card regulators at the cost of a small amount of power. You need to calculate the power you will need. The audio is 3.2W each or 6.4W or 1.25 Amp.

  2. Is it OK to connect the amplifiers to the raw battery voltage? Your basic assumption is correct but it has I2C which places its limit at about 5V. My recommendation is to use the 5V for this.

  3. Without the proper instrumentation such as a scope you will not get a stable reading so I used the output wattage as a guide. We will add a fudge factor later.

  4. Fuses in series will not help and will blow the weakest one each time.

You need to add all the currents together to get your battery load. Also be sure to add in the current the SEPIC converter will draw, since it is boosting it will be more than the load. Multiply your number by at least 1.3 to get your current. Once you know this you then need to know how long it needs to operate on a charge. At this point you can size your battery and then pick the appropriate charging device.

This is not a complete solution but it will give you a good start in solving your problem. As you figure out what parts you will be using do another schematic as you plan on wiring it and we will help you. You can always play the camera game and have one battery on charge while using the other.

I do this a lot, I use a SEPIC converter set to about 8V then use this to feed the linear regulators. This approach adds additional filtering and the lower input voltage keeps the linear regulators cooler. The regulator on the SD card holder is to to reduce the voltage for the SD card itself when powered with 5V. You do pay a price, it requires more energy.

  • \$\begingroup\$ I thought that converting twice is something to avoid (once from battery to 5V and then internally on the ESP/SDCARD from 5V to 3.3V). Is that not that bad? \$\endgroup\$
    – Zach Moshe
    Commented Sep 26, 2022 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.