Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Battery Life

8 Posts
2 Users
0 Likes
548 Views
(@andrew-simpson17)
Posts: 79
Estimable Member Customer
Topic starter
 

Hi

 

I am using: Witty Pi 4 L3V7 on Rpi Zwero 2 WH

 

I power my board using a USB Power Bank.

The UPS uses a 110mHA battery.

When the Power Bank is disconnected the UPS will shutdown when it reaches the battery threshold of 4.2v.

How long on standby will the battery last? Obviously, I could test this by just leaving it to do so and time it but was hoping for an informed answer.  

 

Thanks

 

 
Posted : 16/11/2023 3:05 pm
(@andrew-simpson17)
Posts: 79
Estimable Member Customer
Topic starter
 

Additonal.

 

I have created a python script:

 

import subprocess

# Battery voltage
def get_battery_voltage_witty_pi_4():
'''Gets the battery voltage reading from the Witty Pi 4 in V'''
try:
print("IN")
command = "cd /root/wittypi && . ./utilities.sh && get_input_voltage"
result = subprocess.run(command, shell=True)

print(result)
except Exception as e:
print(f"Could not get battery voltage: {str(e)}")
return "-"

get_battery_voltage_witty_pi_4()

 

Which gave me:

 

1700145896-p1.jpg
 
Posted : 16/11/2023 3:44 pm
(@admin)
Posts: 479
Member Admin
 

If you know the actualy current consumption of your device, you can estimate it by yourself.

Example: Rpi Zero 2W consumpts 200mA current and that is on 5V. The current draws from the battery will be 200x5/3.7=270mA, and a 110mAh battery can last 110/270=0.4 Hour (24 min). This assumes the efficiency of DC/DC converter is 100%, which is impossible, so the actual time will be shorter.

 

 
Posted : 16/11/2023 3:46 pm
(@andrew-simpson17)
Posts: 79
Estimable Member Customer
Topic starter
 

Thanks.

So, if I connected a 5000 battery the UPS will (without external power supply) will last just 18.52 hours on standby? 

So, my project is that this UPS is intended to power a camera by usb power bank. That camera will be placed in say a forest on a Friday evening. I know that particular power bank will last 23 hours. The user will then collect that camera on Monday.  So, even if they connect a new USB Power Bank they would have to press the on/off swicth on your board to reactivate. Is that correct?

 

Also, my question about reading the voltage would tell me if USB Power Bank has been disconnected so I can then shutdown the RPi. You did not actually answer that 2nd bit?

 
Posted : 16/11/2023 4:47 pm
(@andrew-simpson17)
Posts: 79
Estimable Member Customer
Topic starter
 

@admin 

Hi. OK. Tested myself. It did run approx 24 mins (thanks for the formula).  I then reconnected the ubs power bank and it started staright away. Which is what I wanted. PHEW!

A good product after all. I thought it would be. Been testing LOADS of UPSs for my user case.

All my questions regarding voltage (and I have noted previous questions and answers regarding this) was to shut my service/program before the RPi goes into standbye. I have just noticed the event 'beforeShutdown.sh'. Is that where I can stop my service?

 

Many thanks for well thought product.

 
Posted : 16/11/2023 6:02 pm
(@andrew-simpson17)
Posts: 79
Estimable Member Customer
Topic starter
 

@admin 

Spoke too soon 🙁

 

I disconnected the usb power bank (to test my shutdown script) and then reconnected the battery,. The green light is on the UPS. The red light is on the UPS.  But the RPi does not start. When I press the button on the UPS that still does not power the RPI on. What can be causing all of this please?

I have noticed after a while that pressing the button on the UPS the white light comes on. But the RPi still does nto start.

Does the UPS have a power regulator?

This post was modified 1 year ago 2 times by andrew.simpson17
 
Posted : 16/11/2023 6:31 pm
(@andrew-simpson17)
Posts: 79
Estimable Member Customer
Topic starter
 

Sorry to plague you with some many questions. I have a commercial product and was going to release it but the current UPS is no longer being supported and the supplier refunded. So, I am rushing around for a replacement. I appreciate that some of my answers I am looking for are in your documentation.

The only question I have outstanding is the above.

 

I added a line to stop my service in your beforeShutdown.sh file. The format being:

 

service MY_SERVICE stop

 

When I disconnected the battery then reconnected to (the power bank) nothing came on as described above. I had to disconnect the UPS and boot up without it. Then I shutdown and reconnected your UPS. I then added'&' after my shurdown service line so as not to block.  I retested.  Everything worked OK but checking in the syslog I could see my service did not stop.  So, removed the '&' and retested. This worked OK and the syslog recorded that my service was stopped. So not sure what is going on? Whether sometimes my service takes a while to stop and your daemon service has been blocked? If so how can I prevent against that?

 

Also, I have noticed with power banks that the voltage discharge can be erratic - especially in cold weather.  Is the volatge in regulated by your UPS at all or sould I use my own power regulator?

 

Thanks

 

 
Posted : 16/11/2023 8:15 pm
(@admin)
Posts: 479
Member Admin
 

Please confirm if the power to Pi has been cut (red LED off) after shutdown. If it is not cut, then your pi will not be turn on again. You may search "power cut" in this forum to check what may cause power cut issue.

If you put your command in beforeShutdown.sh, you should not put the & at the end. You need to block the daemon.sh script so it will wait for your service to stop, before shutting down the Pi. 

Witty Pi 4 L3V7 uses its own DC/DC converter to output 5V for the Pi. However if the battery can not deliver the current it needs, the output voltage may not be stable.

 

 
Posted : 17/11/2023 6:00 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.