Open main menu

Although this installation tutorial is still available, but we strongly recommend that you use X708-script new tutorial, and we no longer maintain this page.


For Raspberry Pi OS

  • Test is base on '2022-04-04-raspios-buster-armhf.img' and x708 v2.0 on Apr. 27th, 2022;
  • Testing is base on '2022-01-28-raspios-bullseye-armhf.img' on Feb. 28th, 2022;

1. Enable I2C funcion on Raspbian;

Please refer to How to enable I2C

2. Updatesoftware and install necessary software (python and i2c tool library)

sudo apt-get update
#sudo apt-get install python-smbus
sudo apt-get install python3-smbus python3-rpi.gpio
sudo apt-get install i2c-tools 

3. Check if the i2c of the X708 is connected correctly

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

‘36' is the address of the battery fuel gauging chip, and 36 is a hexadecimal number

If you can't find i2c address 36, it means the X708 is not connected properly, or your raspberry pi board is broken.

3.1. Download x708 setup scripts:

cd ~
git clone https://github.com/geekworm-com/x708v2

This command will download the script installation file for X708

4. Install the script for power management

4.1 Enters the corresponding operating system scripts folder (raspberry-pi-os)

cd ~/x708v2/raspberry-pi-os/

4.2 Execute the installation script.

sudo bash pwr.sh

This command will generate 2 power management script files as follows:

  • /etc/x708pwr.sh
  • /usr/local/bin/x708softsd.sh

4.3 Create an alias x708off so that we can perform software shutdown from the command line, you can also change x708off to any name you like

printf "%s\n" "alias x708off='sudo x708softsd.sh'" >> ~/.bashrc
sudo reboot
Or force press the button of x708 for 8 seconds to shut down and then restart

4.4 Test software shutdown from command line after restart.

x708off

4.5 Press on-board button or external switch to test hardware safe shutdown

Press the switch for about 3 seconds until the power indicator flashes to execute hardware safe shutdown.

[NOTE]:

  • After shutdown, press the onboard switch or external switch to turn on.
  • If your test fails, it means that your installation failed, or the software environment is incorrect, please check whether you have installed the corresponding software package.

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

cd ~/x708v2/raspberry-pi-os/
sudo python3 bat.py 
******************
Voltage: 4.18V
Battery:  100%
Battery FULL
******************
Voltage: 4.17V
Battery:  100%
Battery FULL
******************
Voltage: 4.18V
Battery:  100%
Battery FULL
******************
Voltage: 4.17V
Battery:  100%
Battery FULL
******************
  • In generally, you need to let the X708 fully charge and discharge several times before you can get more accurate voltage and power values.
  • This script can also perform safe shutdown at specified voltage threshold (default voltage threshold is 3.00vdc), you can also modify this voltage threshold, but the voltage threshold range must be 2.5~4.1vdc.

6. Testing AC power off/loss or power adapter failure detection (PLD function)

cd ~/x708v2/raspberry-pi-os/
sudo python3 pld.py 
 1.Make sure your power adapter is connected
 2.Disconnect and then connect the power adapter again to test
 3.When power adapter disconnected, you will see: AC Power Loss or Power Adapter Failure
 4.When power adapter reconnected, you will see: AC Power OK, Power Adapter OK
 Testing Started---AC Power Loss OR Power Adapter Failure---
 ---AC Power OK,Power Adapter OK---
 ---AC Power Loss OR Power Adapter Failure---
 ---AC Power OK,Power Adapter OK---

7. Test Auto shutdown when AC power loss or power adapter failure

cd ~/x708v2/raspberry-pi-os/
sudo python3 plsd.py 
Testing Started---AC Power Loss OR Power Adapter Failure---
Shutdown in 5 seconds
Connection closing...Socket close.

In fact, you can refer to this example code to implement your own shutdown logic. . . This requires you to have some python programming foundation.

8. Advanced use of speed regulation for non-pwm fans

The X708 hardware supports two fan speeds: low speed (default) and high speed; if you want the fan to run at high speed, you need to run the fan.py script.

cd ~/x708v2/raspberry-pi-os/
python3 fan.py

fan.py provides a method that can switch the fan speed.

It should be noted that the x708 does not use a PWM fan, it only supports two speed modes (low speed and high speed). In the fan.py file, the speed mode of the fan is controlled by reading the temperature of the CPU in real time. You need to read the fan.py code to understand more logic.

You can control the fan running at high speed or low speed via modify the CPU temperature threshold in fan.py script file (yellow highlight line)

#!/usr/bin/env python3

import subprocess
import time

from gpiozero import OutputDevice


ON_THRESHOLD = 55  # (degrees Celsius) Fan running at high speed at this temperature.
OFF_THRESHOLD = 50  # (degress Celsius) Fan running at low speed  at this temperature.
SLEEP_INTERVAL = 5  # (seconds) How often we check the core temperature.
GPIO_PIN = 16  # Which GPIO pin you're using to control the fan. DON'T change it!


def get_temp():
    """Get the core temperature.
    Run a shell script to get the core temp and parse the output.

[PS]

  • If you can't understand, please ignore this step. Because the X708 fan will run at low speed by default, this cooling capacity is sufficient.
  • If you have full control over the runing of the fan, you need to run 'python3 /home/pi/x708v2/raspberry-pi-os/fan.py', and you need to create a crontab job also, and then put this run command ('@reboot python3 /home/XX/x708v2/raspberry-pi-os/fan.py 'XX' is your username, you need replace it with your username.') into the job, so that the command will run automatically when the device restarts. refer to X708-Software#FAQ

9. Uninstall

cd ~/x708v2/raspberry-pi-os/
sudo bash uninstall.sh

10. About AUTO ON

After shutting down, you need to wait about 60 seconds until the battery capacity indicator of X708 goes out, otherwise the AUTO ON function may be invalid. Because the charge remaining in the power adapter may affect the AUTO ON function.

For Ubuntu

Base ubuntu-mate-20.04.1-desktop-armhf+raspi.img

1. Enable I2C


2. update & upgrade

sudo apt update
sudo apt upgrade

3. Install necessary software

sudo apt install git python python3 python3-smbus python3-rpi.gpio python-rpi.gpio wiringpi -y

4.Download x708 setup scripts:

git clone https://github.com/geekworm-com/x708.git
cd x708
chmod +x *.sh
sudo bash install-ubuntu.sh
sudo reboot

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

sudo python3 x708bat.py

6. How to power off command on ubuntu from software

x708off
* press button 1-2 seconds to reboot
* press button 3 seconds to safe shutdown,
* press 7-8 seconds to force shutdown.

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

sudo python3 x708pld.py

8. Uninstall

./uninstall-ubuntu.sh

FAQ

Q1: How to make a script run automatically after boot?

A: Refer to How to add crontab job

Return to X708


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 #32

13 months ago
Score 0  

Hello, is there any way to setup the x708off to be operable using a webserver

specifically a php lightttpd server (raspap)

I want to integrate it with raspap so I can turn my pi off using the webservice of raspap and not need to ssh to give the x708off command
 

Anonymous user #20

17 months ago
Score 0  

x708, x862 (NGFF, WD SA510), two 18650 batteries, and a metal pushbutton switch latching are in use.

1. If this package device is left unused, the battery will be completely discharged. The power switch does not operate when the adapter is connected to the x802 boarder.

So when I remove the power cord of the battery holder from the x708 boarder and reconnect it, it charges and works.

However, the software does not boot. A Linux file system error and a disk error of M.2 NGFF on this x862 boarder occur.

2. It also causes an I/O error, making it impossible to format M.2 as well. It becomes physically unusable.

This problem repeats itself.
 

Anonymous user #30

18 months ago
Score 0  

I would like to understand how the X708 achieves a proper shutdown before removing power. When I look at the python scripts it appears to just kill power after toggling GPIO 13, simulating a button press of > 3 seconds.

I am try to use the X708 on MotionEye OS which is a stripped down version of Raspbian and write my own scripts. I would like to understand how the X708 uses GPIO 5, 12, and 13 so that I can monitor GPIO 6 and gracefully power down after a number of minutes.

Do I turn 13 high for 3 seconds and then X708pwr.sh will see GPIO 5 trigger and do a graceful power down?
 

Anonymous user #31

18 months ago
Score 0  
I just thought about the same thing. But according to my testing the software shutdown that is done via GPIO 13 actually triggers the x708pwr.sh script with GPIO 5 and performs a safe shutdown before cutting off power.
 

Anonymous user #29

22 months ago
Score 0  
Is the x708v2 software compatible with the X708 V1.2? What's the best way to update the older x708 script? uninstalling the old one with the unstall.sh script and installing the x708v2 software?
 

Lisa

21 months ago
Score 0  

Hi,The X708 software is compatible with X708 V1.2 and V2.0.

X708 V2.0 Version board is updated,but script is not change.
 

Anonymous user #28

24 months ago
Score 0  

Hey, When the main power is down, I want the Raspberry pi to show a message, close some programs safely, and then shut down. Then, once I connect the main power again, the pi turns on automatically. That means I don't want to interact with the onboard button since the pi will be closed in a case. I referred to the Hardware documentation and could enable the automatic switch on when I connect the power, but that only happens when the X708 hat is off.

My problem now is how to switch the hat OFF through the software so that when I connect the power again, the pi will automatically turn on. I referred to the Software documentation, followed the directions, and repeated many times, but the "x708off" doesn't switch the hat OFF. When I run it on the command line, I get "X708 Shutting down..." but the x708 is still ON even after the command finishes running. I uninstalled and reinstalled the files many times, but the same thing happened every time.

I2C is enabled, and I can detect when the power is lost, but I can't switch off the x708 or shut down the pi. When I run "plsd.py", it gets stuck at "Shutdown in 5 seconds", but it never shuts down.

I appreciate your help,

I'm using Raspbian GNU/Linux 10 (buster) on raspberry pi 4
 

Cindy

24 months ago
Score 0  
Hi friend, we have done the test with the Raspberry Pi OS you provided,the X708 turn off after run the x708off, there is no issue, we suggest you do uninstall and reinstall the OS and shell script to test again, thanks!
 

Anonymous user #28

24 months ago
Score 0  

Yes, thank you for your time and assistance.

After some tests and comparing multiple variables, I managed to fix the problem in my original SD card. What worked for me was moving everything extra on the "/etc/rc.local" file to somewhere else and only keeping "/etc/x708pwr.sh &". Apparently, there was an error related to the "rc.local" file.
 

Anonymous user #27

25 months ago
Score 0  

Hi, how is evaluated the battery level ? I put 2 fully charged battery on the x708v2 but it considered they where 0%, so they have been charge for hours, and maybe overcharged !

Now battery make the x708 to bug. The battery failed led is blinking while power supply is connected.

How to calibrate the battery level mesure ?

Thanks
 

Lisa

25 months ago
Score 0  

Hi

Please check whether the positive and negative poles of the battery are correctly installed, if you use 18650 batteries.

Replace other batteries to test.
 

Anonymous user #26

28 months ago
Score 0  
unfortunately your node-red flow seem to have a syntax-error... Would you please provide it once more? i am very curious, how you did the node-red implementation. Thanks!
 

Anonymous user #25

28 months ago
Score 0  

Sorry, something went wrong while copying. Here is the node-red flow again:

[{"id":"b6e375dca488451c","type":"rpi-gpio in","z":"4f0f7e9b873ed151","name":"GPIO6 AC-Power","pin":"6","intype":"tri","debounce":"25","read":false,"bcm":true,"x":230,"y":1290,"wires":"2e6d1c8dd9466d21"},{"id":"9153e12fa19c8a01","type":"comment","z":"4f0f7e9b873ed151","name":"Raspi4 GPIO6 Power-Status","info":"","x":190,"y":1240,"wires":[]},{"id":"2e6d1c8dd9466d21","type":"change","z":"4f0f7e9b873ed151","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"Stromausfall","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"Power OK","tot":"str"},{"t":"move","p":"payload","pt":"msg","to":"statustext","tot":"msg"},{"t":"set","p":"location","pt":"msg","to":"Raspi 4 ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1290,"wires":"b161f6101e10d6e1","b9e74652d1f4361e"},{"id":"74050275ae9b637f","type":"i2c scan","z":"4f0f7e9b873ed151","name":"","busno":"1","x":410,"y":1170,"wires":[[],["c89c48fb592feec1"]]},{"id":"5e202a022d0a2c9b","type":"inject","z":"4f0f7e9b873ed151","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230,"y":1170,"wires":"74050275ae9b637f"},{"id":"c89c48fb592feec1","type":"debug","z":"4f0f7e9b873ed151","name":"I2C-Scan","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":1170,"wires":[]},{"id":"59b8bddf8ad93388","type":"rpi-gpio in","z":"4f0f7e9b873ed151","name":"GPIO16","pin":"16","intype":"tri","debounce":"25","read":false,"bcm":true,"x":210,"y":1570,"wires":"d23af81852163f35"},{"id":"ff66b95250fe7ee3","type":"comment","z":"4f0f7e9b873ed151","name":"Raspi4 GPIO16 fan speed: 1 => fast, 0 => slow ","info":"","x":250,"y":1520,"wires":[]},{"id":"c2201db341984359","type":"i2c in","z":"4f0f7e9b873ed151","name":"","busno":"1","address":"54","command":"","count":"2","x":510,"y":1430,"wires":"62a377fb8b7c616f"},{"id":"62a377fb8b7c616f","type":"buffer-parser","z":"4f0f7e9b873ed151","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint16le","name":"result","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":660,"y":1430,"wires":"93c23bb720a9407c"},{"id":"93c23bb720a9407c","type":"function","z":"4f0f7e9b873ed151","name":"","func":"var result = Number (msg.payload.result);\n\nmsg.payload = {};\nif (msg.command == 2) {\n msg.payload.voltage = Number ((result * 78.125 / 1000000).toFixed(2));\n node.status({fill:\"green\",shape:\"dot\",text: \"voltage: \" + msg.payload.voltage + \" V,\"})\n}\n\nif (msg.command == 4) {\n msg.payload.capacity = Number((result /256).toFixed(1));\n if (msg.payload.capacity > 100){\n msg.payload.capacity = 100\n }\n node.status({fill:\"green\",shape:\"dot\",text: \"capacity: \" + msg.payload.capacity + \" %\"})\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":1430,"wires":"1a9cac3985983151"},{"id":"dc01f23d42cf45bd","type":"inject","z":"4f0f7e9b873ed151","name":"voltage: msg.command = > 2","props":[{"p":"command","v":"2","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":290,"y":1410,"wires":"c2201db341984359"},{"id":"ae2b5963a5f78976","type":"inject","z":"4f0f7e9b873ed151","name":"capacity: msg.command => 4","props":[{"p":"command","v":"4","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":300,"y":1450,"wires":"c2201db341984359"},{"id":"1a9cac3985983151","type":"debug","z":"4f0f7e9b873ed151","name":"battery","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":960,"y":1430,"wires":[]},{"id":"d23af81852163f35","type":"function","z":"4f0f7e9b873ed151","name":"","func":"if (msg.payload == 1) {\n msg.payload = \"fan speed: fast\"\n node.status({fill:\"red\",shape:\"dot\",text: msg.payload})\n}\n\nif (msg.payload == 0) {\n msg.payload = \"fan speed: slow\"\n node.status({fill:\"green\",shape:\"dot\",text: msg.payload})\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":1570,"wires":"6c72a981c041ee07"},{"id":"85351224cc71914a","type":"comment","z":"4f0f7e9b873ed151","name":"Raspi4 read votage/capacity","info":"","x":190,"y":1360,"wires":[]},{"id":"e8bb816803904e9e","type":"comment","z":"4f0f7e9b873ed151","name":"I2C Bus scan","info":"","x":140,"y":1120,"wires":[]},{"id":"6c72a981c041ee07","type":"debug","z":"4f0f7e9b873ed151","name":"fan speed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":520,"y":1570,"wires":[]},{"id":"b9e74652d1f4361e","type":"debug","z":"4f0f7e9b873ed151","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"statustext","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":1290,"wires":[]}]
 

Anonymous user #25

28 months ago
Score 0  

For Geeworm UPS HAT: Here is my flow in node-red for reading the battery voltage and capacity as well as fan speed and power status. Required nodes: node-red-contrib-buffer-parser node-red-contrib-i2c node-red-node-pi-gpio

[{"id":"b6e375dca488451c","type":"rpi-gpio in","z":"4f0f7e9b873ed151","name":"GPIO6 AC-Power","pin":"6","intype":"tri","debounce":"25","read":false,"bcm":true,"x":230,"y":1290,"wires":"2e6d1c8dd9466d21"},{"id":"9153e12fa19c8a01","type":"comment","z":"4f0f7e9b873ed151","name":"Raspi4 GPIO6 Power-Status","info":"","x":190,"y":1240,"wires":[]},{"id":"2e6d1c8dd9466d21","type":"change","z":"4f0f7e9b873ed151","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"Stromausfall","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"Power OK","tot":"str"},{"t":"move","p":"payload","pt":"msg","to":"statustext","tot":"msg"},{"t":"set","p":"location","pt":"msg","to":"Raspi 4 ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1290,"wires":"b161f6101e10d6e1","b9e74652d1f4361e"},{"id":"74050275ae9b637f","type":"i2c scan","z":"4f0f7e9b873ed151","name":"","busno":"1","x":410,"y":1170,"wires":[[],["c89c48fb592feec1"]]},{"id":"5e202a022d0a2c9b","type":"inject","z":"4f0f7e9b873ed151","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230,"y":1170,"wires":"74050275ae9b637f"},{"id":"c89c48fb592feec1","type":"debug","z":"4f0f7e9b873ed151","name":"I2C-Scan","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":1170,"wires":[]},{"id":"59b8bddf8ad93388","type":"rpi-gpio in","z":"4f0f7e9b873ed151","name":"GPIO16","pin":"16","intype":"tri","debounce":"25","read":false,"bcm":true,"x":210,"y":1570,"wires":"d23af81852163f35"},{"id":"ff66b95250fe7ee3","type":"comment","z":"4f0f7e9b873ed151","name":"Raspi4 GPIO16 fan speed: 1 => fast, 0 => slow ","info":"","x":250,"y":1520,"wires":[]},{"id":"c2201db341984359","type":"i2c in","z":"4f0f7e9b873ed151","name":"","busno":"1","address":"54","command":"","count":"2","x":510,"y":1430,"wires":"62a377fb8b7c616f"},{"id":"62a377fb8b7c616f","type":"buffer-parser","z":"4f0f7e9b873ed151","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint16le","name":"result","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":660,"y":1430,"wires":"93c23bb720a9407c"},{"id":"93c23bb720a9407c","type":"function","z":"4f0f7e9b873ed151","name":"","func":"var result = Number (msg.payload.result);\n\nmsg.payload = {};\nif (msg.command == 2) {\n msg.payload.voltage = Number ((result * 78.125 / 1000000).toFixed(2));\n node.status({fill:\"green\",shape:\"dot\",text: \"voltage: \" + msg.payload.voltage + \" V,\"})\n}\n\nif (msg.command == 4) {\n msg.payload.capacity = Number((result /256).toFixed(1));\n if (msg.payload.capacity > 100){\n msg.payload.capacity = 100\n }\n node.status({fill:\"green\",shape:\"dot\",text: \"capacity: \" + msg.payload.capacity + \" %\"})\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":1430,"wires":"1a9cac3985983151"},{"id":"dc01f23d42cf45bd","type":"inject","z":"4f0f7e9b873ed151","name":"voltage: msg.command = > 2","props":[{"p":"command","v":"2","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":290,"y":1410,"wires":"c2201db341984359"},{"id":"ae2b5963a5f78976","type":"inject","z":"4f0f7e9b873ed151","name":"capacity: msg.command => 4","props":[{"p":"command","v":"4","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":300,"y":1450,"wires":"c2201db341984359"},{"id":"1a9cac3985983151","type":"debug","z":"4f0f7e9b873ed151","name":"battery","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":960,"y":1430,"wires":[]},{"id":"d23af81852163f35","type":"function","z":"4f0f7e9b873ed151","name":"","func":"if (msg.payload == 1) {\n msg.payload = \"fan speed: fast\"\n node.status({fill:\"red\",shape:\"dot\",text: msg.payload})\n}\n\nif (msg.payload == 0) {\n msg.payload = \"fan speed: slow\"\n node.status({fill:\"green\",shape:\"dot\",text: msg.payload})\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":1570,"wires":"6c72a981c041ee07"},{"id":"85351224cc71914a","type":"comment","z":"4f0f7e9b873ed151","name":"Raspi4 read votage/capacity","info":"","x":190,"y":1360,"wires":[]},{"id":"e8bb816803904e9e","type":"comment","z":"4f0f7e9b873ed151","name":"I2C Bus scan","info":"","x":140,"y":1120,"wires":[]},{"id":"6c72a981c041ee07","type":"debug","z":"4f0f7e9b873ed151","name":"fan speed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":520,"y":1570,"wires":[]},{"id":"b9e74652d1f4361e","type":"debug","z":"4f0f7e9b873ed151","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"statustext","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":1290,"wires":[]}]
 

Anonymous user #23

32 months ago
Score 0  
Could you explain what does enabling high state on GPIO13 does on v1.2 board? There is no schematic of the board.
 

Lisa

32 months ago
Score 0  

Hi,

GPIO13 for power management;please referX708-Hardware
 

Anonymous user #24

32 months ago
Score 0  

Lisa,

I know it's for power management. The x708softsd.sh script uses GPIO13 to perform a software shutdown. The question is: how? Does it just turn off the power on the board or does it somehow emulate the pressing of the button (GPIO5) and the proper shutdown is then performed by the x708pwr.sh script?
 

Anonymous user #22

32 months ago
Score 0  

When I enable I2C in raspi-config I get this: modprobe: FATAL: Module i2c-dev not found in directory /lib/modules/5.10.92-v8+

This command: sudo apt-get install python-smbus

throws this: Package python-smbus is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'python-smbus' has no installation candidate
 

Lisa

32 months ago
Score 0  

Hi,

you can refer 【Anonymous user #17】

please try to [sudo apt-get install python3-smbus] to test.
 

Anonymous user #20

33 months ago
Score 0  

It is said that if you press the button for 3 seconds using the button, it will be safe shutdown.

I'm curious about the Python file or sh file that executes this.
 

Anonymous user #20

33 months ago
Score 0  

now. press the button 3 second => safe shutdown => power down

I want to know how to executes this on rasp from software code

like software x708off.
 

Anonymous user #20

33 months ago
Score 0  

6. How to power off command on ubuntu from software

x708off

  • press button 1-2 seconds to reboot
  • press button 3 seconds to safe shutdown,
  • press 7-8 seconds to force shutdown.
where can i set the code described above?
 

Anonymous user #21

33 months ago
Score 0  
Hi, I don't understand your questions, and requires you to have some basic knowledge of computers
 

Anonymous user #19

34 months ago
Score 0  
Just wanted to say that forcing things to /home/pi/ might not be the best idea in the world, especially if folks us something other than the Pi user account on the device. Might not hurt to put them somewhere else, then add wherever you put it to the path. I'm specifically talking about the x708bat.py and x708pid.py commands.
 

Anonymous user #18

34 months ago
Score 0  

Do I have to run python3 /home/pi/x708/x708asd.py & always at startup manually or does this happen automatically in the background to get ASD? I have no desktop environment - how to make this script run in the background via SSH? I have the X807 v.1.2 - as far as I can see there are no PLD pins to shorten. Can I run the AC power off/loss script anyway? Gives me currently an error: Traceback (most recent call last): File "/home/pi/x708pld.py", line 20, in <module> raw_input("Testing Started")

NameError: name 'raw_input' is not defined
 

Lisa

33 months ago
Score 0  

Hello,

please refer to X708-Software#FAQ.
 

Anonymous user #17

34 months ago
Score 0  

On Raspberry Pi OS Lite Kernel version: 5.10, Release date: October 30th 2021 the following command didn't work:

sudo apt-get install python-smbus

Package python-smbus is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'python-smbus' has no installation candidate

It's probably because I use Python 3.x - so it worked with:

sudo apt-get install python3-smbus
 

Anonymous user #16

34 months ago
Score 0  
I want a safe shutdown on button press but your code commands 'poweroff' - could you advise on the changes to replace this with 'shutdown now' so everything has time to shutdown correctly?
 

Lisa

34 months ago
Score 0  

Hi,

The script command we provide is 'x708off'----editable;

'poweroff' is a kernel command.
 

Anonymous user #15

36 months ago
Score 0  

Hello, I installed the x708 software as indicated, on a Raspberry Pi 4. I got the following error, after the following command. Is there any way to fix this? Thanks

pi@rachel:~ $ python x708bat.py

Traceback (most recent call last): File "x708bat.py", line 25, in <module> print ("Voltage:%5.2fV" % readVoltage(bus)) File "x708bat.py", line 9, in readVoltage read = bus.read_word_data(address, 2)

IOError: [Errno 121] Remote I/O error
 

Lisa

36 months ago
Score 0  
Hello, Please try to 【python3 x708bat.py】 and test it
 

Anonymous user #14

36 months ago
Score 0  

There are some problems in the python code with the actully raspberry pi os (raspbian).

If i want to use ``` sudo python3 x708bat.py ``` The system calls: ``` File "/home/pi/x708bat.py", line 24 print "******************" ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("******************")? ```

If I change it to print(*******) i had the follow error:

``` File "/home/pi/x708bat.py", line 25 print "Voltage:%5.2fV" % readVoltage(bus) ^ SyntaxError: invalid syntax

```

Any idea how I can fix that?

Thx!
 

Harry

36 months ago
Score 0  

The syntax of print in python2 and python3 is different, so there will be this error, you can run the following command: python2 x708bat.py or

python x708bat.py
 

Harry

36 months ago
Score 0  

I have just modify the install.sh for the python 3 because of print function.

You can update the install.sh, run the command 'git pull', then run './uninstall.sh' to uninstall, then reinstall it.
 

Anonymous user #11

38 months ago
Score 0  

python3 x708pld.py 1.Make sure your power adapter is connected 2.Disconnect and connect the power adapter to test 3.When power adapter disconnected, you will see: AC Power Loss or Power Adapter Failure 4.When power adapter reconnected, you will see: AC Power OK, Power Adapter OK Traceback (most recent call last): File "/root/x708pld.py", line 20, in <module> raw_input("Testing Started")

NameError: name 'raw_input' is not defined
 

Anonymous user #12

36 months ago
Score 0  
just replace to input() for python3
 

Anonymous user #11

38 months ago
Score 0  

python3 x728bat.py File "/root/x728bat.py", line 20 print "******************" ^

SyntaxError: Missing parentheses in call to 'print'. Did you mean print("******************")?
 

Anonymous user #10

38 months ago
Score 0  

Dear Geekworm team, I just set up successfully the X708 board and installedt he software. However, I get the following error at step 6 (on Raspbian) when I try to read the battery level. Any idea?

pi@raspberrypi:~ $ sudo python x708bat.py Traceback (most recent call last): File "x708bat.py", line 21, in <module> bus = smbus.SMBus(1) # 0 = /dev/i2c-0 (port I2C0), 1 = /dev/i2c-1 (port I2C1)

IOError: [Errno 2] No such file or directory
 

Anonymous user #13

36 months ago
Score 0  

I have the same issue. Geekworm team, please help us

" $ sudo python x708bat.py Traceback (most recent call last): File "x708bat.py", line 21, in <module> bus = smbus.SMBus(1) # 0 = /dev/i2c-0 (port I2C0), 1 = /dev/i2c-1 (port I2C1) IOError: [Errno 2] No such file or directory

"
 

Anonymous user #13

36 months ago
Score 0  

sudo raspi-config

select "3 Interface Options" and hit enter select "P5 I2C" and hit enter then go to finish

and reboot.
 

Anonymous user #9

40 months ago
Score 0  
how to use SSD1306 OLED Displays (batter volt & capacity)
 

Lisa

40 months ago
Score 0  
Hello,sorry that we haven't tested x708 + OLED Displays;
 

Anonymous user #9

40 months ago
Score 0  
"bash: x708.sh: No such file or directory" <---how to do???
 

Harry

40 months ago
Score 0  
sorry, should be install.sh
 

Anonymous user #8

40 months ago
Score 0  

Hi, I keep getting this : pi@raspberrypi:~/x708 $ chmod +x install.shchmod +x install.sh chmod: cannot access 'install.shchmod': No such file or directory

chmod: cannot access '+x': No such file or directory
 

Lisa

40 months ago
Score 0  
Hello,Please email to us【support@geekworm.com】 and provide some pictures or videos so that we can find the problem. And tell us your order number.Best regards
 

Anonymous user #7

41 months ago
Score 0  

Hi can this be used on twister to monitor battery state..

Thanks
 

Lisa

41 months ago
Score 0  
Hi, Sorry we haven't tested on twister yet.
 

Anonymous user #6

42 months ago
Score 0  
How to enable Auto Power ON feature?
 

Lisa

41 months ago
Score 0  
Hi,please refer here:X708-Hardware
 

Anonymous user #5

45 months ago
Score 0  

Guten Tag,

Ist es möglich den Lüfter per Termeratur zu steuern wie beim board X730 ??
 

Lisa

41 months ago
Score 0  
Hi, The fan of X708 does not support temperature control.
 

Anonymous user #4

48 months ago
Score 0  
Hi. Is there a way to increase the delay between when "poweroff" of the RPI starts and the X708 drops power? This would allow to add a longer delay so that the OS is completely shutdown?
 

Xiali

48 months ago
Score 0  
Hi dear ,X708 will cut off the power after the system is shut down, you need to install the script first,By the way ,There are many Raspberry Pi fans exchange experiences on our official website, you are welcome to join us https://geek...munity/forum
 

Anonymous user #3

49 months ago
Score 0  

Hi,

I can't shutdown the pi using the command x708off. It says: "command not found".
 

Anonymous user #3

49 months ago
Score 0  
I could solve the problem myself. Had do modify the ~/.bashrc file. There was written "alias x728off = 'sudo x728softsd.sh'. But I got under /usr/local/bin/x708softsd.sh ...
 

Xiali

49 months ago
Score 0  
Hi dear ,So you have solve the problem That is a good news ,by the way there are many Raspberry Pi fans exchange experiences on our official website, you are welcome to join us: http://www.g...munity/forum
 

Harry

49 months ago
Score 0  
Sorry, we updated the script for X708.
 

Georgefeichter

51 months ago
Score 0  
Is there anyone who can help with this?
 

Georgefeichter

51 months ago
Score 0  

I can't get the pi to shut down through a command at the command line.

I type this: x728off

and I get this: /usr/local/bin/x728softsd.sh: line 5: echo: write error: Device or resource busy X728 Shutting down...

But nothing happens.

Any ideas anyone?
 

Anonymous user #1

51 months ago
Score 0  

Hi

Just got your x708 and installed it.

Step 3 of the software instructions is not very clear. Which lines need to be commented out?

Like this:

==================
  1. because X708 doesn't support RTC function, so we need to remove or comment out (add # at the beginning of the line) the following 4 lines
  2. X728 RTC setting up
  3. sudo sed -i '$ i rtc-ds1307' /etc/modules

sudo sed -i '$ i echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device' /etc/rc.local sudo sed -i '$ i hwclock -s' /etc/rc.local

===================

Like this:

==================
  1. because X708 doesn't support RTC function, so we need to remove or comment out (add # at the beginning of the line) the following 4 lines
  2. X728 RTC setting up
  3. sudo sed -i '$ i rtc-ds1307' /etc/modules
  4. sudo sed -i '$ i echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device' /etc/rc.local

sudo sed -i '$ i hwclock -s' /etc/rc.local

===================

or like this:

==================
  1. because X708 doesn't support RTC function, so we need to remove or comment out (add # at the beginning of the line) the following 4 lines
  2. X728 RTC setting up
  3. sudo sed -i '$ i rtc-ds1307' /etc/modules
  4. sudo sed -i '$ i echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device' /etc/rc.local
  5. sudo sed -i '$ i hwclock -s' /etc/rc.local
===================
Thank you very much.
 

Anonymous user #2

51 months ago
Score 0  

I read it as

  1. X728 RTC setting up
  2. sudo sed -i '$ i rtc-ds1307' /etc/modules
  3. sudo sed -i '$ i echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device' /etc/rc.local
  4. sudo sed -i '$ i hwclock -s' /etc/rc.local