We're no longer updating This wiki!!

Introduction

The ODROID-UPS2 (Uninterrupted Power Supply) device is designed specifically for the ODROID-U3 and ODROID-C1.
It is equipped with a rechargeable Lithium-Polymer Battery, Charger IC and 5Volt Boost DCDC.

When the AC power source is removed, the UPS2 keeps supplying the power to the ODROID boards with the battery.
There is a digital output pin to send the battery low-level warning to the ODROID to trigger the shutdown process.
It will significantly reduce the risk of data loss by sudden power loss.
When the AC power source becomes available again, the UPS2 will supply power to the ODROID again automatically.

Note that there are two different models of UPS2. One for ODROID-U3 and the other for ODROID-C1.
Do not swap the boards or your ODROID may be damaged.

Specification

Power Input
Dc Input Voltage DC 4.8~ 5.4V
DC Input Current 2A Min.
Charger
Charging Time 1hour 30min ~ 2 hours
Battery Charging Current 2A Max.
Power Ouput
DC Output Current 2A Max.
DC Output Voltage 5 V
Battery Pack
Type Lithium-Polymer
Capacity 3000 mAh typical
Nominal Voltage 3.7 V
Battery Life 400 charge/discharge cycles @ 20℃±5℃
Integrated Protection PCBOvercharge/discharge Protection
ODROID-U3 Estimated Running Time with typical load of 300mA @ 5V about 4 hours when fully charged

Schematic for U3: odroid-u3_ups2_rev0.2.pdf

Schematic for C1: odroid-c1_ups2_rev0.2.pdf

PCB Layout(DWG):ups2_board_mech_rev0.2.zip

LED Indicators

BLUE LED(D1)

  • Illuminated when power is connected and battery is charged
  • OFF when charger is idle:
    1. Battery is fully charged
    2. Power is not connected or shutdown
  • Rapidly blinking when power is connected but battery is not connected

Power Status Indicator & Control Pins

  • AC_OK output pin (pin#1 of JP1) is high when the AC source is available.
  • BAT_OK output pin (pin#3 of JP1) is high when the battery voltage is higher than 3.7V.
  • POWER_LATCH input pin (pin#5 of JP1) must be high to supply 5V to the load.
  • Pin#7 of JP1 is ground.
  • Pin#8 of JP1 is 5V power output.

Switch

Slide switch to control the 5V supply to the ODROID.
Slide the switch to the left (in the direction of the battery connector) to enable the 5V output.
Slide the switch to the right to disable the 5V output.

Ensure that slide switch SW1 is to the left to enable power output.
Even when SW1 is off, the charging function keeps working.

How to assemble

ODROID-U3

  1. Assemble the PCB spacers. The metal spacers must be placed between the ODROID-U3 and UPS2 PCB for proper grounding.
  2. Align the 8 pin header and plug it into the 8 pin socket of ODROID-U3.
  3. Connect DC-Plug of power supply into the DC-Jack on the ODROID-UPS2 board.
1.
2.
3.
4.
5.
6.
7.

ODROID-C1

  1. Assemble in the order shown below.
  2. It is recommended to keep the horizontal 3 x 10mm PCB spacers in order to mount battery as shown in Figure 5-A,B.
OrderA typeOrderB type
1_AB2_AB
3_A3_B
4_A4_B
5_A5_B
6_A6_B
7_A7_B
8_A8_B
9_A9_B
10_A10_B
11_A11_B

- Detailed connection picture between JP1 of UPS2 and the 40pin header(J2) of ODROID-C1.

 C1UPS2

Due to hardware limitations, in order to use the UPS2 on ODROID-C2

  1. Extract the blue cable of the 3-pin socket,
  2. Connect the 3-pin socket as shown in the figure above the 40 pin Header.

The extracted lines connect the pin #26 of the 40 pin header as shown below.

ODROID safe shutdown in the event of a power outage

Linux

ODROID-U3

The AC_OK signal is connected to GPIO #200 in the 8pin header socket of ODROID-U3.
The BAT_OK signal is connected to GPIO #199.

ODROID-C1/C2

The AC_OK signal is connected to PIN#11(GPIO #88) in the 40pin header(J2) of ODROID-C1/C2.
The BAT_OK signal is connected to PIN#13(GPIO #116).
The POWER_LATCH signal is connected to PIN#15(GPIO #115) of ODROID-C1.
The POWER_LATCH signal is connected to PIN#26(GPIO #225) of ODROID-C2.

The BAT_OK pin is high when the battery voltage is higher than 3.7V.
The AC_OK pin is high when the AC source is available.

The BAT_OK and AC_OK signals are used in the below simple shell script which runs in the background via crontab.

Before using UPS2 on ODROID-C2, please check u-boot version.
If the version of yours is the one before Mar 18 2016, update boot loader.
You can find the guide how to check and update U-Boot in the end part of this wiki page.
[ How to check and update U-Boot on ODROID-C2 ]

Auto shutdown Script

This script checks the status of power and battery.
Save the following code as ups2.sh in home directory.
Note that this script can be used with U3 as well as C1/C2 without modification.

#!/bin/sh
MODEL=$(cat /proc/cpuinfo | grep ^Hardware | awk -F " " '{print $3}')
SYSFS_GPIO_DIR="/sys/class/gpio"

retval=""

gpio_export()
{
        [ -e "$SYSFS_GPIO_DIR/gpio$1" ] && return 0
        echo $1 > "$SYSFS_GPIO_DIR/export"
}

gpio_getvalue()
{
	echo in > "$SYSFS_GPIO_DIR/gpio$1/direction"
        val=`cat "$SYSFS_GPIO_DIR/gpio$1/value"`
        retval=$val
}

gpio_setvalue()
{
	echo out > "$SYSFS_GPIO_DIR/gpio$1/direction"
        echo $2 > "$SYSFS_GPIO_DIR/gpio$1/value"
}

if test $MODEL = "ODROIDC"
then
        AC_OK_GPIO=88
        BAT_OK_GPIO=116
	LATCH_GPIO=115
	gpio_export $LATCH_GPIO 
	gpio_setvalue $LATCH_GPIO 1
elif test $MODEL = "ODROID-C2"
then
        AC_OK_GPIO=247
        BAT_OK_GPIO=239
	LATCH_GPIO=225
	gpio_export $LATCH_GPIO 
	gpio_setvalue $LATCH_GPIO 1
else 
        AC_OK_GPIO=199
        BAT_OK_GPIO=200
fi

gpio_export $AC_OK_GPIO
gpio_export $BAT_OK_GPIO
gpio_getvalue $AC_OK_GPIO
if [ $retval -eq  1 ]
then
        echo "DC Input Okay"
else
        echo "Power is shutdown or AC Adaptor is disconnected"
        gpio_getvalue $BAT_OK_GPIO
        echo $retval
        if [ $retval -eq 0 ]
        then
                echo "battery is lower than 3.7V"
                /sbin/shutdown -P 1
        else
                echo "battery is good"
        fi
fi

Give execute permission to everybody with following command.

sudo chmod a+x ups2.sh

Cron setup

This can be set up by running: $ sudo crontab -e

# m h  dom mon dow   command
*/2 * * * * /home/odroid/ups2.sh

The script will run every 2 minutes.

To test the hardware/software setup, unplug the power source from the UPS2. After 2 minutes and 1 second, the ODROID will start the shutdown process automatically.

Depending on the particular Battery State of Charge (SOC), this script can issue a reboot a few times based on the specific load.
This means that the battery voltage can go over the threshhold level very quickly when the load is off.
However, it will turn off the board after cycling the power a few times.

Android

ODROID-U3

Check to existence of /dev/class/gpio/ directory.

If you can not find node, Upgrade the OS 4412_v4.9 version or higher.

/system/bin/ups2.sh


#!/bin/sh
SYSFS_GPIO_DIR="/sys/class/gpio"

retval=""

gpio_export()
{
       [ -e "$SYSFS_GPIO_DIR/gpio$1" ] && return 0
       echo $1 > "$SYSFS_GPIO_DIR/export"
       echo $1
}

gpio_getvalue()
{
       echo in > "$SYSFS_GPIO_DIR/gpio$1/direction"
       val=`cat "$SYSFS_GPIO_DIR/gpio$1/value"`
       retval=$val
}

gpio_setvalue()
{
       echo out > "$SYSFS_GPIO_DIR/gpio$1/direction"
       echo $2 > "$SYSFS_GPIO_DIR/gpio$1/value"
}

AC_OK_GPIO=199
BAT_OK_GPIO=200
LATCH_GPIO=204
gpio_export $LATCH_GPIO 
gpio_setvalue $LATCH_GPIO 1

check()
{
        gpio_export $AC_OK_GPIO
        gpio_export $BAT_OK_GPIO
        gpio_getvalue $AC_OK_GPIO

        if [ $retval -eq  1 ]
        then
               echo "DC Input Okay"
        else
               echo "Power is shutdown or AC Adaptor is disconnected"
               gpio_getvalue $BAT_OK_GPIO
               echo $retval
               if [ $retval -eq 0 ]
               then
                      echo "battery is low than 3.7V"
                      poweroff -d 5
               else
                      echo "battery is good"
               fi
        fi
}

while true
do check
sleep 2
done

Enable UPS service in /init.odroidu[x2].rc

shell@odroidu:/ $ su                                                           
1|root@odroidu:/ # mount -o rw,remount /                                       
[  298.823337] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
root@odroidu:/ # vi /init.odroidu.rc
service ups /system/bin/ups2.sh                       
    class core                           
    user root                                                                
    group root                                                      
#    disabled                                                                
    oneshot 
                                                           
Power is shutdown or AC Adaptor is disconnected                              
1                                                                            
battery is good                                                              
Power is shutdown or AC Adaptor is disconnected                              
1                                                                            
battery is good                                                              
Power is shutdown or AC Adaptor is disconnected                              
1                                                                            
battery is good                                                              
Power is shutdown or AC Adaptor is disconnected                              
0                                                                            
battery is low than 3.7V                                                      
[   88.089377] SysRq : Emergency Remount R/O                                  
[   88.093736] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)                  
[   88.099412] EXT4-fs (mmcblk0p3): re-mounted. Opts: (null)                  
[   88.105858] EXT4-fs (mmcblk0p4): re-mounted. Opts: (null)                  
[   88.112916] Emergency Remount complete                                    
[   88.191188] exynos4_notifier_call : System Rrestart notifier call!        
[   88.191714] exynos4_notifier_call : Done!                                  
[   88.195726] REBOOT Notifier for CPUFREQ                                    
[   88.200303] Disabling non-boot CPUs ...                                    
[   88.204077] CPU1: shutdown                                                
[   88.206946] CPU2: shutdown                                                
[   88.209279] CPU3: shutdown                                                
[   88.211703] Restarting system.

How to check and update U-Boot on ODROID-C2

Linux

Check U-Boot Version

If you have a USB-UART console, you can easily check the u-boot version using 'version' on u-boot stage.

Hit [Enter] key twice quickly during u-boot loading and enter 'ver' or 'version'.

odroidc2# version
U-Boot 2015.01-00089-gdfb8216 (Apr 09 2016 - 06:20:43)

Or you can check it after kernel booting on userspace using a simple shell script.

getUbootVer.sh
#!/bin/sh
# Sample shell script to check U-Boot version on Linux
dd if=/dev/mmcblk0 of=/tmp/temp.bin bs=512 skip=97 count=1334 status=none
grep -a -r -E -o ".{0,0}U-Boot 2015.01.{0,50}" /tmp/temp.bin | grep -a "("
rm /tmp/temp.bin
root@odroid64:~# vi getUbootVer.sh
root@odroid64:~# sudo chmod a+x getUbootVer.sh
root@odroid64:/home/odroid# ./getUbootVer.sh
         U-Boot 2015.01-00089-gdfb8216 (Apr 09 2016 - 06:20:43)
Update U-Boot

If your U-Boot version is not the latest one, you can update it using apt-get command.

sudo apt-get install u-boot

Android

Check U-Boot Version

If you have a USB-UART console, you can easily check the u-boot version using 'ver' on u-boot stage as described in the aforementioned Linux case.
Or you can check it after kernel booting on userspace using the following simple shell script.

getUbootVer.sh
#!/bin/sh
# Sample shell script to check U-Boot version on Android
/bin/dd if=/dev/block/mmcblk0 of=/data/temp.bin bs=512 skip=97 count=1334
grep -a -r -E -o ".{0,0}U-Boot 2015.01.{0,50}" /data/temp.bin | grep -a "("
rm /data/temp.bin
(run Terminal Emulator)
u0_a48@odroidc2:/ $ su
root@odroidc2:/ # cd /data/                                                    
root@odroidc2:/data # vi getUbootVer.sh
root@odroidc2:/data # chmod 755 getUbootVer.sh
root@odroidc2:/data # ./getUbootVer.sh                          
1334+0 records in
1334+0 records out
683008 bytes transferred in 0.014 secs (48786285 bytes/sec)
/data/temp.bin:U-Boot 2015.01-00089-gdfb8216 (Apr 09 2016 - 06:20:43)
root@odroidc2:/data # 
Update U-Boot

If your U-Boot version is not the latest one, you can update it using Android update package.
http://odroid.com/dokuwiki/doku.php?id=en:c2_release_android

Tip for servo or motor driving application

Reported by Ameridroid

While developing a walking robot that uses the UPS2-C1, we found the UPS2 would shut off while moving servos after only a few minutes. We were led to this modification that WILL void your UPS2 warranty, but will likely solve your issues.

Without this modification, we would get less than a few minutes of runtime out of our walking robot. After the modification, we could get over an hour.

ODROID FORUM

You can find a nice video in the above link that explains how to mod the UPS2 board.

en/odroid-ups2.txt · Last modified: 2016/04/21 13:20 by joy.cho
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0