X1203-v1.0 Software & Configuration
This tutorial assumes you've already set up a Raspberry Pi with Raspbian12 (bookworm). For help installing the Debian-based OS on your Pi, check out the docs on Raspberrypi.org.
1.0 Editing the EEPROM Configuration
1.1
From the command line or Terminal window, start by running the following command:
Pi@raspberrypi ~ $ Sudo rpi-eeprom-config -e
Change the setting of POWER_OFF_ON_HALT from 0 to 1, and add PSU_MAX_CURRENT=5000 at the end of the file.

1.2
Reboot your Raspberry Pi to make the change take effect.
Pi@raspberrypi ~ $ Sudo reboot
2.0 Configuring the Raspberry Pi for I2C
2.1
From the command line or Terminal window, start by running the following command:
Pi@raspberrypi ~ $ Sudo raspi-config
This will launch the raspi-config utility. Select "Interfacing Options".

2.2
Highlight the “I2C” option and activate "<Select>".

2.3
Select and activate “<Yes>”.

2.4
Highlight and activate “<Ok>”.

2.5
Activate "<Finish>", this will exit the raspi-config utility.

2.6
Update your Pi and install the required dependencies.
Pi@raspberrypi ~ $ Sudo apt-get update
Pi@raspberrypi ~ $ Sudo apt-get upgrade -y
Pi@raspberrypi ~ $ Sudo apt-get install python3-pip
2.7
Download the required scripts.
Pi@raspberrypi ~ $ Git clone https://github.com/EDGECASE/x120x.git
2.8
Reboot the Raspberry Pi.
Pi@raspberrypi ~ $ Sudo reboot
The Raspberry Pi will reboot and the interface will be enabled.
2.9
Once you have logged into your Raspberry Pi from the command line, run the command to see all the connected devices.
Pi@raspberrypi ~ $ Sudo i2cdetect -y 1

#36 - the address of the battery fuel gauging chip
*The UPS connects to the Pi GPIO via pogo pins. If the I2C address (0x36) is not detected, please clear the leads of pin 3 and pin 5 on the GPIO header from the bottom of the Raspberry Pi PCB and install again.

3.0 Reading UPS Status
Command line for reading UPS status.
Pi@raspberrypi:~/x120x $ Sudo python3 merged.py

Desktop interface for reading UPS status.
Pi@raspberrypi:~/x120x $ Sudo python3 qtx120x.py

4.0 Manual Reading Battery Voltage & Percentage
4.1
Run the command to read battery voltage and percentage.
Pi@raspberrypi:~/x120x $ Sudo python3 bat.py
4.2
Change the battery low voltage to implement safe shutdown. Default is less than 3.20Vdc.
Pi@raspberrypi:~/x120x $ Sudo nano bat.py

Note: The voltage range must be 3.00~4.10vdc.
4.3
Save and exit. In nano, you do that by hitting CTRL + X, answering Y, and hitting Enter when prompted.
5.0 Manual Testing AC Power Loss or Power Adapter Failure Detection (PLD)
5.1
Execute the command to initiate power loss detection (PLD).
Pi@raspberrypi:~/x120x $ Sudo python3 pld.py
Disconnect the power adapter and observe the detection of the power loss.
6.0 Control Battery Charging
For advanced users only.
6.1
To disable battery charging.
Pi@raspberrypi ~ $ Pinctrl set 16 op dh
6.2
To enable battery charging.
Pi@raspberrypi ~ $ Pinctrl set 16 op dl
For further assistance or inquiries, please reach out to our support team at info@edgecase.shop or sales@edgecase.shop. We are here to help you with any questions you might have.