We're no longer updating This wiki!!

Introduction

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

When the AC power source is removed, the UPS3 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 UPS3 will supply power to the ODROID again automatically.

www.hardkernel.com_main_files_prdt_2016_201604_201604191444388644.jpg

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-C2 Estimated Running Time with typical load of 500mA @ 5V about 3 hours when fully charged

Schematic: ODROID-UPS3 for C series

PCB Layout(DWG):ups3_board_rev0.1_mech.zip

PCB Pattern(PNG):ups3.zip

When the battery was fully charged(VBAT=4.2V), we performed the load test with UPS3.

Time to power-off at the Load

Current Time to power-off No Load Output voltage Output voltage at the Load VBAT
2A 25sec 4.97V 4.65V 4.14 V
1.8A 140s 4.69V 4.12 V
1.6A 450s 4.71 4.05V
1.4A 810s 4.73V 3.98V
1.2A 1470s 4.81V 3.95V

If your C2 takes 800mA and USB devices take 850mA, the UPS3 can supply the power to your system around 3~4 minutes at least.
It seems to be fine to shutdown the system safely.

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#11 of J2) is high when the AC source is available.
  • BAT_OK output pin (pin#13 of J2) is high when the battery voltage is higher than 3.7V.
  • POWER_LATCH input pin (pin#15,26 of J1) must be high to supply 5V to the load.

Switch

Slide switch SW1 to control the 5V supply to the ODROID.
Slide the switch SW1 to the right to enable the 5V output.
Slide the switch SW1 to the left to disable the 5V output.

Slide the switch SW2 to the up for C1.
Slide the switch SW2 to the down for C2.

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-C1/C1+/C2

  1. Assemble as the UPS3 as shown in Figure

www.hardkernel.com_main_files_prdt_2016_201604_201604191155298511.jpg

ODROID safe shutdown in the event of a power outage

Linux

ODROID-C1/C1+/C2

The AC_OK signal is connected to PIN#11(GPIO #88) in the 40pin header(J2) of ODROID-C1/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 UPS3 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 ups3.sh in home directory.
Note that this script can be used with U3 as well as C1/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 ups3.sh

Cron setup

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

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

The script will run every 2 minutes.

To test the hardware/software setup, unplug the power source from the UPS3. 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-C1,C1+,C2

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

If you can not find node, Upgrade the OS ODROID-C1/C1+/C0_v2.6 and ODROID-C2 v1.4 version or higher.

/system/bin/ups3.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"
}

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
}

MODEL=`getprop ro.product.board`
echo $MODEL

if [ `echo $MODEL | grep -c "odroidc2"` -gt 0 ]
then
	AC_OK_GPIO=247
	BAT_OK_GPIO=239
	LATCH_GPIO=225
	gpio_export $LATCH_GPIO
	gpio_setvalue $LATCH_GPIO 1
elif [ `echo $MODEL | grep -c "odroidc"` -gt 0 ]
then
	AC_OK_GPIO=88
	BAT_OK_GPIO=116
	LATCH_GPIO=115
	gpio_export $LATCH_GPIO
	gpio_setvalue $LATCH_GPIO 1
else
	AC_OK_GPIO=199
	BAT_OK_GPIO=200
	LATCH_GPIO=204
	gpio_export $LATCH_GPIO
	gpio_setvalue $LATCH_GPIO 1
fi

while true
do 
	check
	sleep 2
done

Enable UPS service in /init.odroidc[odroidc2].board.rc

shell@odroidu:/ $ su                                                           
1|root@odroidu:/ # mount -o rw,remount /                                       
[  298.823337] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
root@odroidu:/ # vi /init.odroidc[odroidc2].board.rc
service ups /system/bin/ups3.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
Remove the voltage detector IC (Reference number is U3 on the UPS2 & UPS3 board schematics)

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-ups3.txt · Last modified: 2016/05/13 12:50 by odroid
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0