Raspberry PI - power for graceful shutdown - my BMW example

I’ve been finishing up my dash install in my LS Swapped BMW 2012 128i. I’m using a Raspberry PI 5 with 16gb RAM (8GB is probably fine I just had it) and an NVMe SSD. I know one of the struggles with the PI installs is graceful startup/shutdown. The BMW, and many modern cars, have multiple B+ circuits that change from awake to sleep/sleep to awake on programmed timings. For the BMW, there are at least three (technically there are 4 or more but 3 useful):

Terminal 30 - always hot with 12v
Terminal 30g - hot when the CAS (one of the computers) wakes up, triggered by several possible events depending on model and options
Terminal 30 switched - hot on initiation start/run on the key (or button)

Other cars likely have something similar so you’ll need to investigate.

Knowing the above we have some choices that allow the PI to be powered/shutdown in several scenarios, including doing it gracefully. My version is below. I’m using a Waveshare 8inch LCD and powering it separately from the PI so I can control it with different timings.

Hopefully this will help or at least get you to thinking.

2 Likes

And before anyone asks, here are the specific devices I’m using with success:

CAN adapter (changed to candlelight firmware): Amazon.com: DSD TECH SH-C30G Isolated USB to CAN Adapter Based on Canable 1.0 Pro : Electronics

Timed relays: Amazon.com: [2 Pack] DC 6-30V Timer Relay Programmable Delay Relay Module Cycle Timer with LED Display / 5V Micro USB, Smart Home Controller : Tools & Home Improvement

12V step down buck convertors: Amazon.com: Klnuoxj DC 12V/24V to 5V USB C Step Down Converter Type-C Interface 5A 25W Waterproof Buck Module Power Adapter Compatible with Raspberry Pi 4, Cell Phones 2-Pack : Electronics

Waveshare 8" LCD display: Amazon.com: waveshare 8inch Capacitive Touch Display Compatible with Raspberry Pi 5/4B/3B+/3A+ and CM3/3+/4 1280×800 Resolution IPS DSI Interface : Electronics

1 Like

Thank you for sharing this info!

I will note that the relay to the GPIO connected shutdown relay should be hooked like a pushbutton switch. Opto isolated from the car. I didn’t give much info above on it above so thought I’d add that bit of info. Google how to do a push button switch on GPIO pins and mimic that with the relay (i.e. with a resister like this: Using a push button with Raspberry Pi GPIO | Raspberry Pi HQ)

I am using this one: AEDIKO 4pcs DC 12V Relay Module 1 Channel Relay Board with Optocoupler Isolation Support High or Low Level: Amazon.com: Industrial & Scientific

I’ll update the schematic when I get a chance. Don’t want anyone to fry their PI if not done correctly.

3 Likes