Changes

Jump to navigation Jump to search

X729-Software

1,375 bytes added, 16:29, 19 November 2022
no edit summary
python3 read_fan_speed.py
'''5. Test PLD/PLSD/buzzer function''' 5.1 Test AC Power loss or power adapter failure detection (PLD) #Run the script test the PLD function sudo python3 pld.py[[File:X729-4.png|none]] 5.2 Test Auto shutdown when AC power loss or power adapter failure #Run the script and then remove your power adapter pi@raspberrypi:~/x729 $ sudo python3 plsd.py #Safe shutdown will be implemented in 5 seconds. 5.3 Test the buzzer alarm when AC power loss or power adapter failure #Run the script and unplug your power adapter from the UPS. pi@raspberrypi:~/x729 $ sudo python3 buzzer.py #Once power adapter is removed then the buzzer will generate a beep sound continuously. '''6. Set and Read the RTC time''' 6.1 Run the following command on your Raspberry PI to begin editing the /boot/config.txt file. sudo nano /boot/config.txt add one of the following lines to the bottom of the file, dtoverlay=i2c-rtc,ds1307 [[File:X729-5.png|none]] Save and exit. In nano, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted. Run the commands to disable the "fake hwclock" which interferes with the 'real' hwclock pi@raspberrypi ~ $ sudo apt-get -y remove fake-hwclock pi@raspberrypi ~ $ sudo update-rc.d -f fake-hwclock remove pi@raspberrypi ~ $ sudo systemctl disable fake-hwclock[[File:X729-6.png|none]]  Run the command and comment out these five lines:[[File:X729-7.png|none]] 6.5) Reboot the Raspberry Pi pi@raspberrypi ~ $ sudo reboot (6.6) Run the command to verify the time is correct. Plug in Ethernet or WiFi to let the Pi sync the right time from the Internet pi@raspberrypi ~ $ date (6.7) Run the command to write the time pi@raspberrypi ~ $ sudo hwclock -w (6.8) Run the command to read the time pi@raspberrypi ~ $ sudo hwclock -r Once the time is set, make sure the batteries are inserted so that the time is saved. You only have to set the time once. That's it! Next time you boot the time will automatically be synced from the X729.
#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"
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 /home/pi/x728bat.py
[[File:X728-bat-2.jpg]]
 
User Guide: https://github.com/geekworm-com/x728 to know more details;
 
But we hope that the script can be executed automatically when the Raspberry Pi board boots, we can use crontab system command to achieve it. Refer to [[How to add crontab job]] or refer to the following:
 
pi@raspberrypi ~ $ `sudo crontab -e`
 
Choose "`1`" then press Enter
 
Add a line at the end of the file that reads like this:
 
`@reboot python /home/pi/x728bat.py`
7. Power off command on Raspbian from software

Navigation menu