Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Raspberry Pi UPS Power Bank with Battery Monitoring on Blynk
Raspberry Pi Raspberry Pi Projects

Raspberry Pi UPS Power Bank with Battery Monitoring on Blynk

Mamtaz AlamBy Mamtaz AlamUpdated:January 24, 20252 Comments9 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Raspberry Pi UPS Power Bank with Battery Monitoring on Blynk
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview:

While browsing the internet, you’ll come across numerous UPS (Uninterruptible Power Supply) Power Bank designed for Raspberry Pi Boards. However, I’ve discovered that many of them are not genuine. A significant number face power failure issues, while others lack an adequate Battery Management System Circuit. Additionally, several boards have problems with balanced charging and battery protection mechanisms. SunFounder’s Raspberry Pi UPS Power Supply Board addresses and rectifies these concerns.

The SunFounder UPS Power Supply for Raspberry Pi offers a comprehensive UPS solution for Raspberry Pi 3/4 Model B/B+. The kit includes a PiPower board, a 2,000 mAh battery, and all necessary assembly accessories. Additionally, it’s compatible with other boards similar in size to Raspberry Pi that accept a 5V DC input.

Monitor Battery Power using Raspberry Pi Blynk

In this article, we will unbox, assemble and test the Raspberry Pi UPS Power Bank from SunFounder. We will also write a sample Python Code to Send the Battery Status data to Blynk Server. The Blynk Server will show the status of USB Power, Battery Charging, Sufficient Charge status as well as Low Battery Alert status.




Why do we need UPS Power Bank?

If your Raspberry Pi project needs constant power source, relying only on the main power source isn’t advisable. Power inconsistencies, like drops and surges, can be common in certain areas, sometimes lasting for extended periods. These fluctuations can harm your Raspberry Pi, and an abrupt power loss can shut it down unsafely, risking the loss of all data on the SD card and potentially damaging it.

Thus, employing an uninterruptible power supply (UPS) is wise.

A UPS ensures that in the event of a power outage, a battery or alternate power source kicks in, preventing the device from shutting down. Essentially, a UPS acts as a backup power solution. Once the primary power is restored, the UPS recharges, preparing for any future power disruptions.


SunFounder Raspberry Pi UPS Power Supply

The SunFounder Raspberry Pi UPS Power Supply comes with a Battery, 5V/3A Power Bank Expansion Board which is compatible with Raspberry Pi 4B/3B+/3B/Zero 2 W/Zero W.

Raspberry Pi 4 UPS Power Supply Bank

PiPower serves as an alternative power source for the Raspberry Pi. When a USB-C main adapter is connected to the PiPower, it not only charges its battery with a gentle current but also directly powers the Raspberry Pi. Should there be a power interruption or if the USB-C main power is detached, PiPower ensures uninterrupted power to the Raspberry Pi.

PiPower delivers a 5V/3A energy output suitable for diverse Raspberry Pi requirements. It features four energy indicators, with each light signifying 25% battery capacity. Additionally, there’s a built-in switch, eliminating the need to connect or disconnect cables to manage the Raspberry Pi’s power. Use Battery Capacity Tester to calculate Battery Capacity.


Raspberry Pi UPS Power Supply Key Features

  • UPS module output – 5V/3A via USB Type-A port
  • Battery charge – up to 5V/2A MAX
  • Can power the Pi and charge the battery simultaneously
  • Power Supply – 5V/3A via USB Type-C port
  • Battery – 7.4V/2,000mAh. battery life: 3-4 hours​
  • Battery protection – Overcharge/discharge protection, balance charging, and overheating protection.
  • Misc
    • On/Off switch
    • Power LED
    • Charging LED
    • 4x battery-level LEDs
    • Header to monitor battery
  • Dimensions – 90 x 56 x 24 mm

Unboxing the PiPower

The Raspberry Pi UPS Power Bank can be purchased from the Sunfounder PiPower link.

The kit includes the PiPower board, a screwdriver, assorted screws, standoffs, and cable ties.

PiPower Parts


Additionally, there are short USB-C and micro USB cables, double-sided tape, an acrylic panel, a quick setup guide, and a battery.

The PiPower utilizes the IP2326 lithium battery charging integrated circuit. Its underside features a space for the battery, a 3-pin connector for battery input, a power toggle, a GPIO header for battery status tracking, and headers that offer access to 5V and GND, which can be used to energize other devices.

The GPIO provides the following signals

  • GND – Ground
  • BT_LV – Battery voltage pin. The voltage of this pin is equal to 1/3 of the battery voltage.
  • IN_DT – Input detect pin. Used to determine if there is USB power input, if so, this pin outputs high.
  • CHG – Charging status indication pin. This pin is high when charging.
  • LO_DT – Low voltage status pin. When the voltage is high enough, this pin is low, but when low battery voltage is detected, this pin is high.
  • EN – Switch signal pin. The EN pin can be connected to an external switch, so the PiPower is powered off when the pin is set to 0. The EN pin is only active when the PiPower is turned on.
  • GND – Ground
  • LED – Power indicator pin. Output 5V at power on. Note a resistor must be added when connecting an external LED.
  • GND – Ground

Assembly of PiPower

The Kit has an instruction manual that could help in assembling the Raspberry Pi Power Bank parts.

The Assembly process is very easy and would just take 5-10 minutes.

Once the assembly is done, the kit looks portable with a proper stand.

Raspberry Pi UPS Power Bank

The battery is attached to the board with a double-sided tape and covered with transparent acrylic.

You can solder 9-pin male header pins to the PiPower Board. These pins can be connected to the GPIO Pins of Raspberry Pi in case you wanna communicate about the Battery status with Raspberry Pi.




Battery Charging & Discharging Test

The Battery provided with “SunFounder UPS Power Supply for Raspberry Pi” has a Nominal Voltage of 7.4V with a capacity of 2000mAh. According to the manufacturer, the battery would last for 3-4 hours.

Therefore I conducted the Battery discharge test. Initially, I charged the battery to full. In order to discharge the battery I connected 2 high-power DC motors across the 5V & GND pin of Raspberry Pi.

I observed that the battery discharging took 3 hours and 15 minutes. In the end, the Raspberry Pi completely shut down. This test was conducted under heavy load conditions. The battery life would be better in case, the Raspberry Pi is operated on normal mode. Some tests conducted showed the battery life is for 4 hours under low to moderate use.

In order to charge the Battery, plug a 5V USB Cable into the Raspberry Pi Type C-port, and the battery charging will start. The charging power is 7W, and it takes about 2 hours to charge from 0% to 100%.

There are 4 LED indicators (D4 ~ D7) that indicate Battery Level.



How to Monitor the Battery with Blynk Server?

I’ve soldered a GPIO header onto the PiPower board to make use of its battery monitoring pins. The LO_DT pin will help in identifying when the battery voltage is low, the CHG pin will indicate if the battery is in charging mode, and the IN_DT pin will reveal if the power is connected. While the BT_LV pin can determine the battery level, it necessitates an extra ADC chip.

Monitor Battery Raspberry Pi

In order to monitor the PiPower Battery with Raspberry Pi, we need some GPIO Connections to the PiPower Kit as follows:

  • IN_DT to GPIO 23
  • CHG to GPIO 24
  • LO_DT to GPIO 25
  • GND to GND

To monitor the Battery status online, I choose Blynk Cloud Server.

Setting Up Blynk Application

Visit blynk.cloud and create a Blynk account on the Blynk website. Or you can simply sign in using the registered Email ID.

Click on +New Template.

Give any name to the Hardware such as “Battery_Monitor“. Choose the Hardware type as Raspberry Pi and the connection type as WiFi.

Now we need to set up Datastreams. Therefore Click on +New Datastreams and Select Virtual Pin.

Create datastreams for USB Power, Battery Charging, Low Battery, and Sufficient Charge and assign the virtual pins as V0, V1, V2 & V3 respectively.

Now go to the Dashboard section and set up the dashboard.

For USB Power, Battery Charging, Low Battery, and Sufficient Charge, link all the widgets with the datastreams and click on save.

Go to the Home and click on Add Device. Name the Device “Battery Monitor” and Click on Create.

After the device is successfully created, you will get the device ID and Authentication Token. The Authentication Token will be used in the code.



Python Code to Monitor Battery Status on Blynk

To monitor the battery data on Blynk Server, we need to develop a Python Code first.

Before going to the coding part, first, install a “Blynk Library“.

Go to Terminal and type the following command.

1
git clone https://github.com/vshymanskyy/blynk-library-python.git

Now open Thonny IDE, and copy the following code. Save the file inside the Blynk library Folder.

In this code, change the Blynk Authentication Token from your Blynk ID.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import BlynkLib
import RPi.GPIO as GPIO
from BlynkTimer import BlynkTimer  # Import BlynkTimer
 
BLYNK_AUTH_TOKEN = '**********************'      # Change the Blynk Auntentication Token here
 
# Define GPIO pins
IN_DT = 23
CHG = 24
LO_DT = 25
 
GPIO.setmode(GPIO.BCM)
GPIO.setup(IN_DT, GPIO.IN)
GPIO.setup(CHG, GPIO.IN)
GPIO.setup(LO_DT, GPIO.IN)
 
# Define Virtual Pins in Blynk App
USB_POWER_VPIN = 0
CHARGING_VPIN = 1
BATTERY_LOW_VPIN = 2
BATTERY_STATUS_VPIN = 3  # New virtual pin for battery status
 
# Initialize Blynk and BlynkTimer
blynk = BlynkLib.Blynk(BLYNK_AUTH_TOKEN)
timer = BlynkTimer()
 
# Function to update battery status on Blynk
def update_battery_status():
    if GPIO.input(IN_DT) == 1:
        blynk.virtual_write(USB_POWER_VPIN, 1)
        print('USB Power detected')
    else:
        blynk.virtual_write(USB_POWER_VPIN, 0)
        print('No USB power. Power failure?')
 
    if GPIO.input(CHG) == 1:
        blynk.virtual_write(CHARGING_VPIN, 1)
        print('Battery is charging...')
    else:
        blynk.virtual_write(CHARGING_VPIN, 0)
        print('Battery is not charging...')
 
    if GPIO.input(LO_DT) == 1:
        blynk.virtual_write(BATTERY_LOW_VPIN, 1)
        blynk.virtual_write(BATTERY_STATUS_VPIN, 0)  # 0 indicates low battery
        print('Low battery level detected!')
    else:
        blynk.virtual_write(BATTERY_LOW_VPIN, 0)
        blynk.virtual_write(BATTERY_STATUS_VPIN, 1)  # 1 indicates battery has sufficient charge
        print('The battery has sufficient charge.')
 
# This function will be called when Raspberry Pi connects to Blynk
@blynk.on("connected")
def blynk_connected():
    print("Raspberry Pi Connected to New Blynk")
    # Start a timer that calls update_battery_status every 5 seconds
    timer.set_interval(5, update_battery_status)
 
while True:
    blynk.run()
    timer.run()  # Run BlynkTimer to execute any scheduled tasks




Monitoring the Raspberry Pi UPS Battery

Run the above code, and observe the Thonny Shell.

The Thonny will show the following message when the Battery is not charging.

It will show the Battery is not charging and No USB Power is detected. If the battery charge is sufficient, it will show sufficient charge.

You may observe the same data on Blynk Dashboard.

When the Battery charge is sufficient, the Yellow indicator will light up.

While the Battery is charging through USB Power, it will show the following indications.

When the battery is low and in the discharging state, the Red lamp indicator will turn on.

You may unplug and plug the battery charger to observe the different lamp indications.


Similarly you may set up the “Blynk Mobile Dashboard” and observe the same thing.

Raspberry Pi UPS Power Bank with Battery Monitoring on Blynk

This is how you can monitor the battery using Raspberry Pi & use indications on Blynk Server or Blynk Dashboard.


Conclusion

In conclusion, the SunFounder UPS Power Supply for Raspberry Pi provides a holistic UPS solution suitable for Raspberry Pi 3/4 Model B/B+. Not only does the kit come complete with the PiPower board, a 2,000 mAh battery, and all required assembly tools, but it’s also versatile enough to work with boards of a similar size to Raspberry Pi that needs a 5V DC input. Throughout this article, we explored the unboxing, assembly, and testing process of this UPS Power Bank, delving into its functionalities. We also demonstrated how to use Python to send battery status data to the Blynk Server, ensuring users are always updated on USB power, charging status, charge sufficiency, and low battery warnings.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticlePWM Based DC Motor Speed Control using 555 Timer
Next Article How to use ADS1115 16-Bit ADC Module with Raspberry Pi

Related Posts

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

ADXL375 Accelerometer with Raspberry Pi Pico & MicroPython

Updated:July 24, 2025
Interface BMI160 with Raspberry Pi Pico & MicroPython

Interface BMI160 with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Shift Register 74HC595 with Raspberry Pi Pico & MicroPython

Updated:February 2, 202513K
Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Interfacing XBee Module with Raspberry Pi Pico & MicroPython

Updated:February 2, 20253K
Modbus RTU with Raspberry Pi Pico & Micropython

Modbus RTU with Raspberry Pi Pico & MicroPython

Updated:February 2, 20258K
Fever Detector with MLX90640 & OpenCV Raspberry Pi

Thermal Fever Detector with MLX90640 & OpenCV Raspberry Pi

Updated:February 2, 20256K
View 2 Comments

2 Comments

  1. Bettina Schönknecht on May 5, 2025 5:44 AM

    Hi. Your solution looks perfect. However, meanwhile is the v3 of the PiPower on the market (https://docs.sunfounder.com/projects/pipower3/en/latest/). Can I take the way provided in the video 1:1 also to new PiPower version?

    Reply
    • Andreas on May 8, 2025 7:30 AM

      I received the following reply fron SunFounders Support:

      The GPIO pins on PiPower 3 are extended GPIO pins from the Pi 4:
      PiPower IN_DT = GPIO17 Raspi PI4
      PiPower CHG = GPIO18 Raspi PI4
      PiPower LO_DT_PIN = GPIO27 Raspi Pi4
      PiPower GND = GND Raspi PI4

      Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • MAX30102 & Arduino: Heart Rate + Blood Oxygen Monitoring
    MAX30102 & Arduino: Heart Rate + Blood Oxygen Monitoring
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.