Sponsored links

Make a power supply circuit (step-up/step-down DCDC converter) to run ESP32 on about two batteries.

Sponsored links


ESP32 is a microcontroller that operates at about 3V to 3.3V. I'm going to make a DCDC converter circuit to run on about two batteries.

To see what the circuit looks like, please see the previous article.

Sponsored links



The DCDC converter IC I had ordered from Digikey has arrived.

These are very small. The pitch of the IC is only 0.5 mm. I used 0.1mm polyurethane wire to pull out the wires and connect the components to this IC.

After several hours of work, the soldering was finally completed. Will it work?

Try varying the input voltage between about 2V and 5V at the power supply. The output is always stable at about 3.28V. It seems to be working properly.

Replace regulator with DCDC converter

I'm going to remove the regulator from the ESP32-DevkitC and connect the DCDC converter I just made here.

Removing the regulator is difficult with a soldering iron, so use hot air to heat the parts and remove them.

Hot air is extremely useful for multi-pin devices that cannot be removed with a soldering iron.

I was able to remove it easily.

Connect the DCDC converter I just made in place of the regulator.

Frequent reboots

Writing the program

I will test the operation with the program I am currently testing, which is a weighing scale using a strain gauge. I used to use four batteries together at 4.8V, but now that the DCDC converter is installed, I will try to run two batteries together at 2.4V.

The program was successfully written from the ArduinoIDE to the ESP32. The DCDC converter is working fine so far.

The program for the scales using strain gauges sends the measured weight to Ambient's server. You will then need to connect to WiFi. The timing of connecting to this WiFi caused the microcontroller to reboot one out of several times.

Looking at the log, I found that it was an internal reset due to low power supply voltage. The ESP32's power consumption increases drastically when using the wireless LAN function, and it may have exceeded the supply capacity of the DCDC converter.

For now, I added a 100uF capacitor to the 3.3V pin of the ESP32. Then it got worse, as it would always reset itself at the time to connect to WiFi.

Checking the power supply voltage with an oscilloscope, I found that the voltage has dropped below 3V to 2.5V. If a large capacitor is connected to the output of the DCDC converter, the DCDC converter seems to become unstable when the ESP32 needs a large amount of power.

Adding a capacitor to the input

I removed the 100uF attached to the output and now added a 100uF tantalum capacitor (the orange square part) to the input of the DCDC converter. Furthermore, I connected the + wire of the battery to the + input of the DCDC converter for a short distance.

Then the reboot was gone. I monitored the power supply with an oscilloscope, and I think the voltage drop that stopped the oscilloscope's trigger from being tripped is almost gone.

Modify the voltage measurement program


In this measurement circuit, the battery voltage is converted to half the voltage using two 1MΩ and the value is A/D'd to monitor the battery voltage. To stabilize the measurement voltage, a 0.1uF capacitor is wired in the A/D input. Without it, the small capacitor built into the A/D converter will lose electricity during the A/D process, resulting in a slightly lower A/D value.

To convert A/D values to voltages, I have been using some conversion formulas that I found on the Internet, but the values didn't seem to match, so I measured them myself and made a conversion formula.

The voltage input to the A/D is divided in half using two 1MΩ units. The voltage before it was halved was varied from 0V to 6.5V in 0.5V steps, and the A/D value was measured. Based on the results, an approximate formula was calculated to find the voltage from the A/D value. But I just used the approximate formula function of Numbers.

As a result.

  int battAD = analogRead(BATT_AD_PIN);
  double battVoltage = -7.399 * 0.00000001 * battAD * battAD + 0.0018 * battAD + 0.1788;

I can now get the voltage value with the program.

I'll measure it for a while

With two rechargeable batteries, I recorded the measurement results of the strain gauge type scales in Ambient for a while.

Battery voltage is stable at 2.6 to 2.5V. This is the same as the value measured by the tester. The strain gauge scales are also stable, with no major fluctuations, probably because they are kept indoors.

And, add an ideal diode

We will also add an ideal diode, which is necessary for switching between battery and USB power. For more information on ideal diodes, please see this article.

This is also a very small package.

I wired this to the input of the DCDC converter.

Step-up/step-down DCDC has been successfully activated


The ESP32-DevkitC, a DCDC converter that runs on about two batteries, worked fine. I'm a little worried about the voltage drop due to high power consumption when using WiFi, but it may improve once it's on the PCB. The resistance and inductor components of the wiring have quite a large impact.

Anyway, wiring the 0.5mm pitch IC was very difficult.

2020.4.5 Added I used it for a mailbox with a built-in scale.

End of addition

Copied title and URL