akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Small UPS for Raspberry pi

Sat May 18, 2019 6:15 am

Hi Guys i am having a project of Entrance system running but i cant power it down directly by unplugging it i just want to switch of the mains power and the battery should kick in and shutdown the raspberry pi at same time and turn off the raspberry pi safely which saves the sd card from corrupting
i want the whole system to work for only few seconds till shutdown

what circuit should i design for this idea?

User avatar
omegaman477
Posts: 148
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: Small UPS for Raspberry pi

Sat May 18, 2019 1:18 pm

There are quite a few UPS and battery hats available for the RPI. Some are very sophisticated and expensive.

Option 1:

This is a cheap one I found on Bangood, and I can vouch that it works 100%. https://www.banggood.com/Geekworm-UPS-H ... rehouse=CN

I like the fact that you can read the battery capacity from the I2C bus. All the sample code works and it was very simple to install. I use these almost on every project I do with RPI's. Cheap insurance, as RPI's hate not being shutdown properly, and you can get corrupted SD cards and failed reboots.

I wrote a small standalone python program that starts at boot time, via sysctl, and reads the battery level every 5 minutes, when the battery hits 10% remaining, the program starts a clean shutdown. You could include such a function so your main program can clean up its work and exit properly.

Option 2:

This hat is more of a power manager that can wake up the Pi (and power it off) as required from external triggers, usefull as the RPI does not have a real sleep or halt mode, with external interrupt recovery. https://spellfoundry.com/product/sleepy-pi-2/
..the only thing worse than a stupid question is a question not asked.

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Sat May 18, 2019 1:56 pm

omegaman477 wrote:
Sat May 18, 2019 1:18 pm
There are quite a few UPS and battery hats available for the RPI. Some are very sophisticated and expensive.

Option 1:

This is a cheap one I found on Bangood, and I can vouch that it works 100%. https://www.banggood.com/Geekworm-UPS-H ... rehouse=CN

I like the fact that you can read the battery capacity from the I2C bus. All the sample code works and it was very simple to install. I use these almost on every project I do with RPI's. Cheap insurance, as RPI's hate not being shutdown properly, and you can get corrupted SD cards and failed reboots.

I wrote a small standalone python program that starts at boot time, via sysctl, and reads the battery level every 5 minutes, when the battery hits 10% remaining, the program starts a clean shutdown. You could include such a function so your main program can clean up its work and exit properly.

Option 2:

This hat is more of a power manager that can wake up the Pi (and power it off) as required from external triggers, usefull as the RPI does not have a real sleep or halt mode, with external interrupt recovery. https://spellfoundry.com/product/sleepy-pi-2/
those all give backup power to raspberry pi for couple of hours i just want to power for clean shutdown the raspberry pi and would like to make one myself for the circuit i am designing for raspberry pi so these pre-made wont work for me just a clean shutdown and would like to be DIY

BudBennett
Posts: 89
Joined: Fri May 17, 2013 2:45 pm
Location: Westcliffe, Colorado, USA

Re: Small UPS for Raspberry pi

Sun May 19, 2019 4:02 am

Check this out. The UPS is powered by a single supercapacitor that will provide power for about 30seconds, depending upon the size of the supercap and the current drain of the Raspberry Pi. A 100F super capacitor works just fine for a Raspberry Pi Zero W. You will need a larger supercap for a Raspberry Pi 2 or 3. It is a DYI project (you will need good SMD soldering skills):
https://hackaday.io/project/25107-singl ... spberry-pi

Bud.

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Sun May 19, 2019 6:38 am

BudBennett wrote:
Sun May 19, 2019 4:02 am
Check this out. The UPS is powered by a single supercapacitor that will provide power for about 30seconds, depending upon the size of the supercap and the current drain of the Raspberry Pi. A 100F super capacitor works just fine for a Raspberry Pi Zero W. You will need a larger supercap for a Raspberry Pi 2 or 3. It is a DYI project (you will need good SMD soldering skills):
https://hackaday.io/project/25107-singl ... spberry-pi

Bud.
I mentioned this before and mentioning this again i cant do smd soldering and no smd can be used in my circuit i have got a simple mosfet ups but just i need a power source for it to turn on till it shutdown properly so super capacitor would be nice for this i guess any suggestions you can give me for power source please

BudBennett
Posts: 89
Joined: Fri May 17, 2013 2:45 pm
Location: Westcliffe, Colorado, USA

Re: Small UPS for Raspberry pi

Sun May 19, 2019 11:02 pm

Mentioned it before? Where in this post? If you can’t solder SMD then you should seriously consider a pre-made UPS. Almost all of the IC solutions created this millennium have been SMD parts. The newest/best stuff is all SMD. —Bud

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 5:30 am

BudBennett wrote:
Sun May 19, 2019 11:02 pm
Mentioned it before? Where in this post? If you can’t solder SMD then you should seriously consider a pre-made UPS. Almost all of the IC solutions created this millennium have been SMD parts. The newest/best stuff is all SMD. —Bud
dont worry about that i already made a mini ups out of mosfet just i need a power source of 5v to have it shutdown or power till it shutdown thats it

i would like to hear suggestions from you guys for powering the raspberry pi for very short time

User avatar
Imperf3kt
Posts: 2769
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Small UPS for Raspberry pi

Mon May 20, 2019 6:00 am

You don't want it to power at the same time as whatever power supply us plugged in, so you'll need more circuitry to determine when the power is cut and then switch to your backup power source fast enough without the voltage dropping. A non trivial task, in my experience.

There's also no current battery technology that will give you a clean, regulated 5v that the Pi wants, do you'll need something to either step up or down a different voltage.


As others mentioned, a supercapacitor is your easiest option. Anything else gets exponentially more complex.
55:55:44:44:4C
52:4C:52:42:41

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 6:04 am

Imperf3kt wrote:
Mon May 20, 2019 6:00 am
You don't want it to power at the same time as whatever power supply us plugged in, so you'll need more circuitry to determine when the power is cut and then switch to your backup power source fast enough without the voltage dropping. A non trivial task, in my experience.

There's also no current battery technology that will give you a clean, regulated 5v that the Pi wants, do you'll need something to either step up or down a different voltage.


As others mentioned, a supercapacitor is your easiest option.

i am using a mosfet to switch between power like if low activate if high deactivate so it is easy to handle with an additional diode and so i guess i will use 2x lipo battery and convert that to 5v as there will be more capacity usage

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Small UPS for Raspberry pi

Mon May 20, 2019 8:14 am

akash614 wrote:
Mon May 20, 2019 6:04 am
i am using a mosfet to switch between power like if low activate if high deactivate so it is easy to handle with an additional diode and so i guess i will use 2x lipo battery and convert that to 5v as there will be more capacity usage
Can you post a circuit diagram of what you have? Then we can see if it its any good and we could advice you to get a better solution.

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 9:41 am

Brandon92 wrote:
Mon May 20, 2019 8:14 am
akash614 wrote:
Mon May 20, 2019 6:04 am
i am using a mosfet to switch between power like if low activate if high deactivate so it is easy to handle with an additional diode and so i guess i will use 2x lipo battery and convert that to 5v as there will be more capacity usage
Can you post a circuit diagram of what you have? Then we can see if it its any good and we could advice you to get a better solution.
Yes it is in the easyeda page at bottom right UPS System

Image

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Small UPS for Raspberry pi

Mon May 20, 2019 10:21 am

First of all I see a couple mistakes in your design and some questions:
  • Are you sure the LCD led backlight doesn't need a resistor.
  • Don't forget the resistors in front of the "LED indicators"
  • Also, how are you different power rails connected. For example: how is the 5V+ connected to the Vcc and likewise for the UPS?
  • By the looks of it the UPS rail will be <4.5V when running of the 5V supply
By the way, take a look at this ic: LTC4413

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 10:50 am

Brandon92 wrote:
Mon May 20, 2019 10:21 am
  • Are you sure the LCD led backlight doesn't need a resistor.
  • Don't forget the resistors in front of the "LED indicators"
Yes i am sure cause they are 5mm and running in without resistor and these were tested really
Brandon92 wrote:
  • Also, how are you different power rails connected. For example: how is the 5V+ connected to the Vcc and likewise for the UPS?
  • By the looks of it the UPS rail will be <4.5V when running of the 5V supply
VCC is connected to Rpi GPIO header and the power and UPS is having a terminal where we have to solder wires from the terminals to power pads under RPI

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Small UPS for Raspberry pi

Mon May 20, 2019 11:15 am

akash614 wrote:
Mon May 20, 2019 10:50 am
Yes i am sure cause they are 5mm and running in without resistor and these were tested really
You are wrong here. Because the resistor is fundamental needed if you want to power a led correctly. And it doesn't matter if it is a smd led or a 5mm led. Also, in this way you are "overloading" the output of the Rpi and the output could die. Because that the maximum is <16mA spec and if you connect a led without a resistor. The current will be to large.
akash614 wrote:
Mon May 20, 2019 10:50 am
VCC is connected to Rpi GPIO header and the power and UPS is having a terminal where we have to solder wires from the terminals to power pads under RPI
Is connection to the Rpi GPIO and under the Rpi not the same connection :geek: So 5V+ and the UPS are directly connected to each other?

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 11:21 am

Brandon92 wrote:
Mon May 20, 2019 11:15 am
You are wrong here. Because the resistor is fundamental needed if you want to power a led correctly. And it doesn't matter if it is a smd led or a 5mm led. Also, in this way you are "overloading" the output of the Rpi and the output could die. Because that the maximum is <16mA spec and if you connect a led without a resistor. The current will be to large.

Is connection to the Rpi GPIO and under the Rpi not the same connection :geek: So 5V+ and the UPS are directly connected to each other?
i am able to light a led without any problem as it is still glowing low and even a red led is working properly but i will add for extra safety

UPS and Buck converter are having same power and the VCC are all directly from raspberry pi i thought this would be better

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Small UPS for Raspberry pi

Mon May 20, 2019 12:27 pm

akash614 wrote:
Mon May 20, 2019 11:21 am
i am able to light a led without any problem as it is still glowing low and even a red led is working properly but i will add for extra safety
Try to connect a led to a real powersupply and set to output to 3.3V and check the current (the led will be damaged). You could also run the led on a battery pack (3*AA or someting like that).
But the resistor is necessary explanation
akash614 wrote:
Mon May 20, 2019 11:21 am
UPS and Buck converter are having same power and the VCC are all directly from raspberry pi i thought this would be better
Well exactly not. A "power supply" often doesn't like when you apply a voltage at his output. The power supply could be damaged in that way.
And when I did a measurement from the output to the input, this is the result. This means also that when you are running on the battery, there is also a pad to the P2 connector. And this is not what you want.
Attachments
29f721fb-c2be-4cf3-a90e-00576bfc44dc.jpg
29f721fb-c2be-4cf3-a90e-00576bfc44dc.jpg (190.79 KiB) Viewed 1505 times

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 12:39 pm

Brandon92 wrote:
Mon May 20, 2019 12:27 pm
akash614 wrote:
Mon May 20, 2019 11:21 am
i am able to light a led without any problem as it is still glowing low and even a red led is working properly but i will add for extra safety
Try to connect a led to a real powersupply and set to output to 3.3V and check the current (the led will be damaged). You could also run the led on a battery pack (3*AA or someting like that).
But the resistor is necessary explanation
akash614 wrote:
Mon May 20, 2019 11:21 am
UPS and Buck converter are having same power and the VCC are all directly from raspberry pi i thought this would be better
Well exactly not. A "power supply" often doesn't like when you apply a voltage at his output. The power supply could be damaged in that way.
And when I did a measurement from the output to the input, this is the result. This means also that when you are running on the battery, there is also a pad to the P2 connector. And this is not what you want.
I recently remove the resistor because of a mistake

I have added a diode for that and did not like to have the both input and output at in other direction same time causing it to destroy

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Small UPS for Raspberry pi

Mon May 20, 2019 2:56 pm

akash614 wrote:
Mon May 20, 2019 12:39 pm
I have added a diode for that and did not like to have the both input and output at in other direction same time causing it to destroy
Does the forward voltage of the diode give you a problem :geek:
You could also "place" the "input select" (so to speak) in front of the buck converter, will this help you ;)

akash614
Posts: 42
Joined: Tue Dec 05, 2017 2:48 am

Re: Small UPS for Raspberry pi

Mon May 20, 2019 4:14 pm

Brandon92 wrote:
Mon May 20, 2019 2:56 pm
akash614 wrote:
Mon May 20, 2019 12:39 pm
I have added a diode for that and did not like to have the both input and output at in other direction same time causing it to destroy
Does the forward voltage of the diode give you a problem :geek:
You could also "place" the "input select" (so to speak) in front of the buck converter, will this help you ;)
ok that would help enough for me thanks everyone for joining this post and helping me

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Small UPS for Raspberry pi

Mon May 20, 2019 6:12 pm

akash614 wrote:
Mon May 20, 2019 4:14 pm
ok that would help enough for me thanks everyone for joining this post and helping me
No problem, would like to see your final solution.

Return to “Other projects”