I made a circuit to use with my ESP32 to test 18650 battery capacity.
During tests I didn't notice that when I do dacWrite(dacpin, 0);
the output on DAC pin becomes 0.1 V instead of zero
Those tiny voltages are a problem, because the LM358 op-amp is connected to the DAC pin in unity gain configuration which instead of shutting down keeps draining battery by 0.1 V which at 2.8 V (cutoff voltage) is 0.1A (or 100 mA).
Things I tried:
- Connecting a 1 kΩ resistor from the DAC pin to ground, doesn't work
- Disabling DAC by
dac_output_disable(DAC_CHANNEL_1);
; the output goes to 0 but things get complicated, the op-amp starts outputting randomly turning on the MOSFET.
Other than this problem, it works great paired with an ESP32 touch pin to start/reset, and has very good accuracy.
What can I do to make the DAC output zero?
I thought of connecting an NPN transistor from the LM358 output to ground that will be turned on/off by microcontroller but my previous failed attempts at designing circuits and my love for my ESP32 don't allow me to do this experiment.
If someone needs to view the code or build this project: Code