I'm going to use my Rasp as a GPS tracking and it should be running even if the car is off; however, I don't want run out the car battery.
To make it happens I added a battery controller (https://www.adafruit.com/products/1944) that receives power from the car DC "car battery" (only when the car is on) to charge the rasp battery and keep it running; nonetheless, when the vehicle is off the rasp uses the backup battery.
To avoid unexpected shut down when the battery is low I'm using a GPIO pin and the output pin "Low battery" of the battery controller to halt the device; however, even if the device is off and the battery is low, the device will still receive sort of voltage (~4v) from the battery.
The issue is, when the car switches on, the raspberry doesn't turn on as the battery keeps supplying voltage to the raspberry, so I need a circuit that detects when the raspberry is off and the car is on to reset the device or at least disconnect and connect the power supply of the rasp and makes it turn on.
I'm not good at electronics, but I'm trying to develop the circuit below, please could someone help me to see if I'm going to the right direction?
I've built a circuit below that disconnect and connect the rasp power supply when the "GPIO 18" is 0 (it will be 1 when the raspberry is running) and the car is supplying voltage (consider the car voltage as 5v regulated for a while).
What I'm planning to do are:
The gate "AND" will charge the capacitors C1 and C2 when the raspberry is off (GPIO 18 = 0) and the capacitor C1 is empty. Once the capacitors are charged, the gate "AND" will be 0 as the C1 will make the NOR output 0 and consequently make the "AND" as 0. The C2 will momently open the relay and reset the rasp.
Capacitors: A) C1 should discharge in ~2 mins, so it is going to allow the raspberry turn on and change the GPIO 18 to 1 B) C2 should discharge in 3 secs and let the relay open and close the circuit (reset the raspberry) .
Sorry but it is hard to explain and I'm not good at circuits.