Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales@spotpear.com
dragon_manager@163.com
tech-support@spotpear.com
zhoujie@spotpear.com
WhatsApp:13246739196
This is a mini uninterruptible power supply (UPS) module that supports simultaneous charging and discharging. It can provide a stable 5V voltage output and supports I2C communication, allowing for access to information such as battery voltage, current, power, and charging status.
Pin | Function |
IN | Power input (5V 3A) |
OUT | UPS output (5V 2.5A) |
GND | ground |
UPS OFF | turn off the UPS power output when connected to the PWR pin |
BOOT | Batteries activation (pull low for 500ms and then pull high) |
CHARGE | Charge indication (low level indicates charging) |
SCL | I2C clock |
SDA | I2C data |
PWR | UPS ON/OFF (turn off UPS power output when connected to UPS OFF pin) |
Note 1: When initially connecting the battery, pay attention to whether the WARNING LED is on. If the LED is on, it indicates that the corresponding battery is connected reversely. Charging is prohibited when the battery is connected reversely.
Note 2: When initially connecting the battery, there may be no power output. Press the BOOT button on the circuit board to activate the battery protection chip and enable power output.
Note 3: To charge the product, use the power supply provided with the product. Using other power chargers may result in unstable power output with excessive ripple, which can damage the product.
Note 4: If the insulation pad on the positive electrode of the battery is removed or damaged, it is recommended not to continue using it as it can easily lead to a short circuit and fire. When removing the battery, avoid using a screwdriver to pry the positive electrode, as it can easily cause a short circuit. Instead, you should focus on prying the negative electrode of the battery.
Note: Here it only communicates with the host, if you want to charge and discharge, you need to connect IN and OUT.
UPS Module Pin | Raspberry Pi (BCM) |
GND | GND |
SDA | 2 |
SCL | 3 |
CHARGE | 4 |
sudo raspi-config Select Interfacing Options -> I2C -> Yes to enable the I2C interface
And then reboot the Raspberry Pi:
sudo reboot
Please make sure that the I2C is not occupied by other devices, you can check in the middle of /boot/config.txt.
#Open the Raspberry Pi terminal and run the following commands wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz tar zxvf bcm2835-1.71.tar.gz cd bcm2835-1.71/ sudo ./configure && sudo make && sudo make check && sudo make install # For more, you can refer to the official website at http://www.airspayce.com/mikem/bcm2835/
git clone https://github.com/WiringPi/WiringPi cd WiringPi ./build gpio -v # Run gpio -v and version 2.70 will appear, if it does not appear it means there is an installation error
#python2 sudo apt-get update sudo apt-get install python-pip sudo pip install RPi.GPIO sudo pip install smbus #python3 sudo apt-get update sudo apt-get install python3-pip sudo pip3 install RPi.GPIO sudo pip3 install smbus
Open the Raspberry Pi terminal and run the following commands:
sudo apt install unzip -y cd ~ sudo wget https://files.waveshare.com/upload/5/58/UPS_Module_Mini_Code.zip sudo unzip UPS_Module_Mini_Code.zip cd UPS_Module_Mini_Code/Raspberrypi/
Please run the following commands in the Raspberry Pi. Otherwise, you can not find the directory if it is not in the index.
cd ~/UPS_Module_Mini_Code/Raspberrypi/c/ sudo make clean sudo make -j sudo ./ups_module
d ~/UPS_Module_Mini_Code/Raspberrypi/python/ sudo python UPS_Module_Mini.py
# USELIB = USE_BCM2835_LIB # USELIB = USE_WIRINGPI_LIB USELIB = USE_DEV_LIB
# USELIB = USE_BCM2835_LIB USELIB = USE_WIRINGPI_LIB # USELIB = USE_DEV_LIB
Note: You need to reboot Raspberry Pi after using the BCM2835 library, otherwise you can't use Python and other libraries of C programs.
Note: Here it only communicates with the host, if you want to charge and discharge, you need to connect IN and OUT.
UPS Module Pin | Raspberry Pi Pico |
GND | GND |
SDA | 8 |
SCL | 9 |
CHARGE | 7 |
sudo apt install unzip -y cd ~ sudo wget https://files.waveshare.com/upload/5/58/UPS_Module_Mini_Code.zip unzip UPS_Module_Mini_Code.zip cd ~/UPS_Module_Mini_Code cd Pico/c/build/
cd ~/UPS_Module_Mini_Code/Pico/c/
Create and enter the build directory, and add the SDK: ../../pico-sdk is the directory of your SDK. There is a build in our sample application, just enter it directly.
cd build export PICO_SDK_PATH=../../pico-sdk (Note: Be sure to write the right path to your own SDK)
Execute cmake to automatically generate the Makefile file:
cmake ..
Execute make to generate the executable file, you may wait for a long time as it is the first time to be compiled.
make -j9
After compiling, uf2 file will generate. Press the button on the Pico board, Pico can connect to the USB port of the Raspberry Pi via a Micro USB cable, and then release the buttons. After connecting, Raspberry Pi will automatically identify a movable disk (RPI-RP2), and copy main.uf2 in the build file to the recognizable movable disk (RPI-RP2).
cp main.uf2 /media/pi/RPI-RP2/
To ensure your version that your version includes the package supported Pico, you can click Tools -> Options... -> Interpreter, and choose MicroPython (Raspberry Pi Pico and ttyACM0 port). As shown below:
If your current Thonny version has no package supporting Pico, you can enter the following commands to update Thonny IDE.
sudo apt upgrade thonny
3. Click File -> Open... -> ~/UPS_Module_Mini_Code/Pico/python/UPS_Module_Mini.py, and then run the script.
We provide a simple demo for you...
Note: Here it only communicates with the host, if you want to charge and discharge, you need to connect IN and OUT.
Module Pin | STM32F103RB |
GND | GND |
SDA | PB9 |
SCL | PB8 |
CHARGE | PB5 |
The demos are developed based on the HAL library.
Click to download the demo, unzip it, and open UPS_Module_Mini_Code\STM32\UPS_Module_Mini\MDK-ARM directory of UPS_Module_Mini.uvprojx to see the demo.
Open main.c, you can see the demo, and then recompile to download.
Note: The demos are tested on Arduino Uno, if you need to use other models of Arduino you need to make sure that the pins are connected correctly.
Note: Here only communicate with the host, if you want to charge and discharge, you need to connect IN and OUT.
UPS Module Pin | Arduino uno |
GND | GND |
SDA | SDA |
SCL | SCL |
CHARGE | 4 |
Click to download the demo, and unzip it. Note the demo is in UPS_Module_Mini_Code\Arduino\UPS_Module_Mini.
Install the Arduino IDE, and then run the UPS_Module_Mini.ino file.
Open the program, and select the development board as Arduino UNO.
Select the corresponding port.
And then click to compile and download.
Monday-Friday (9:30-6:30) Saturday (9:30-5:30)
Email: services01@spotpear.com