Uninterruptible power supply for the Raspberry Pi
A Nice Add-On Package
In addition to the core UPS functionality, the UPiS board provides the Raspberry Pi with several other useful capabilities. One of these is the mechanical on/off switch (Figure 1). Usually, users must bravely pull out the cable to power down the Raspberry Pi or implement one of the sets of handicraft instructions [10]. The UPS board presented here makes this superfluous.
Another interesting feature is the battery-powered real-time clock. A bit of preparatory work is required to make it function, though. The clock is accessed via the I2C bus of the Raspberry Pi, which by default is inactive. Theoretically, two jumpers should be attached to the UPiS, but they are usually already in their proper position.
Listing 3 shows the necessary steps that need to be executed via software. First, the kernel drivers for the real-time clock and the data bus need to be loaded and then logically connected. This step allows you to control the clock via the command-line program hwclock
. You should first initialize the clock with the current time.
Listing 3
Activating the Real-Time Clock
01 $ modprobe i2c-bcm2708 02 $ modprobe rtc-ds1307 03 $ ls /sys/class/i2c-adapter/i2c-1 04 1-003b 1-004c 1-004d delete_device device name new_device power subsystem uevent 05 $ echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 06 $ hwclock -r 07 Sun 26 Oct 2014 20:31:20 UTC
More details can be found in the manual [4]. The various Raspberry Pi versions have different ways of numbering the I2C buses. The commands in Listing 3 work for Model B. To arrive at a configuration that works properly after a system reboot, you need to automate the loading of the kernel modules and the initialization of the real-time clock. When using Raspbian, the appropriate files are /etc/modules
, /etc/modprobe.d/raspi-blacklist.conf
, and /etc/rc.local
.
The real-time clock can be used to start and stop the Raspberry Pi automatically. To enable this, the UPS board stores the two values START
and STOP
. The first value defines the number of minutes the ARM computer will run before UPiS shuts it down via a predefined routine. The number stored in STOP
determines how many minutes the UPS waits to boot up the Raspberry Pi again.
Summary
UPiS has considerable potential and does not need to hide behind the more established products by APC or Eaton. For example, the board also features a temperature sensor and an LED interface that I have not addressed here. The forum [11] furnishes a small C program that provides deep insights into the actual state of the entire UPiS board. Admittedly, the $52 (£35/EUR49) price for the basic version is higher than that of the Raspberry Pi nano-computer itself, but, in exchange, you will gain considerable functionality in addition to the uninterruptible power supply.
Infos
- GPIO: http://www.raspberrypi.org/documentation/usage/gpio/
- Proper housing: http://www.modmypi.com/raspberry-pi/cases/upis/upis-and-raspberry-pi-case
- UPiS Advanced: http://www.modmypi.com/raspberry-pi/breakout-boards/pi-modules/upis-advanced-uninterruptible-power-intelligent-supply
- UPiS manual: http://www.pimodules.com/_pdf/Upis_Manual_V1.10.pdf
- UPiS module: http://pimodules.com/_pdf/Upis%20Module%20FAQ%201.5.pdf
- NXP: http://www.nxp.com/documents/user_manual/UM10204.pdf
- I2C bus: http://en.wikipedia.org/wiki/I%C2%B2C
- Forum: http://www.forum.pimodules.com/viewtopic.php?f=10&t=67#p330
- YouTube video: http://www.youtube.com/watch?v=CgyTqgtN7Mg
- Handicraft instructions: http://events.linuxfoundation.org/sites/events/files/slides/RasPiHacks.pdf
- Sample script: http://www.forum.pimodules.com/viewtopic.php?f=7&t=47
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 6
(incl. VAT)