How to read the battery capacity via I2C on X750&725

From All for Raspberry Pi, Arduino, Lattepanda, Orange Pi, Pine64 | by Geekworm
Revision as of 18:21, 7 November 2019 by Admin (talk | contribs) (Created page with "This is the guide of how to read the battery capacity via I2C on X750&725: We test it base Raspbian Stretch system. Enable I2C function on the Raspbian sudo raspi-config S...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is the guide of how to read the battery capacity via I2C on X750&725:

We test it base Raspbian Stretch system.

Enable I2C function on the Raspbian

sudo raspi-config

Select '5 Interfacing Options' and then 'I2C - Enable/Disable automatic loading'. A prompt will appear asking 'Would you like the ARM I2C interface to be enabled?', select "Yes"

Once you have logged into your Raspberry Pi from the command line, run the following command to install i2c-tools

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

Download the required script

wget https://raw.githubusercontent.com/suptronics/x750_x725-script/master/x750.sh

Install the script

sudo bash x750.sh

Setting up the command to turn off X750 from software

printf "%s\n" "alias x750off='sudo x750shutdown.sh'" >> ~/.bashrc

Reboot the Raspberry Pi

sudo reboot

Reading battery voltage and percentage

sudo python x750ups.py

Powering off the Raspberry Pi from software

x750off