Auto turn off relay circuit
POWER (red wire) - connected to an always live +12V (ensure that this feed isn't cut when the engine is cranked) Pin 87A on a SPDT relay or (pin 87 on a SPST relay) to the monitored GPIO pin (e.g. Pin 86 of the relay is connected to the ignition and pin 85 to ground. I highly recommend purchasing (or making your own) timer configuration button board to save frustration when programming.
#AUTO TURN OFF RELAY CIRCUIT HOW TO#
Refer to example 11 in the timer cook book / programming guide - for more detail on how to program the timer (or to the Automate Everything video - )
setting the required shutdown delay (e.g. The script and service definition file along with installation instructions are below.īefore use the timer must be programmed so that it powers off it's load x (e.g. 14 mins). If the ignition is turned back on the script detects this and no shutdown occurs. To ensure that the RPi shuts down prior to the timer the configurable shutdown delay is less than the shutdown delay configured for the timer (e.g.
The scripts detects this and after a configurable delay initiates a graceful shutdown. When the ignition is switched off the GPIO pin is set low by the relay which connects / shorts GND to GPIO 17. A standard 12V relay connected to the ignition controls the state of the monitored GPIO pin. for the RPi to shutdown before the timer) I use a python script (running as a service on the RPi) which monitors the state of a nominated GPIO pin (e.g. To enable a graceful shutdown of the RPi (i.e. The timer requires programming before use - see below and / or refer to (Automate Everything) When the timer is off it draws a very small current (0.3 ma in low power mode when idle). If the IGN is switched back on before the countdown finishes then the timer resets / cancels the countdown timer. 15 mins), when countdown is complete the timer switches off the output which powers off the 12V - 5V converter which in turn powers off the RPi, screen, USB hub and peripherals. When IGN is switched off the timer starts it's countdown timer (timer is configurable - e.g. When IGN is switched on the timer switches on it's out put which powers the 12V - 5V converter (which in turn powers the RPi, screen, and in my case an external USB hub - used for BT, sound card, reverse cam and charging phone etc.). This makes troubleshooting (IMO) a lot easier. I would recommend configuring and testing on the bench before installing in the car. Also there is a very small chance that the script fails to shut down the RPi before the timer switches off. While idle (IGN off) the timer does consume 0.3 ma.ġ2v automotive relay - either a SPST-NC (Single-Pole Single-Throw, Normally-Closed) or a SPDT (Single-Pole Double-Throw)
#AUTO TURN OFF RELAY CIRCUIT PLUS#
The disadvantage is that the timer is relatively expensive at €16 plus shipping (other suitable, less expensive timers may be out there - I didn't search). The advantages of this solution is that it is relatively simple, is straightforward to wire / connect and doesn't take up too much space. A script on the RPi monitors the status of the GPIO pin and ensures that the RPi shuts down before the timer cuts power to the RPi, screen and peripherals (e.g. In tandem with this the relay closes when the IGN is switched off and sets a monitored GPIO pin low. When the IGN is switched off the timer continues to provide power to the RPi for a configurable amount of time before switching off (e.g. powered USB hub, external BT dongle, external sound card, reverse CAM etc.) when the IGN is on. In short the timer provides power to the RPi, screen and in my case peripherals (e.g. My solution is based on this video - the Automate Everything channel and utilises a single standard automotive 12V relay and a programmable 12V timer. Graceful delayed shutdown with timer and 1 relay