We're using an INA219 and an ESP32 to measure the relation between the battery's voltage to its state of charge. The circuit must be closed ony when the ESP32 is turned on, so that it is measuring current, voltage and time correctly, therefore we've designed it with 2 relay modules as shown in the image. Is there any way to make this simpler or more efficient?
Because we’re using the ESP to process the information from the INA (they’re connected via SCL and SDA). If the battery starts draining before the the ESP is turned on, we’ll be losing data
You can start by adding pull-up resistors to the SCL (Serial Clock Line) and SDA (Serial Data Line) for better I2C communication.
Using a MOSFET is much simpler than a level converter when driving two relays in series. You can use a P-Channel MOSFET in the battery line, which can eliminate the need for the relays altogether. The function of the two relays can often be consolidated into one, streamlining your design.
Important Note: A level converter is not a relay driver and can fail when used incorrectly. The relay is an inductive device that produces a kickback voltage higher than what the level shifter can tolerate, potentially damaging the level converter.
It's also a safety measure, if for any reason the ESP32 stops recording data (or if I want it to, e.g. it gets too hot) , we want the battery to stop as soon as possible. Since I'm doing this for more than just one battery, I'd like for the circuit to have less human interference as possible
Sorry for the misunderstanding, we are using 5v dual channel relay module that is linked after the image, the relay in the schematic don’t represent what’s really happening. We’ll change for better clarification.