OVERVIEW | SOFTWARE | COMPONENTS | FAQ | BLOGS | Shopping Cart |
Blog Post |
2017-01-27 Power Manager Like most computers, the Raspberry Pi doesn't like to be shut down by having it's power cut off. If you cut the power to a Raspberry Pi you risk corrupting your operating system or other files. So, Graceful Shutdowns Are A Must! In the early C4 Corvette, when the ignition is switched OFF, all the systems in the car are shut down. This is going to cause problems for the Raspberry Pi. So a "Power Manager" of some sort is needed to insure that the Raspberry Pi is shut down in an orderly way to avoid file corruption. The Power Manager has access to the cars switched and unswitched power sources. By monitoring the switched power source, the Power Manager can continue to power the Raspberry Pi after the ignition has been switched OFF. The Power Manager and the Raspberry Pi communicate back and forth via two GPIO lines. One is the "shutdown request" line and the other is the "shutdown complete" line.
The rules that govern the Power Manager are as follows:
Power Manager Wiring Diagram: A note about the Power Manager hardware: The Power Manager is built around an Arduino compatible Adafruit Trinket microcontroller running the Comvette Power Manager Sketch. The Trinket is a 3.3 volt device. All signals going in or out of the Trinket's GPIO pins have to be 3.3 volts. But an automobile is a 12 volt system. This voltage mismatch has to be addressed in order for the Trinket to monitor the state of the ignition switch. So how do we let the Trinket know when the ignition switch is in the "Run" or "Accessory" position if we can't connect a 12 volt signal to the Trinket without destroying it? The Trinket can be powered by any voltage between 4 and 16 volts. It has an on-board regulator that will reduce the voltage down to a safe 3.3 volts. That's fantastic because we can power the Trinket directly from the car's 12 volt system. But that doesn't address the mismatch between the car's voltage and the Trinket's need for all GPIO signals be 3.3 volts. Some mechanism is needed to lower the car's 12 volts down to a Trinket compatible 3.3 volt level. I've seen several different approaches used to achieve this using voltage regulators, zener diodes etc. I chose to take a simpler approach. The Power Manager employs a small 12 volt relay that is activated whenever the ignition switch is in the "Run" or "Accessory" postion. The relay when activated, takes 3.3 volts from the Trinket's own voltage regulator and connects it to one of the Trinket's GPIO pins. The Trinket is safely isolated from the 12 volt signal but sees 3.3 volts appear on it's GPIO pin whenever there is 12 volts applied to the relay. The switch marked "Manual Power Control" performs the same function as the the relay. It takes 3.3 volts from the Trinket's own voltage regulator and connects it to one of the Trinket's GPIO pins. The purpose of this switch is to allow you to power-up the Comvette infotainment system without requiring the key to be in the ignition switch. This is handy if you're at a car show or cruise-in and you want to leave your car unattended with the Comvette infotainment system running but don't want to leave your key in the ignition. Get the Comvette Power Manager Sketch |