Questions:
1) Somehow my ST7789 LCD do have CS pin, should I proceed to make connection from pin D5 on ESP32?
2) Is 18650 3.7v Li-ION battery be ok to use? If not, what sort of battery should I need be getting? And, I assume the battery connection will be made straight to both ESP32's VIN & GND pin, and as well as the input port of LM2596, as like before?
Thank you.
CW
1. No need for a connection to D5 in case of a ST7789 display without CS. The screen I use (240x240) has no chip select either.
2. A single 18650 unfortunately drains too fast, because the MD62 is really power hungry. So I ended up with 2x18650 in series.
Drawback is that you can't use a simple USB charger. Power supply options:
The easy one: take out the batteries to charge them. In that case, the LM2596 is connected straight to the batteries and turns the voltage down to 3.00V. For powering the circuit, I used a MINI360 buck converter that provides 3.3V straight to the 3.3V pin of the ESP32. This is more power efficient than using the Vin pin of the ESP32, since it only converts the excess voltage to heat. Using the Vin port with the output from 2 batteries uses 1.5 times as much power, compared to using a MINI360.
The slightly more complicated one:
Batteries stay inside, and this requires a 8.4V charger; make a connector in the housing that enables you to plug it in.
Since there are 2 batteries, a 2S BMS (battery management system) is connected to the batteries, so they charge even.
Use an on/off button in the battery circuit just before the buck converters are powered. When charging the batteries, turn the switch to off so the circuit doesn't charge and load the batteries at the same time (which is a bad idea and a fire hazard!).
The really complicated one (
no drawing yet!):
Instead of using a power on/off button, it's also possible to turn the analyser off in the menu. The ESP32 goes in standby mode.
In this case, the LM2596 has to be turned off. This can be done by de-soldering pin 5 of the chip (lift the pin from the circuit board while heating it) and connect it straight to pin 13.
A p-channel mosfet, transistor, schottky diode and a resistor are required to prevent using and charging the battery at the same time. The circuit will switch to the power supply when plugged in, and switches the battery again when unplugged. Not tested yet with 2 batteries, I'm waiting for parts to arrive (and I'm spending more time on another project). Google it, if anyone has the perfect combination with minimal power consumption: I'm interested!
Add-ons for DIY during surface intervals:
If you want to know if the sensor is warm enough, put a DS18B20 sensor against the MD62. Connect to vcc and gnd pin to the 3.3V circuit, connect the data pin of the sensor to ESP32 pin 14. And add a 10k resistor between pin14 and 3.3V.
If you want a battery icon in the display, add an INA219 to the I2C bus, connect a new wire from the + of the battery to Vin+ and connect the old wire to Vin- of the INA219.
More battery saving options: de-solder all the tiny LEDs from all the components. You don't see them anyway when everything is in a nice housing and they're just draining battery life.