The following test is base on '2020-02-13-raspbian-buster.img'
Python version: V2.7
1. Enable I2C funcion on Raspbian:
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 "Finish" to return to the command line and reboot your raspberry pi.
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_v1.2.py
sudo pyton /home/pi/x728bat_v1.2.py
we add a new python script file (x728bat_v1.3.py) to implement automatic shutdown function when the battery is low voltage due to the hardware ASD function is remove in X728 V1.3, in fact this script also fit to x728 old version,
You can found this x728bat_v1.3.py file in /home/pi/x728 folder after you execute the command git clone successfully.
User Guide: https://github.com/geekworm-com/x728 to know more details;
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