Powering ESP32 with 7.4V battery. PCB Design review

Thread Starter

statieva

Joined Nov 27, 2024
40
Hey everyone!

I'm currently designing a PCB for a device controlled by a remote (both based on the ESP32). I want to clarify upfront that I'm not a professional electronic engineer—just a hobbyist.

A quick overview of the PCB's main functions:
It controls a NEMA17 stepper motor through a TMC2208 driver. A low-voltage relay disconnects the motor when it's not in use. The device is powered by a 7.4V battery. Power is converted from VCC to 5V using an AMS1117 regulator for the relay, then from 5V to 3.3V to power the ESP32-WROOM-32U.

View attachment Schematic.jpg
back.jpg
3V3 rail highlighted

back2.jpg
front.jpg

5V rail highlighted

The problem:
The PCB works for a few hours from the battery but then stops. However, when I supply 3.3V directly to the ESP32 through the pins (for sketch uploading), it works (receives and sends data, and the seven-segment indicator works as well, though the motor and relay don’t activate due to insufficient current). What could be the issue?

A few thoughts:
  • During my search for solutions, I discovered that a flyback diode should be added to the relay. I'm planning to include a 1N4007 in the next revision. The boards that experienced this issue didn’t have a flyback diode, but could we rule out the relay’s harmful impact since the ESP32 itself still works fine?
  • While the PCB was functioning, the relay produced a ticking sound (it wasn’t activating, just slightly ticking), which seemed to coincide with moments when the MCU sends data (it’s programmed to send data every second). Could this indicate some form of interference? Any tips on how to eliminate it?
  • After the PCB stopped working, I tried several power supply configurations from the battery. I dismantled the relay (to eliminate potential harmful magnetic fields) and connected the battery directly to the AMS1117 3.3V. I also tested an MP1482 buck converter, but nothing seems to bring the PCB back to life.
  • It’s worth noting that when the PCB first stops working from the battery, it briefly turns on for a short period, but this period keeps getting shorter until it fails to power up at all. I’ve assembled a few boards, and they all have the same issue.
Any suggestions or theories would be greatly appreciated! Thanks in advance!

UPDATE
It turns out that when I connect the board only to the 3.3V and GND pins of the programmer, it doesn't work as well. However, when I also connect the BOOT, EN, RX, and TX pins, it works well — even when the programmer is powered by a power bank or another external source. This suggests that the issue might be related to the boot process of the microcontroller itself. But everything was fine previously, what might have caused that issue? I use this programmer:
programmer.jpg
 
Last edited:

Ya’akov

Joined Jan 27, 2019
10,226
Welcome to AAC.

A couple of thoughs…

1. The buck converter is probably a better idea than the linear regulator in any case. The regulator is going to have to dump the power as heat, making your power supply very inefficient. Have you got the recommended capacitors on the AMS1117?

2. The freewheeling (flyback) diode could help even if the MCU is not being immediately damaged. The spikes caused by the EMF could be causing issues with the CPU, do you have a watchdog running?
 

Thread Starter

statieva

Joined Nov 27, 2024
40
Welcome to AAC.

A couple of thoughs…

1. The buck converter is probably a better idea than the linear regulator in any case. The regulator is going to have to dump the power as heat, making your power supply very inefficient. Have you got the recommended capacitors on the AMS1117?

2. The freewheeling (flyback) diode could help even if the MCU is not being immediately damaged. The spikes caused by the EMF could be causing issues with the CPU, do you have a watchdog running?
Thanks for the reply.
1. A buck converter is definitely a better solution, and I plan to switch to it. However, I’d like to first understand the root cause of the problem. I used standard capacitor values, which are commonly found on modules using these regulators.
2. I’m not familiar with the watchdog. If it needs to be enabled manually, it’s likely not running. Could you please tell me more about it?
 

sparky 1

Joined Nov 3, 2018
1,218
The dual USB 18650 smart charger can merge with the micro controller,
another USB cable for non battery operation and another USB for data.
 

BobTPH

Joined Jun 5, 2013
11,463
It sounds to me like the 5V regulator is being damaged. Did you check its input and output when the board fails?
 

Thread Starter

statieva

Joined Nov 27, 2024
40
It sounds to me like the 5V regulator is being damaged. Did you check its input and output when the board fails?
I didn't check the voltage on the 5V regulator when the board was failing, but I replaced the regulator with a new one, and it still didn't resolve the issue.
 

sghioto

Joined Dec 31, 2017
8,633
I know where it goes is that to monitor the battery voltage?
What represents the Motor in the schematic or what turns ON this motor?
 

Thread Starter

statieva

Joined Nov 27, 2024
40
I know where it goes is that to monitor the battery voltage?
What represents the Motor in the schematic or what turns ON this motor?
Apologies, I didn't get your question at first. Correct, that's a battery voltage monitor. The motor connects to the U4 connector.

It turns out that when I connect the board only to the 3.3V and GND pins of the programmer, it doesn't work as well. However, when I also connect the BOOT, EN, RX, and TX pins, it works well — even when the programmer is powered by a power bank or another external source. This suggests that the issue might be related to the boot process of the microcontroller itself. But everything was fine previously, what might have caused that issue? I use this programmer:

programmer.jpgthis programmer
 

sghioto

Joined Dec 31, 2017
8,633
Are you saying this circuit was working for a long time and just now you have this issue with it shutting OFF after a couple of hours?
 

Thread Starter

statieva

Joined Nov 27, 2024
40
Are you saying this circuit was working for a long time and just now you have this issue with it shutting OFF after a couple of hours?
The circuit I assembled on a perfboard with the ESP32 development board was working well. However, I just tried reuploading the code to my custom PCB, and it works now! Thank you for the advice—it’s given me a fresh perspective for troubleshooting the issue.
 
Top