From Geekworm
Jump to navigation Jump to search

The following test is base on '2020-02-13-raspbian-buster.img'

Python version: V2.7

1. Enable I2C funcion on Raspbian:

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"


Select "OK"

Select "Finish" to return to the command line and reboot your raspberry pi.

sudo reboot

2. Install necessary software (python and i2c tool library)

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

3. Download x728 setup scripts:

git clone https://github.com/geekworm-com/x728.git
cd x728

4. Install script&reboot:

sudo bash x728.sh
printf "%s\n" "alias x728off='sudo x728softsd.sh'" >> ~/.bashrc 
sudo reboot

5. Set and Read the RTC time

#If you need to set the system time for any reason you can use the following command :  
date -s "5 MAR 2019 13:00:00"
#Write the system date and time to the RTC module after your correct the system date and time :  
sudo hwclock -w
#Read the date and time back from the RTC module:  
sudo hwclock -r

6. How to reading battery voltage and percentage, this is the sample code, you can modify it by your request.

sudo python x728bat.py

7. Power off command on Raspbian from software


8. Testing AC power off/loss or power adapter failure detection (need to shor the 'PLD' pin)

sudo python x728pld.py

Return to X728

Add your comment
Geekworm welcomes all comments. If you do not want to be anonymous, register or log in. It is free.