Raspberry Pi UPS HAT (DFR0494)

This is a placeholder topic for “Raspberry Pi UPS HAT” comments.

DFRobot Raspberry Pi UPS HAT is an uninterruptable power supply shield for Raspberry Pi. It can provide steady power source to Raspberry Pi for an extended period … read more

Read more

1 Like

Do you guys have a snippet of code for i2C connection of this? Do you also have documentation for this product?

Found it here: https://wiki.dfrobot.com/Raspberry_Pi_%20UPS_HAT_SKU_DFR0494
You guys might want to add this.

Thanks Ekin!

My question is about the Li battery.
What is the maximum physical capacity of the battery in mAh and hence its physical dimensions.
Thank you

Hi Anthony,

This product does not come with a battery. Any of our LiPo batteries will be compatible:

Dear Stephen,
Thank you for the reply. I know that the Li battery is not included. Having a look at https://core-electronics.com.au/power-batteries/liion-lipoly.html will the 6000mAh with SKU: CE04381 fit within the confines of the UPS HAT’s space and how does one secure the battery to the PCB?

I have another question about the pinouts of the UPS HAT. We know that the pins on the RPi include the power, ground, data pins, IIC pins and PWM pins. Does the UPS HAT’s pins only connect to the power pins of the RPi?

Thank you

Hi Anthony,

There is no maximum capacity in mAh listed for this device. The largest battery that you could comfortably mount on the top of the UPS HAT would be the 4400mAh:

The 6000mAh will be the same footprint as the total board. You could attach it with some double sided tape.

As far as the pin used by the UPS hat, this will connect to the Power and Ground pins, as well as the I2C pins. None of these are ‘used’ though as they are busses, and still accessible via the headers on the top of the UPS HAT.

I am looking at the DFRobot UPS Hat for a Home Assistant installation on a RPi 3B.

I understand that the hat sends a shutdown to the OS when the power is off and the battery is < 10%.

What I want to know is if the hat sends a power on signal once power is restored and the battery is at a certain level.

The FAQ says: “The power supply will not be resumed unless the battery power is back up to above 10%.”. But this is ambiguous to me.

Does that mean that a power-on signal will be sent to the main RPi system at this point and therefore the RPI OS will be rebooted?

A number of UPS hats will shut down the RPi but not reboot the RPi once power is restored until a button is manually pressed. I want to avoid that scenario and have the system automatically restart.


My question was answered on the DFRobot product page forum.

The answer is that power cannot be restored automatically once tthe RPi is shut down.

A couple of things about this hat.

Firstly I was concerned about current draw on the pi 4. However the pi 4 itself only draws about half an amp - it probably spikes on startup etc like most things. I wanted to run the 7" true pi screen - it does another half amp so allowing for spikes this ups does the trick.

However the version that I got has the two pin battery socket in a different place on the board. The pictures show it about the middle of one edge. It is now towards one side, next to the gpio connector, and it hits to top of the pi 4 POE riser. You might have better luck with the pi zero version of this board.

One thing I was disappointed with though was that you have to use the usb socket to charge and power the board. It won;t take power from the pi itself. This means on the little computer I built, I now have three power inlets - this board, the pi and the screen. Of course the case I got doesn’t have a hole for the ups board. Mind you the connectors into gpio for the screen mean that the case can’t have the back on it anyway and then there is the battery that is too big to fit.

Hey Paul,

Excellent note, if you’re looking for a way to get around this, you can likely take the 2nd and 6th pins of the Pi and attach them to the appropriate 5 V rail on the HAT, but I totally understand that’s an inconvenience for the project. Otherwise, if you can please send through an email to support@coreelectronics.com.au we should be able to organise for our site to be updated to reflect all the changes that you’ve noted. If there’s anything else that we can do for you please let us know!

Core Electronics | Support

Hi.I purchased this UPS HAT for my Pi 4 and seem to have run into issues. I have followed the install guide as outlined on the DFRobot wiki page however when testing the installation using sudo i2cdetect -y l, the output is blank

The raspi-blacklist.conf file is also blank.

Although I am having the above issue, the battery and UPS are working fine. I am able to unplug the device from mains power and the battery takes over.

The intention of this UPS was to safely shut the Pi down once it lost mains power.

Any help would be much appreciated.

1 Like

Hey Steve,

Welcome to our forum!

That’s very interesting, do you have another Pi that you can confirm this against. It appears that i2c-tools was installed correctly. However, the UPS isn’t appearing at 0x10 as it should. Can you try running their script to check that the issue is with i2cdetect rather than with the connection to the board itself, I’m expecting this script to fail and return an error, but the results may be able to get us a better idea of what’s going on. (also, is your board a v1.0 should be written on the front, I’ve tested the v1.0 with a Pi 4 here and found that the connection at address 0x10 was successful on a fresh install so if you’re not using a clean install of Raspbian that may be causing the issues too)

import smbus
addr=0x10 #ups i2c address
bus=smbus.SMBus(1) #i2c-1

capacity=(((vcellH&0x0F)<<8)+vcellL)*1.25 #capacity
electricity=((socH<<8)+socL)*0.003906 #current electric quantity percentage

print("electricity percentage=%.2f"%electricity)

Core Electronics | Support

Hi Bryce.

Thanks for the reply. It seems there is an issue with the Pi I was using. I switched over to another Pi 4 as suggested and it is working as expected. Thanks for the tip!

Screen Shot 2020-10-16 at 11.52.07 am

Now that that’s working, is there a way to trigger the shutdown once AC power is dropped?


1 Like

Hey Steve,

Absolutely, you’ll have to write a custom script, but if you monitor the variable electricity from the above script using a daemon that runs constantly in the background, then trigger sudo shutdown -h now once it drops below a certain threshold you can use the UPS as a safe shutdown during blackouts, and during outages that don’t last long the shutdown won’t trigger. It’ll require some experimentation and you’ll need to do some research on whether libraries already exist to do similar functions and how they can be modified, but yes, it should be possible. Make sure to let us know about your project once you’ve got it working, that’d be extremely helpful for other users of this board

Core Electronics | Support

1 Like

Hi Everyone,

Came across this link. Leaving it here in case it’s handy for someone in future :slight_smile:

Support | Core Electronics


Does anyone know if Core are still shipping the V1 revision of this board, or are they now shipping the newer V2 revision detailed at https://wiki.dfrobot.com/Raspberry_Pi_UPS_HAT_SKU_DFR0494?


I can confirm we are now stocking the V2.0 version of this HAT. Let us know if we can help with anything else!


Hi all…

Can this be used in conjunction with other hats? I have a HiFiBerry Digi Hat. The main use of this “ups” hat for me will only be to shutdown the Pi once Power is turned off.