MoPower UPS Hardware Version 2

More pictures: Release Candidate board and Prototype in case

Online ordering is available HERE.
Information on original version 1 hardware is avaialble HERE.

Here is the second version of the popular MoPower UPS. We have taken the core of what made our original UPS popular and expanded it's capabilities and specifications. More then just a full featured UPS for the Raspberry Pi, the MoPower features a highly flexible design with configurable power control logic, which make it suitable for many projects. It has been used successfully in many scientific, industrial, automotive, and solar projects around the world.

Features include:

  • Up to 6 hours of backup time using common NIMH AA batteries (6 cells), greater backup time is available by using larger batteries or more cells.
  • "Wake On Event" feature allows startup or shutdown of your Pi based on any various inputs, such as input voltage levels or digital inputs. This is perfect for automotive computers and can be set to power on and off your Raspberry Pi based on engine running state with only one power input! Also useful in solar applications.
  • Built in 90% efficient 5v switch mode power supply for powering the Pi
  • Wide input voltage range, 12v to a 30v input, using common regulated or non regulated adapters
  • An automotive grade TVS (transient voltage suppressor) protects your Pi from when used in a harse automotive power environment.
  • Full two way communications between UPS and Pi, including reporting of Vin and Vbatt levels.
  • Optional INA219 current sensor wired to the 5v power for the Pi. Monitor real time voltage, current and power consumed by your Pi!
  • Four 10-bit ADC INPUTS! And numerous other input and output pins user configurable
  • Watchdog timer! Auto reboots the Pi if it crashes!
  • Onboard buttons for easy shutdown/reboot, optional top mount button available and external buttons can be added easily.
  • Onboard RTC with timer based (Wake On Timer) power on/off capability, great for remote battery powered applications to conserve power.

  • NOTICE: This product is intended for use by experienced users. Batteries are dense sources of energy and must be handled properly. Users should be familiar with proper battery handling/use, general electronics design and safety. Improper use can pose hazards.

    Table Of Contents

    Hardware Quick Start

    Please read the Warnings and Precautions section before proceeding. Attach the UPS to your Raspberry Pi, you can use the included hex spacers and hardware. Ensure that the female connector of the UPS connects to the proper pins on the Pi, the connector mates to the GPIO connector on the Pi starting from the edge of the board from pins 1-10. Make sure the bottom of the UPS board will not short to the Pi and any components. Connect a 12-30v DC power source of an appropriate power rating to the UPS. The barrel jack is a 2.1mm center pin positive connector with a typical voltage rating of 24VCD, higher voltages (up to 30) are known to work in standard conditions or can be connected to the Vin2 pads. Connect the battery to the UPS observing proper polarity. Make sure the batteries are secured to prevent a short. Your Pi will power up after a brief boot up and firmware check on the UPS.

    Back to Table of Contents

    Client Software

    Firmware and client software has been branched off of version 1 hardware and most of the FIRMWARE and CLIENT SOFTWARE documentation is applicable to version 2 hardware. Original version 1 documentation can be found here.

    Latest Client software can be downloaded HERE mopower-ups-v0.94-build-07-07-2018.tar
    The change log is available here

    Client software has been tested with Raspbian Stretch, please see INSTALL-Raspbian.txt or use
    # Client software quick start
    # You will want to update Raspbian's package list before the install by running.. 
    	$ sudo apt-get update
    # Optionally you can also update all your installed packages with the following command:
    	$ sudo apt-get dist-upgrade
    # Download and installation quick start for newer versions of Raspbian Stretch:
    # wget desired client software (make sure you are in /home/pi/ directory)
    	$ wget
    	$ tar -xf mopower-ups-v0.94-build-07-07-2018.tar
    # You will now have a mopower directory, cd to it and run the install program, reboot when asked..
    	$ cd mopower
    	$ sudo ./
    # A manual install can be done by following instructions in INSTALL-Raspbian.txt
    # This was tested on RASPBIAN STRETCH versions up to 2018-06-27, others may need 
    # modification per the requirements of your operating system.
    # CURRENT SENSOR OPTION - Run the following to install the INA219 libraries.
    	$ sudo apt-get -y install python-pip
    	$ sudo pip install pi-ina219==1.1.0
    		# NOTE the above command installs version 1.1.0 of the pi-ina219 libraries, version 1.2.0 currently has a problem with i2c bus numbers on the Pi
    		# You can check your currently installed version by running "sudo pip show pi-ina219"
    	$ sudo raspi-config
        		# under interface options enable I2C
    # This was tested on RASPBIAN STRETCH version up to 2018-06-27, others may be similar
    Older version of software can be found here

    Back to Table of Contents


    Current firmware is v0.934. Early release versions of hardware rev 2 had different firmware, an upgrade is recommended.
    Release notes for mopower-ups-hw2-firmware-v0.934-07-14-2018-001628
    Firmware download link
    Firmware update instructions
    # Download firmware
    	$ wget
    # Untar
    	$ tar -xf mopower-ups-hw2-firmware-v0.934-07-14-2018-001628.tar
    # cd to directory
    	$ cd mopower-firmware
    # kill UPS processes
    	$ sudo pkill -f; sudo pkill -f
    # update firmware
    	$ ./ mopower-ups-hw2-v0.934-07-14-2018-001628.bin
    # reboot after firmware update is finished
    	$ sudo reboot
    Back to Table of Contents

    Usage Quick Start

    The UPS has two standard control switches. SW1 is the main power switch, it is under the PWR LED at the edge of the PCB. SW2 is a configurable auxilary switch. These are small switches and are meant to fit in most enclosures. An optional larger top mount power switch is available at SW3 and acts like SW1. The power switch can be used to reboot or shutdown your Raspberry Pi. Pressing it briefly (0.06 to 1.5 seconds) will instruct your Pi to reboot. Pressing it for 2 to 5 seconds will instruct your Pi to shutdown. Pressing it for 10 seconds or longer will forcibly cut power to your Pi. Note that for reboot and shutdown to work properly, your Raspberry Pi must have the appropriate software installed to communicate with the UPS and initiate a reboot or shutdown. The forced power cut actually shuts down the power regulator feeding the Pi and no software is required. When the Pi is off, a short press of this button will apply power to the Pi.

    Hardware details:

    Circuit Description

    The UPS consists of 3 main hardware blocks: A highly efficient DC-DC converter, a trickle charger designed for NIMH batteries and a micro-controller for overall communcations and control. A brief description of the hardware follows.

    Main input power passes through a 1.85A polyfuse and is protected by a TVS (transient voltage suppressor). Main input power is routed to the micro-controller for voltage measurement.

    An LM317 regulator is used as a constant current source and takes main input power to trickle charge a battery pack. The regulator power is routed through a P-Channel MOSFET allowing on/off control. The battery pack is protected by a 1.85A polyfuse. Battery pack voltage is routed to the micro-controller for voltage measurement.

    The main input power and battery power is routed through two diodes (Diode OR network) to a 3.3v regulator that powers the micro-controller. Main power is also routed to the switch mode regulator IC that generates the 5v needed for the Raspberry Pi. The 5v that powers the Pi is protected by a 2.5A polyfuse similar to the one found on modern Raspberry Pis.

    The micro-controller is the heart of the UPS and is responsible for controlling power to the Raspberry Pi. It can be programmed to control the UPS depending on various input and timer variables in addition to common UPS functions measuring input and battery voltage. Two standard switches are provided, one is a main power switch which controls the main power of the Raspberry Pi. A second switch is provided for custom or future use. The micro-controller has a 32khz watch crystal for providing a time reference and can be used as a Real Time Clock in the absence of a network source for time. The micro-controller uses a serial UART to communicate with the Raspberry Pi. Two LEDs, PWR and STAT, are provided for power and status display. A 20 pin connector is provided for power, input, and output for various user functions or future functionality of the UPS.

    Back to Table of Contents

    Physical connections to the Raspberry Pi

    The UPS is connected to the Pi using physical GPIO pins 2 and 4 for 5v power and pins 6 and 9 for ground. For off board mounting it may be possible to use one of each if not heavily loaded.
    Communications between the UPS and Pi use the Rasberry Pi GPIO UART pins 8 and 10 (along with ground).
    The optional INA219 current sensor uses GPIO pins 3 and 5 for I2C communications.
    The four mounting hole pads on the UPS are attached to DC ground.

    Physical off board mounting is possible if the required connections are made. Power can be routed back to the original micro-USB input to free GPIO pins. Most all full size Pis have an input polyfuse on the micro-USB input, bypassing the polyfuse on the UPS is recommended to reduce voltage drop when power is routed to the micro-USB port. UPS to Pi communication can also be routed through a USB-serial adapter to free up GPIO pins. The UPS serial UART voltage is 3.3v.

    Back to Table of Contents>


    Min Typical Max
    Input Voltage 11 VDC 30 VDC
    Battery Voltage 6 VDC 30 VDC
    Output Current 5v bus 2.5A(1)(2) 3.5A(1)
    DC-DC converter efficiency, 12VDC input, 1A output 91%
    DC-DC converter efficiency, 30VDC input, 1A output 82%
    Overall system efficiency 12VCD input 88% 91%
    Overall system efficiency 30VCD input 81% 85%
    Idle power usage, Pi Off 0.27mA
    Load regulation, 0-2.5A, DC converter before polyfuse 2%
    (1)high loads may require forced air cooling
    (2)5v bus at Raspberry Pi connector is limited by a 2.5A polyfuse

    Back to Table of Contents

    Rating Notes and Recommended Limits

    Input Voltage Recommended: 12-30 VDC, a regulated or non-regulated 12v adapter is commonly used. The power rating of your adapter will depend on how much power your Raspberry Pi draws and the tickle charge current.
    Input voltage low range:The low range of the input voltage is primarily dictated by the voltage required to charge the batteries fully. With 6 AA NIMH batteries this is approximately 9.0 volts, or 1.5 volts per cell times the number of cells. Some 9v NIMH BLOCK batteries have 7 cells, so the approximate voltage would be 10.5. To this voltage you will need to add approximately 2 volts to account for the voltage drop in the LM317 current regulator. For example 6AA would need 9 volts + 2 volts or approx 11 volts. A 7 cell NIMH block battery would need 10.5 + 2 = 12.5 volts. NOTE: A 7 cell NIMH block battery set to a 6ma charge will generally charge fully with a 12v regulated power input. This is lower then the calculated 12.5v since the voltage drop of the LM317 is lower at small current levels.
    Input voltage in cases where the battery charge is not a consideration can typically be as low as 6VDC while still maintaining output on the 5v bus.

    Charge current power dissipation: Power dissipation in the LM317 regulator may be a consideration at higher input voltages and/or higher charge currents. It is setup as a constant current device and is a linear regulator, it must dissipate all power above the voltage level of the battery. For example a fully charged 6xAA battery pack will be held at 9.0 volts with a charge of 50ma. If your input is 14v, 5 volts at 50ma will have to be dissipated by the regulator, this is 5 x 0.050, or approx 0.25 watts. If it were ran at 28 volts, it would dissipate 0.95 watts, and may run hot. You can use a 9V block battery at high voltage levels to reduce power dissipation in the LM317 or use forced air cooling. The recommended current level for a 9V block battery is set at 6.25ma and thus the regulator needs to dissipate a lot less power.

    DC power input jack:The onboard DC power input jack has a manufacturers typical rating of 24VDC. It has been tested in standard conditions to 30V DC. Alternate power input is available on pads near the input jack labeled Vin2.

    Recommended operating temperature: 0°C - 45°C / 32°F - 113°F
    Batteries behave differently at low and high temperature, capacity will diminish at temperature extremes for most batteries. For NIMH batteries most manufacturers recommend less then a 0.1C charge level below 0 degrees C. Although our UPS can be configured for charge levels well below this limit, we recommend a minimum operating temperature of 0 degrees C. Some semiconductors also have recommend minimum temperature of 0 degrees C for proper operation, although most of the ones used in the UPS are rated for -40°C.
    Manufacturers of NIMH batteries generally recommend a maximum charge temperature of 40-45 degree C. NIMH batteries will also have diminished charge acceptance at high temperatures. The power dissipation in the LM317 may also be a consideration at higher temperatures. It is recommended that you operate the UPS at not more then 45 degrees C. Forced air cooling may be required at higher loads and ambient temperatures.

    TVS diode: Please note that the TVS diode is intended to suppress TRANSIENT voltages only. Constant over voltage will damage the TVS and other components and may present a hazard. Input voltage should not exceed 30V DC.

    Back to Table of Contents

    Recommended Batteries and Estimated Run-Times

    The chart below lists estimated run times for various batteries on different Pi models using NiMH cells. The most popular battery setup is 6xAA NiMH cells. High quality cells are recommended. Run times listed are for an idle Pi and will vary depending on usage.

    Device Zero Zero W/A+ 2B/3B 3B+
    mA/W 100/0.5 120/0.6 230/1.15 400/2.0
    9v Block NiMH (8.4v 200mAh, 1.68Wh) 2h 44m 2h 16m 1h 11m(1) 41 min(1)
    6xAA NiMH (2.5AH, 18Wh) 24 hours+ 20 hours+ 10 hours+ 6 hours+
    8xAA NiMH (2.5AH, 24Wh) 32 hours+ 26 hours+ 13 hours+ 8 hours+
    8xC NiMH (5AH, 48Wh) 64 hours+ 52 hours+ 26 hours+ 16 hours+
    8xD NiMH (10AH, 96Wh) 128 hours+ 104 hours+ 52 hours+ 32 hours+
    (1)9v block cells are recommended for lighly loaded Pi only

    Battery charge current solder jumpers

    The charge current is set by 3 solderable jumpers and their associated resistors. Jumpers are J2, J3, J4. Their associated resistor is directly above the jumper.
    The values are as follows. Double check you have the correct resistor in case of future changes or customization, charge currents are additive. Resistors can be replaced if needed for other current values. The formula for calculating the charge current resistor is 1.25 / I and it's power rating should be greater then (1.25 V)2 / R.

    Back to Table of Contents

    Battery discharge current solder jumpers

    Discharge resistors and control circuitry are on board to provide a basic battery capacity/health check. Firmware v0.934 provides battery discharge testing. There are two jumpers that you need to be aware of and set properly depending on your maximum input and battery voltage, this is done to provide a more effective discharge current range with the installed resitors. The jumpers are marked J6 and J7 and are located on the lower right hand corner of the board (see picture below). For operation up to 15v jumper J6 should be bridged and the LEFT and CENTER of jumper J7 should be bridged (shown in RED in the picture below). For operation from 15v to 30v the RIGHT and CENTER of J7 should be bridged and J6 should be left open. NOTE: Operating at lower voltage levels with the 15v-30v jumper setting is acceptable, operating at higher voltage levels with the 15v or less setting can result in excessive heat and damage. Boards will generally be provided with the 15v to 30v discharge setting unless otherwise requested, please verify the settings on your board before using at higher voltage levels.

    Power dissipation in the discharge resistors of 0.9 W has shown an approx 45°C temperture rise at the resistor in still air. The jumper settings and coresponding maximum voltages have been chosen to stay at or below this power dissipation level.

    Recommended Jumper Setting Resistance Voltage Current Power
    Up to 15v 255 ohms 7.2v (6 cell NiMH) 28mA 203mW
    Up to 15v 255 ohms 8.4v (7 cell NiMH) 33mA 277mW
    Up to 15v 255 ohms 9.6v (8 cell NiMH) 38mA 361mW
    Up to 15v 255 ohms 12v 47mA 565mW
    15-30v 1020 ohms 24v 24mA 565mW

    Back to Table of Contents

    Communications Protocol

    The MoPower UPS uses a serial UART at 19200 baud to communicate with the Raspberry Pi direct through its onboard UART. The official Raspbian OS generally uses /dev/serial0 for this port. You must disable the serial terminal that Raspbian normally has active on this port. See the UPS software install instructions for how to disable the serial terminal. You can also install terminal program, such as minicom, for configuring the UPS.

    The UPS acts similar to a shell prompt and settings are printed and controlled like variables. Note that the UPS does not echo back received characters.
    For example the variable name for the Status LED is "LED_STAT"... so to display the status of this LED we type.
    In the terminal program. We get a response of "LED_STAT=0" which indicates that the status LED is currently off (0). We can modify the LED by using the assignment operator "=". To turn on the LED..
    To turn it off, set the value to 0. You can do this with most of the options provided by the UPS. Variables/Settings which are READ ONLY are marked with a preceding asterisk * before the variable name.

    *IMPORTANT NOTE* We have tried to keep the UPS firmware as flexible as possible, allowing many different operating modes via the numerous settings. If you are changing numerous settings be mindful of how they will effect the operation of the UPS, some may not behave in the way you initially intended, or various settings may conflict with each other. In case an incorrect setting has caused the UPS to not power on, the power switch can be held down and released for 4-6 seconds to initiate a forced power up. The error can then be corrected. Do not use the forced power up function for other purposes as it bypasses all normal UPS controls. You can also reset the EEPROM by holding down both power (SW1) and aux (SW2) buttons while powering up your UPS. The amber LED will blink 5 times indicating bootloader startup, followed by 10 faster flases indicating the EEPROM has been reset. Release both bottons during the fast flash sequence. Forced power up and hardware switch EEPROM reset were added in release v0.934.

    Table of common commands/variables/settings
    show all Prints all common settings
    show time Prints all common time settings
    show ups Prints all common UPS settings
    show data Prints selected data variables w/CRC check
    EEPROM RESET Resets all common EEPROM variables
    EEPROM SAVE Saves all common settings to EEPROM
    UPS-REBOOT Reboots UPS

    Back to Table of Contents

    show data command and CRC check

    The “show data” command is primarily for use by automated software to quickly retrieve the most commonly used data variables. The command returns the variables in a space delimited string followed by a CRC value. It is recommended that any automated software that reacts to output from the UPS to use this command and check the CRC value before acting on the output. The CRC value is in common XMODEM format and has a Polynomial of 0x1021

    An example of returned data is below..

    0.934 7 15 2018 13 2 13 1 258 1 1 0 0 1 14.71 7.85 6.85 0 0 0 0 300 20 0 52 43 62 239 1 1 49 0 0 0 0.000 93e1

    In this case the CRC value is “93e1” and is computed on the entire string EXCEPT for the SPACE before the CRC value and the CRC value itself.

    show data output description table for firmware version 0.934
    Data 0.934 7 15 2018 13 2 13 1 258 1 1 0
    Position 1 2 3 4 5 6 7 8 9 10 11 12

    Data 0 1 14.71 7.85 6.85
    Position 13 14 15 16 17

    Data 0 0 0 0 300 20 0 52 43 62 239 1 1 49
    Position 18 19 20 21 22 23 24 25 26 27 28 29 30 31

    Data 0 0 0 0.000 93e1
    Position 32 33 34 35 36

    Back to Table of Contents

    UPS Core Control Logic

    The following variables are responsible for primary control over the power provided to the Raspberry Pi. Variables marked in BOLD (SETTINGS_UPS_*) are commonly used.

    Variable (*=read only)DESCRIPTION
    *MAIN_POWER This shows the status of the main 5v power to the Pi. 1=ON, 0=OFF. Read only.
    *UPS_POWER UPS_POWER will be 1 when device has "GOOD" power, 0 when power has "FAILED". Primarily controlled by SETTINGS_UPS_POWER_FAIL_VOLTS, SETTINGS_UPS_BATT_SHUTDOWN_VOLTS, SETTINGS_UPS_BATT_POWERUP_VOLTS and SETTINGS_UPS_V_OR. Read only.
    POWER_COMMAND Communication and control of UPS power. 0=no command, 1=power up, 2=reboot, 3=shutdown. Normally used by control scripts only.
    TIMED_SHUTDOWN This is a countdown timer which is used to cut the 5v power applied to the Pi. Generally during a power off event. Normally used by control scripts only.
    *MAIN_POWER_REQUESTED Maintains user desired state of 5v power to the Pi. Note, this does not indicate the actual power state of the Pi, only the requested power state. Normally used by control scripts only. Read only.
    *ADC_VIN_VOLTS ADC calculated input voltage. Note: During power input loss and with certain low impedance power supplies OR if no input supply is connected this value may float to approx ADC_VBATT_VOLTS - 0.5v due to reverse diode leakage and high impedance of the ADC circuit. Read only.
    *ADC_VBATT_VOLTS ADC calculated battery voltage. Read only.
    *ADC_VINVBATT_VOLTS_DIFF Voltage difference between VIN and VBATT ADC inputs. Read only.
    ADC_VIN_DIV Divisor used for raw ADC to input voltage calculations. Should not normally be adjusted.
    ADC_VBATT_DIV Divisor used for raw ADC to battery voltage calculations. Should not normally be adjusted.
    SETTINGS_UPS_POWER_FAIL_VOLTS Input voltages less then the value specified will be considered a "FAILED" power input by the UPS logic.
    SETTINGS_UPS_BATT_SHUTDOWN_VOLTS Battery voltages less the the value specified by this variable AND an input power failure (as defined by SETTINGS_UPS_POWER_FAIL_VOLTS) will trigger a UPS power shutdown.
    This value should allow for enough remaining power in the batteries for a successful shutdown.
    SETTINGS_UPS_BATT_POWERUP_VOLTS Battery voltages greater then or equal to this variable AND good input power (as defined by SETTINGS_UPS_POWER_FAIL_VOLTS) will trigger a UPS power startup.
    This value should allow for enough remaining power in the batteries for a successful startup AND shutdown in case of erratic input power failures.
    SETTINGS_UPS_V_OR When set to 1 UPS power logic is changed to an OR configuration as used in the battery powerup/powerdown and input power failure variables above. Meaning either a valid battery voltage OR a valid input voltage will trigger power events.
    This is primarily enabled (set to 1) to allow battery only operation of the UPS. Normal use of the UPS should leave this setting at it's default value of 0.

    Back to Table of Contents

    Charge Control

    Battery charge current is set by solderable jumpers. Battery charge control (ON/OFF) is firmware controlled utilizing the following variables.
    The example above shows the default state of these variables. The default setting is to always enable the battery charge circuit which is similar to the way revision 1 hardware functioned.
    CHARGE_START_BVOLTS controls the battery voltage at which charging is enabled. Charging begins when the battery voltage is at or below this value. A setting of 1.3v per cell for NiMH batteries has been found to work well.
    CHARGE_STOP_BVOLTS controls the battery voltage at which charging is disabled. Charging stops when the battery voltage is at or above this value. A setting of 1.40-1.45v per cell for NiMH batteries has been found to work well.
    Battery charge current is automatically disabled when input voltage falls below the value set by the SETTINGS_UPS_POWER_FAIL_VOLTS valiable, which generally means input power has failed.

    NOTE: Software variables can be changed easily and accidentally, the maximum continuous charge current for the battery should be set in hardware via the solderable jumpers. It is advisable to provide additional battery protection when using a charge current above the maximum acceptable continuous charge current of your battery.

    Back to Table of Contents

    Discharge Control

    Discharge resistors and control circuitry are on board to provide a basic battery capacity/health check. Our on-board discharge resistors by design are relatively small since we do not want to add a high heat load to the device. We are still able to effectively test NiMH batteries with a small discharge current due to their discharge 'knees'. This is where the voltage of a newly charged battery decreases more rapidly at the start of a discharge and then again towards the end of it's capacity. We take advatage of this rapid voltage decrease at the start of the discharge cycle. We have found discharging a NiMH battery to 1.25v per cell gives us approx 10-15% of the total charge capacity of the battery and is a good indiator of it's total capacity and overall condition. The following variables control the process.
    Start by verifying the DISCHARGE_RESISTOR_OHMS setting. It should be set to 255 for the "up to 15v" setting and 1020 for the "15v to 30v" setting, see above.
    Set the DISCHARGE_STOP_BVOLTS variable. We recommend 1.25v per cell for an indiation of approx 10-15% of total capacity.
    DISCHARGE_STOP_MINS is the maximum test time and is generally not used, by default it is set to 1,440 minutes or 1 day.
    DISCHARGE_TOT_MIN and SEC show the total duration of the test. DISCHARGE_TOT_CURRENT is the total discharge current in Amps.
    Once all your variables are set you can start the test by setting DISCHARGE_TEST_START to 1, DISCHARGE_TEST_RUNNING indicated when a test is running by a value of 1.
    Note: Charge control is turned off when a discharge test is started, and is turn back on when finished.

    Back to Table of Contents

    Watchdog Timer

    The UPS has a watchdog feature which can be used to reset your Raspberry Pi in case it is unresponsive. When enabled the watchdog timer will keep counting down and is reset by two events, one is any command received by the serial UART from the Pi and second is an actual RESET event caused by the watchdog timer itself. The watchdog considers any command, valid, invalid or blank (a RETURN), coming from the UART as a signal that the Pi is active and will reset its timer.








    This is the main watchdog “timer” in SECONDS. If it doesn't receive a valid signal from the Pi in this time, a hard reset is done.

    Range: 0-65,535



    Once a watchdog reset is triggered, this is the time to stay in the OFF state before reapplying power to the Pi

    Range: 0-65,535



    *Read Only, This is the watchdog countdown



    *Read Only, This is the watchdog countdown for power off time


    Back to Table of Contents

    Reading ADC inputs

    The UPS has 4 user accessible 10-bit (0-1023) ADCs onboard with a range of 0 - 1.1 volts. They can be read using the following variables; ADC_5, ADC_6, ADC_7, ADC_8. Each ADC has to be enabled by setting it's corresponding configuration variable ADC_CONFIG_* to a 1. Note the numberic portion of the variable corresponds to the physical pin number on the 20 pin expansion header. ADC values are also printed by the "show data" command.

    Back to Table of Contents

    UPS Input Control Settings

    The UPS Input Control Settings allow a way to control the Pi (or the UPS I/O) depending on various inputs available to the UPS.

    The following two controls are a good example of using the input control for a 12v automotive application. By selecting appropriate power up and shutdown voltages, we can make our Pi start and shut down depending on if our engine is running. This saves us from having to run an ignition wire to our Pi and also gives us more flexibility, for example we can set the TIME AT LEVEL option to allow the Pi to stay on for a predetermined time after engine shutdown.

    Continuing our automotive example, here are two settings that will accomplish this.

    Example, Turns on Pi when input voltage is greater then 13.50 volts for more then 3 seconds


    Example, Turns off the Pi when input voltage is less then 12.80 volts for more then 10 seconds


    See the UPS Input Control Settings table for more information. The voltage levels chosen should work for most 12v systems and can easily be adjusted. You may have noticed the last two options, Option 8 and 9 are set. Option 9 “USE TRIGGER” when set only triggers our control setting ONCE, it then needs to be reset by an external source to be triggered again. Our external source in this case ends up being the other command. The trigger options allow our automotive car computer to be turned on with the engine off, or turned off with the engine on. If these triggers were NOT set, once you turned off a Pi (via software or the power button) when the engine was running, the power on input control would immediately turn it back on again. In the opposite case when the engine was off, you would not be able to turn ON the Pi, since the power-off command would persist. This is generally not what is expected to happen in this example automotive application, hence the need for the trigger options.

    In our example above, the power-off command resets the trigger of the power-on command and vice-versa. You can setup another control setting to act as a trigger reset as well, by setting COMMAND option to be 0 and the appropriate trigger option, you would only be resetting the trigger of the other command and not executing any power functions.

    Table of UPS Input Control Settings




    Number in BRACKETS specifies the Input control index, values 0-9

    Option 1 – PRIORITY

    The Priority of this control, values 1-10. A higher priority level will override other control settings acting on the same command.
    Timer control will have priority over input control functions of the same priority level.

    Option 2 – COMMAND

    The Command to execute, 0=None 1=ON 2=REBOOT 3=SHUTDOWN

    Option 3 – PORT

    1=VIN, 2=VBATT.. see PORT OPTIONS table for further settings

    Option 4 – LEVEL

    Test level, float range 0-32.00

    Option 5 – TIME AT LEVEL

    Consecutive Seconds where test level has to match. Range 0-65535.

    Option 6 – TEST

    0=Less then, 1=Greater then, 2=Equal to

    Option 7 – Trigger

    Holds trigger variable, 0=not triggered, 1=triggered

    Option 8 – RESET TRIGGER

    Index of other command to reset trigger of. Default is 99 which defines no action.

    Option 9 – USE TRIGGER

    Use (1) or don't use (0) our own trigger

    Table of PORT OPTIONS for Input Control




    Volts Input, float value


    Volts Battery, float value

    Back to Table of Contents

    UPS Timer Control Settings

    The UPS provides a way to wake up a powered off Raspberry Pi at intervals using the timer feature.

    It is accessed using the “TIMER_CONTROL” variable. There are 10 individual timers available for use, they are accessed like a variable array. For example to set the first timer control option one can use..


    This sets timer # 1

    With this setting the Pi will power up every hour at half passed the hour.

    The options are comma separated and there should be no spaces, options should not be skipped.

    10 indexes are available for use, numbered 0-9. Remember to issue a EEPROM SAVE command otherwise you will loose any set options if the UPS reboots.

    Table of UPS Timer Control Settings




    Number in BRACKETS specifies the Timer control index, 0-9

    Option 1 – PRIORITY

    The Priority of this timer control, values 1-10.
    A higher priority level will override other control settings acting on the same command.
    Timer control will have priority over input control functions of the same priority level.

    Option 2 – COMMAND

    The Command to execute

    Option 3 – MINUTE

    The minute to run the command, 0-59, 60 is wildcard

    101-130 = step values, similar to Unix 'cron'

    For example 105 would equal to */5 in 'cron' and would run every 5 minutes, 130 would be equal to */30, etc..

    Option 4 – HOUR

    The hour to run the command, 0-23, 24 is wildcard

    101-112 = step values, similar to Unix 'cron'

    For example 102 would equal to */2 in 'cron' and would run every 2 hours, 108 would be equal to */8, etc..

    Back to Table of Contents

    Time and Date – Daylight Savings Time

    The UPS is capable of making adjustments for Daylight Savings Time to its own internal clock.

    While we believe most use cases would involve the Pi correcting both its own and UPS time, this feature is provided in case the Pi will be off for periods of time that may transition though a Daylight Savings Time adjustment event.





    Daylight Savings On or Off

    1 = OFF, 1 = ON

    0 = OFF


    Used to indicate if Daylight Saving Time is currently in effect (Summer time), or not in effect (Winter time). It must be set to the correct current value for Daylight Saving Time correction to operate properly.

    0= DST

    1 = NOT DST



    Specifies the hour (in 24 hour mode) that Daylight Saving Time takes effect during the Spring and the clock is moved forward 1 hour

    Range: 0-23

    2 = 2 AM


    The day that Daylight Savings Time takes effect. If SETTINGS_DLS_SPRING_WEEK is set to 0, this option refers to the day of the month in which the adjustment takes place.
    If SETTINGS_DLS_SPRING_WEEK is set to any value other then 0, this option refers to the Day of the Week in which the correction takes place (ie, 1=Sunday,2= Monday, 3=Tuesday...).
    If this option refers to the day of the week, you must make sure the current day of the week (DAYOFWEEK) is properly set.

    Range: 1-31

    1 = SUNDAY


    Specifies the week in which the adjustment is made. 0 and 5 are special cases. 0 is used where we do not want to refer to a particular week, but to a particular day of the month in which we want the adjustment made (refer to SETTINGS_DLS_SPRING_DAY).
    A value of 5 also has special meaning in that it refers to the last week of the month.

    Range: 0-5



    Specifies the Month in which the Spring time adjustment is made.

    Range: 1-12



    See above

    2 = 2AM


    See above

    1 = SUNDAY


    See above

    1 = FIRST WEEK


    See above



    Current day of the week. Required for proper operation of DST if the day option is used to specify a weekday. Range 1-7, 1 = SUNDAY


    Back to Table of Contents

    Time Correction Settings – Watch Crystal Adjustment

    This setting allows one to 'software trim' the clock crystal responsible for keeping time on the UPS. Trimming of the watch crystal is generally not required if you have an accurate network time source available and you will be updating the UPS time accordingly. If you require accurate time keeping without a network connection or other time source you can trim this value if needed. Take accurate long term measurements of the UPS clock before changing the default value.





    Error correction to be applied to the clock crystal.

    Value must be a whole number and is calculated by using 604800 /

    (seconds per week correction).

    Unsigned 32-bit value

    235331, which corresponds to a value of (-) 2.57 seconds per week of correction.


    Indicates if time correction value is positive or negative.



    0 = NEGATIVE

    Back to Table of Contents

    Debug and Special Use Options

    These options are rarely used and should not be normally adjusted. They are NOT reset by the normal EEPROM reset commands of the main firmware. It is recommended that you NOT program these options into any automated scripts and execute them sparingly.

    Boot power on and brownout reset flags

    On power up the micro-controller on the UPS will normally leave the 5v power to the Pi untouched EXCEPT when an initial power-on or brownout condition occurs. Remember that the UPS micro-controller will run with lower voltage then the 5v converter.. and hence will run at voltages that would not power up the 5v line to the Pi. When such a condition is detected the UPS *bootloader* will TURN OFF the 5v power and allow the main UPS program to decide if power should be turned on or off. This prevents the errant power up and then power down that would normally occur if we did not detect these two events. You may still see a very momentary blip of power on initial power up, this is a result of the very small bootup time of the micro-controller and has not been seen to cause any problems with the Pi.

    Again this only occurs when initial power is applied to the UPS or when a brownout event occurs. It should also be noted that the micro-controller in use almost always detects both a power on and brownout AT THE SAME TIME, so setting one or the other in general will give you the same effect, see the micro-controller datasheet for further information.

    These options are provided in case you need to turn off this functionality. Both options are ENABLED by default. Again, you will normally never need to adjust these values.

    Micro-controller Oscillator Calibration for UART speed adjustment

    The micro-controller and Raspberry Pi both must keep an accurate clock source to properly communicate with each other via the serial UART. The speed of the UART that we use (19200) is slow enough where we can tolerate a fair bit of error. While there is always the option to automatically adjust the micro-controller oscillator, we have elected not to provide this auto-adjust feature. We have found in our testing that the factory calibration of the internal oscillator of the micro-controller to be very good, due to this experience we believe providing an auto adjustment feature would needlessly complicate things and add yet another troubleshooting step when problems do arise. There is also the UART clock source on the Raspberry Pi to consider, it is not clear as to the initial accuracy of this source, having an auto-adjust on our micro-controller might just make things worse.

    With this in mind, we realize there may be cases where you would need to adjust the oscillator frequency. For example a very large temperature swing may cause clock problems, or we may have a combination of Raspberry Pi and UPS micro-controllers that are just too far out of alignment to initially communicate. Thus, we have provided a method to test and modify the main oscillator frequency of the micro-controller on the UPS.

    This is another one of those options that are rarely used and should not be normally adjusted. They are NOT reset by the normal EEPROM reset commands of the main firmware.

    *Note your UPS may have a different calibration other then default*

    NOTE that you can also adjust the clock speed of the UART on the Raspberry Pi side. If you cannot communicate with the UPS, you will have to use the UART adjustment on the Pi in order to communicate, initially set it up, or to adjust the oscillator calibration on the UPS. This may be needed in cases where either the Raspberry Pi clock and/or the UPS clock is too far out of adjustment.

    You can do this by setting “bcm2708.uart_clock=3000000” in /boot/cmdline.txt and setting “init_uart_clock set=3000000” in /boot/config.txt

    Adjusting init_uart_clock set in increments of 50000 should get you talking to the UPS. There are reports that some versions of the Raspberry Pi have trouble setting the uart clock or have different syntax to do so, the commands above have been tested to work with Raspbian Wheezy dated 2015-05-05. Check syntax on your version if you are running a different operating system.

    Back to Table of Contents

    Warnings and Precautions

    It is important that you take the time to read this section thoroughly before use of this product. We cannot cover all use cases for this UPS, and the ultimate safe use of this UPS is the users responsibility. Nevertheless here are some important points you should be aware of during the use of this product.

    This product is for use by an experienced user. This product has not been tested against and may or may not meet various regulatory, emissions and safety regulations in your country. This item serves as a battery/power supply section of a computer and is not a complete product. Users should be familiar with the technical details of operating a Raspberry Pi (or other hardware), Operating system, proper handling/use of batteries and general electronics safety. This item should be used by those experienced in the components and general design of the product. Safe use of this item is ultimately the users responsibility. Improper use can pose safety and fire hazards.

    You should NOT use the USB power supply input on the Raspberry Pi when using this UPS!!! Possible problems include back-feeding the power from the UPS into the wall adapter of the USB supply, this may cause your USB adapter to overheat and may be a fire hazard. While some adapters MAY have protection for back-feeding, this is generally not advertised and cannot be easily confirmed. Our recommendation is to NEVER use USB power input while using the UPS. The user can assure no USB power is used by removing the input poly-fuse and/or physically blocking or removing the USB input jack. Back-feeding of power may also be an issue with USB hubs. Ensure you know the sources and paths of power flow through your setup!

    Batteries are dense sources of energy and must be handled properly. Users should be familiar with proper battery handling/use and general electronics safety. Improper use can pose safety and fire hazards. Among many precautions include; designs that prevent short circuits, ensuring proper condition of wires, connectors, batteries and battery holders. Observe proper temperature ranges for your batteries. As with almost all battery types, enclosures should be properly vented.

    The UPS contains static sensitive components, you should observe proper static precautions when assembling, handling and using the UPS.

    We make an effort to provide components which are less hazardous to the user and environment. Most all of our components are ROHS compliant and lead free, and we will attempt to provide the least hazardous components commonly available. Some components may nevertheless contain lead or not be ROHS compliant (or conform to other rules or regulations). Items may also contain other harmful chemicals or materials, including lead, normally found in electronics components. Please handle/use this kit appropriately and recycle your batteries, as they are almost always harmful if thrown away.