ODroid C2 + USV: Save Android shutdown for eMMC module

If you are using the ODroid C2 with an eMMC Module (with an SDCard normally you don’t need this), then it’s not a good idea to switch the power off abrupt. Maybe this can cause in a corrupted file system on your eMMC module. It’s time for the PiUSV+ HAT that you can use with the ODroid C2 Board and Android


PiUSV+ HAT infos: http://www.reichelt.de

The PiUSV+ HAT has 3 Power Inputs:

1. Primary 1 : Micro USB +5V Port (you can use it for a Car -> 5V USB Adapter
2. Primary 2: Connection terminals for 5-25V (you can use it to connect it directly to the car battery)
3. Secondary: Connection terminals for 1s Lipo 3.7V min. 300 mA

The PiUSV+ board has 2 Modes:

1. ODroid C2 is starting … with Power On (jumper opened)
2. ODroid C2 is starting … after you’ve pressed a Button (jumper closed)

For this board I’ve written a PiUSV+ Android App. After installation a service is running in the background (Notification Icon) and is starting automatically after every boot. If you opened the “USV” App, then you can set the “Shutdown” Time after Power Off, and the “USV Power Off” delay after shutdown (the USV itself will be switched off).



I2C Commands:

// * Send USV Shutdown Time delay to the USV Device HAT
thingsLib.sendI2CRegByte(1, 0x18, 0x10, usvPowerOffDelay);

// * Read USV States from the USV Device HAT
thingsLib.sendI2CBusByte(1, 0x18, 0x00);
deviceState = odLib.receiveI2CBusByte(1, 0x18);
statePrimaryPowerSupplyActive = false;
stateSecondaryPowerSupplyActive = false;
stateLiPoBatteryLowOrNotConnected = true;
if((deviceState & 1) == 1) statePrimaryPowerSupplyActive = true;
if((deviceState & 2) == 2) stateSecondaryPowerSupplyActive = true;
if((deviceState & 4) == 4) stateLiPoBatteryLowOrNotConnected = false;