Skip to main content Link Menu Expand (external link) Document Search Copy Copied

NEVER connect an ignition feed directly to a Raspberry Pi GPIO Pin. You will destroy the Pi.

Shutting down an application while it is writing to disk can corrupt the files on the disk. Although I often shut down SDC by simply removing the power on my test bench without suffering any corruption, in this scenario I can easily re-format the sdcard if it becomes corrupted. With the device installed behind your dashboard this is more of an operation so you should ideally implement this proper shutdown process for best reliability and functionality. An alternative is to turn off Data Logging and accept that no settings will be saved when you turn off the power. In the as-downloaded configuration, datalogging is off by default.

Controlled Shutdown

SDC accesses the SD card while running, primarily for datalogging. It writes a row to the datalog every time the selected datasource indicates it should do so. For canbus data sources that is about 25 times per second. For other sources (speeduino Serial for example) it is dependent upon other settings such as the maximum datalogging throttle rate, and the limit imposed by the speeduino firmware.

There are also certain settings from the SDC.ini file that may be updated while the application is running (such as the last displayed page). These are held in memory and are written to disk when the application shuts down. Obviously if you simply cut the power, these settings won’t be saved.

Controlled shutdown requires the use of an SDC I/O hat or other similar implementation.

Proper Application Termination

In order to get a proper clean shutdown with everything updated properly and all log files properly closed it is necessary to implement a delayed shutdown process, which removes the power from the device only after the software has performed appropriate shutdown operations. In order to achieve this you must power your devices through a secondary controlled shutdown board which holds the power on for a short period until shutdown is completed. I have mine configured for about 2 seconds.

I have small stock of delayed shutdown boards on my store from time to time; you can find them here:

https://www.v8creations.com/sdc/23-sdc-controlled-shutdown-power-module.html

The shutdown board you use may require either a ground trigger or a +12v trigger. The board above works with a +12v trigger, and this means you can connect the ignition feed directly to it to control it. This is simpler than a ground trigger as you will also need that same 12v trigger to direct into the I/O hat to control the shutdown.

As you can see, they don’t cost very much and are a worthwhile addition in my opinion. This relay board has some quiescent current draw but it is very very small.

To use this board, see the section on Delayed Shutdown Wiring in the products section. There are also some configuration changes to enable described there.

How it Works

When you turn on the ignition, the relay board will be immediately triggered to turn on its relay as it is constantly powered. This connects the power supply to the Pi causing it to boot. The delay relay will stay on until the key is turned off, at which point the relay board will hold the power on until the timeout you set expires.

In parallel, turning off the ignition key also removes the 12v supply from the “IGN” input on the SDC I/O hat. The hat only holds the pin high when you supply 12v to IGN, so when the power is removed the SDC Hat’s opto isolator disconnects the 3.3v from pin 13. This activates the internal pulldown, putting the pin in a low state and activating the shutdown action that is defined above.

When SDC shuts down it displays its boot screen. 2 seconds or so later (whatever your delay board time is set to) power will go off.

I power all of my devices through a single relay board, including the screens, as this gives a nice looking key-off process where the dials disappear and the manufacturers logo appears on screen for 2 seconds and then the screens go blank.

Controlled Shutdown of Canbus Devices

If you are using a canbus with your installation, then you will likely have more than one device that needs to be safely shut down before the power is removed (for example one cluster screen and one auxiliary control screen). When you implement the shutdown procedure above using a SHUTDOWN touch action, if the device receiving the instruction is configured with a datamode that includes support for sending canbus messages then it will automatically broadcast the shutdown command to all other devices on the bus, using the Canbus Controller Id. The other SDC devices will react by performing the same safe shutdown process.

For further details on canbus support, see the Canbus Section