Difference between revisions of "How to read the battery capacity via I2C on X750&725"

From All for Raspberry Pi, Arduino, Lattepanda, Orange Pi, Pine64 | by Geekworm
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{GD Template Impl}}
 +
 
This is the guide of how to read the battery capacity via I2C on X750&725:
 
This is the guide of how to read the battery capacity via I2C on X750&725:
  
We test it base Raspbian Stretch system.
+
We test it base '''Raspbian Stretch''' system.
  
Enable I2C function on the Raspbian
+
1. Enable I2C function on the Raspbian
 
  sudo raspi-config
 
  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'''"
 
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
+
[[File:Geekworm-i2c-1.png|none]]
 +
 
 +
[[File:Geekworm-raspi-config.png|none]]
 +
 
 +
2. 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 python-smbus
 
  sudo apt-get install i2c-tools
 
  sudo apt-get install i2c-tools
  
Download the required script
+
3. Download the required script
 
  wget https://raw.githubusercontent.com/suptronics/x750_x725-script/master/x750.sh
 
  wget https://raw.githubusercontent.com/suptronics/x750_x725-script/master/x750.sh
  
Install the script
+
4. Install the script
 
  sudo bash x750.sh
 
  sudo bash x750.sh
  
Setting up the command to turn off X750 from software
+
5. Setting up the command to turn off X750 from software
 
  printf "%s\n" "alias x750off='sudo x750shutdown.sh'" >> ~/.bashrc
 
  printf "%s\n" "alias x750off='sudo x750shutdown.sh'" >> ~/.bashrc
  
Reboot the Raspberry Pi
+
6. Reboot the Raspberry Pi
 
  sudo reboot
 
  sudo reboot
  
Reading battery voltage and percentage
+
7. Reading battery voltage and percentage
 
  sudo python x750ups.py
 
  sudo python x750ups.py
  
Powering off the Raspberry Pi from software
+
8. Powering off the Raspberry Pi from software
 
  x750off
 
  x750off
 +
 +
<!--增加评论功能! -->
 +
<comments />
 +
 +
<!--请选择合适的分类,多余的分类请删除; -->
 +
 +
[[Category:Product Manual]]
 +
[[Category:Raspberry pi]]

Latest revision as of 18:27, 7 November 2019


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

We test it base Raspbian Stretch system.

1. 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"

Geekworm-i2c-1.png
Geekworm-raspi-config.png

2. 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

3. Download the required script

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

4. Install the script

sudo bash x750.sh

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

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

6. Reboot the Raspberry Pi

sudo reboot

7. Reading battery voltage and percentage

sudo python x750ups.py

8. Powering off the Raspberry Pi from software

x750off
Add your comment
All for Raspberry Pi, Arduino, Lattepanda, Orange Pi, Pine64 | by Geekworm welcomes all comments. If you do not want to be anonymous, register or log in. It is free.