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 x708 setup scripts:
git clone https://github.com/geekworm-com/x708.git cd x708 chmod +x x708.sh
4. Install script&reboot:
sudo bash x708.sh printf "%s\n" "alias x708off='sudo x708softsd.sh'" >> ~/.bashrc sudo reboot
6. How to reading battery voltage and percentage, this is the sample code, you can modify it by your request.
sudo python x708bat.py
7. How to power off command on Raspbian from software
x708off
8. Testing AC power off/loss or power adapter failure detection (need to shor the 'PLD' pin)
sudo python x708pld.py
9. How to programming to get ASD function on V1.2 version
The following is fake C/C++ code:
while(1) { // You need to implement getCurrentVoltage function float fVoltage = getCurrentVoltage(); if (fVoltage <= 2.5) { //execute shut down command, "sudo x708off" break; } }Return to X708Enable comment auto-refresherAnonymous user #327 months agoScore 0Permalink |Anonymous user #2011 months agoScore 0Permalink |Anonymous user #3012 months agoScore 0Permalink |Anonymous user #3112 months agoScore 0PermalinkAnonymous user #2916 months agoScore 0Permalink |Lisa15 months agoScore 0PermalinkAnonymous user #2818 months agoScore 0Permalink |Cindy18 months agoScore 0PermalinkAnonymous user #2818 months agoScore 0PermalinkAnonymous user #2719 months agoScore 0Permalink |Lisa19 months agoScore 0PermalinkAnonymous user #2622 months agoScore 0Permalink |Anonymous user #2522 months agoScore 0Permalink |Anonymous user #2522 months agoScore 0Permalink |Anonymous user #2326 months agoScore 0Permalink |Lisa26 months agoScore 0PermalinkAnonymous user #2426 months agoScore 0PermalinkAnonymous user #2226 months agoScore 0Permalink |Lisa26 months agoScore 0PermalinkAnonymous user #2027 months agoScore 0Permalink |Anonymous user #2027 months agoScore 0PermalinkAnonymous user #2027 months agoScore 0Permalink |Anonymous user #2127 months agoScore 0PermalinkAnonymous user #1928 months agoScore 0Permalink |Anonymous user #1828 months agoScore 0Permalink |Lisa27 months agoScore 0PermalinkAnonymous user #1728 months agoScore 0Permalink |Anonymous user #1628 months agoScore 0Permalink |Lisa28 months agoScore 0PermalinkAnonymous user #1530 months agoScore 0Permalink |Lisa30 months agoScore 0PermalinkAnonymous user #1430 months agoScore 0Permalink |Harry30 months agoScore 0PermalinkHarry30 months agoScore 0PermalinkAnonymous user #1132 months agoScore 0Permalink |Anonymous user #1230 months agoScore 0PermalinkAnonymous user #1132 months agoScore 0Permalink |Anonymous user #1032 months agoScore 0Permalink |Anonymous user #1330 months agoScore 0PermalinkAnonymous user #1330 months agoScore 0PermalinkAnonymous user #934 months agoScore 0Permalink |Lisa34 months agoScore 0PermalinkAnonymous user #934 months agoScore 0Permalink |Harry34 months agoScore 0PermalinkAnonymous user #834 months agoScore 0Permalink |Lisa34 months agoScore 0PermalinkAnonymous user #735 months agoScore 0Permalink |Lisa35 months agoScore 0PermalinkAnonymous user #636 months agoScore 0Permalink |Lisa35 months agoScore 0PermalinkAnonymous user #539 months agoScore 0Permalink |Lisa35 months agoScore 0PermalinkAnonymous user #442 months agoScore 0Permalink |Xiali42 months agoScore 0PermalinkAnonymous user #343 months agoScore 0Permalink |Anonymous user #343 months agoScore 0PermalinkXiali43 months agoScore 0PermalinkHarry43 months agoScore 0Permalink |Georgefeichter45 months agoScore 0Permalink |Georgefeichter45 months agoScore 0Permalink |Anonymous user #145 months agoScore 0Permalink |Anonymous user #245 months agoScore 0Permalink