Open main menu

NOTE: The following operation is tested base on 2020-05-27-raspios-buster-full-armhf.img.

1. Enabled I2C support on the Raspbia.

sudo raspi-config

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

2. Install I2C-tools software package.

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

3. Download the required script

git clone https://github.com/geekworm-com/x750.git
cd x750
chmod +x x750.sh

4. Install&run the script

sudo bash x750.sh

This command will gernerate a new x750ups.py in the current path, in generay, the current path is /pi/home, please remember this path, you will use this file soon.

5. Setting up the command to turn off X750 from software

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

6. Test the safe shutdown command

x750off

7. How to read the battery voltage and percentage?

sudo python x750ups.py

NOTE: you can use the following command to search x750ups.py file if you don't know where this file is;

sudo find / -name x750ups.py
Add your comment
Geekworm Wiki welcomes all comments. If you do not want to be anonymous, register or log in. It is free.


Anonymous user #2

37 months ago
Score 0++

If you are getting the error: "IOError: [Errno 110] Connection timed out"

for x728bat.py, check and see no other programs are using GPIO3. I had a power button shutdown script that ran on startup to turn the pi off and it was preventing the HAT from reading that pin. I simply uninstalled and used the supported shutdown button feature for this board.

Anonymous user #1

39 months ago
Score 0++

Sorry, please delete the old posts. I've put all in one comment:


Hey, it seems, the volt percentage command doesn't work. This is my cli output:

root@raspberrypi:/home/pi# python x750ups.py File "x750ups.py", line 30 print "******************" ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("******************")?

please help.

oot@raspberrypi:/home/pi# python2 x750ups.py

Traceback (most recent call last): File "x750ups.py", line 31, in <module> print "Voltage:%5.2fV" % readVoltage(bus) File "x750ups.py", line 11, in readVoltage read = bus.read_word_data(address, 2) IOError: [Errno 110] Connection timed out

and: sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

is the gpio port defect?


of course following is set in config.txt: dtparam=i2c_arm=on dtparam=i2c1=on


i2c activated in raspi-conf

lsmod |grep i2c i2c_bcm2835 16384 0 i2c_bcm2708 16384 0

i2c_dev 20480 0

Anonymous user #3

21 months ago
Score 0++
You are using python version 3, parentheses should be used for it. Add them to the code or use python version 2

Anonymous user #1

39 months ago
Score 0++

I have to ad dtparam=i2c_arm=on dtparam=i2c1=on in config.txt

i2c activated in raspi-conf

Anonymous user #1

39 months ago
Score 0++

Hey, it seems, the volt percentage command doesn't work. This is my cli output:

root@raspberrypi:/home/pi# python x750ups.py File "x750ups.py", line 30 print "******************" ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("******************")?

please help

Anonymous user #1

39 months ago
Score 0++

root@raspberrypi:/home/pi# python2 x750ups.py

Traceback (most recent call last): File "x750ups.py", line 31, in <module> print "Voltage:%5.2fV" % readVoltage(bus) File "x750ups.py", line 11, in readVoltage read = bus.read_word_data(address, 2) IOError: [Errno 110] Connection timed out

and: sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

is the gpio port defect?