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.

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.

The delayed shutdown module can be found on my store here

The SDC delayed shutdown module works with a +12v trigger. Therefore you connect the ignition feed directly to it. The module then provides an ignition pass-through for the I/O Hat. For full instructions on how to connect the module and configure SDC to use it, see this page.

How it Works

When you turn on the ignition, the module 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 module will keep its relay on until the key is turned off, at which point the relay board will hold the power on until the timeout expires.

In parallel, turning off the ignition key also removes the 12v supply from the “IGN” input on the SDC I/O hat due to the passthrough connection. When the power is removed from IGN this activates the shutdown action in SDC.

When SDC shuts down it displays its boot screen. 5 seconds or so later the delayed shutdown module will remove power via the relay, and the Pi will be turned off. The timeout in the module is set to ensure there is plenty of time for SDC to shut down before power is removed.

I power all of my devices through a single shutdown module, 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.

What this means is that in a CANBus based implementation with multiple SDC instances devices (or other devices that can receive CANBus and react to the shutdown message), you only need one Controlled Shutdown Module.

For further details on canbus support, see the Canbus Section.