Changes

Jump to navigation Jump to search

X729-Software

1,235 bytes added, 01:11, 23 July 2023
no edit summary
{{GD Template Impl}}
<big>Although this installation tutorial is still available, but we strongly recommend that you use [[X729-script]] new tutorial, and we no longer maintain this page.</big> ==Setup script==The following test is base on * [https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64.img.xz 2023-05-03-raspios-bullseye-arm64.img.xz]* [https://www.raspberrypi.com/software/operating-systems/ 2022-09-22-raspios-bullseye-armhf.img.xz]* [https://www.raspberrypi.com/software/operating-systems/ 2022-09-22-raspios-buster-armhf.img.xz] PS: To buster version, the default user name is 'pi, but bullseye version, you need to manually create a new user. In our example script, the new user name we created is 'pi'. If you create your own user name, you need to modify the corresponding user name directory in the script. For Example: You may need to change '/home/pi/' => '/home/XX/', 'XX' is user name you created.
Python version is 3;
==='''1. Enable I2C funcion on Raspbian:''' reter to [[How to enable I2C]]===
Please reter to [[How to enable I2C]] ==='''2. Check & review I2C portaddress'''===
2.1 Login via teminal window, then update & upgrade & install necessary software (python and i2c tool library)
sudo apt-get update
sudo apt-get -y upgrade sudo apt-get -y install i2c-tools python3-smbus python-smbus sudo apt-get -y install pigpio python-pigpio python3-pigpiorpi.gpio
sudo apt-get -y install python3-pip python3-pil
#sudo apt-get -y install pigpio python-pigpio python3-pigpio
2.1 Once you have logged into your Raspberry Pi from the command line, run the command to see all the connected devices
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
</PRE>
Explaination:
<PRE>
#36 - the address of the battery fuel gauging chip
#3c - address of oled display,This value only exists when the oled is inserted,check if the OLED displayis inserted in the correct direction if you don't found the above i2c port
#40 - TI INA219 12-bit current/voltage/power monitor
#68 - the address of the RTC chip
PS: Please check if the OLED is inserted in the correct direction if you don't found the above i2c port
==='''3. Setting up the power management script'''===
3.1 Download x729 setup scripts:
3.2. Install script&reboot:
cd x729
chmod +x *.sh
sudo bash pwr.sh
#Setting up the command to turn off X729 from software
#Setting up the command to turn off X729 from software
printf "%s\n" "alias x729off='sudo x729softsd.sh'" >> ~/.bashrc
#Reboot the Raspberry Pior long press on-board button switch to turn off sudo rebootnow
3.3 Powering off the Raspberry Pi from software
x729off
* x729off is safe shutdown command
* press on-board blue button 1-2 seconds to reboot
* press on-board blue button 3 seconds to safe shutdown,
* press on-board blue button 7-8 seconds to force shutdown.
==='''4. Setting up the PWM cooling fan'''===
cd ~
cd x729
python3 read_fan_speed.py
==='''5. Test PLD/PLSD/buzzer function'''=== 
5.1 Test AC Power loss or power adapter failure detection (PLD)
==='''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.
6.3 Run the command and comment out these five lines:
sudo nano /lib/udev/hwclock-set
[[File:X729-7.png|none]]
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]].
===7. How to enable automatic shutdown when low voltage===
7.1 Run the command to read battery voltage and percentage
pi@raspberrypi:~/x729 $ sudo python3 bat.py
7. Power off command on Raspbian from software x728off* x728off is 2 Change the battery low voltage to implement safe shutdown command. default is less than 3.00Vdc.* press on-board blue button 1-2 seconds to reboot pi@raspberrypi ~ $ sudo nano bat.py * press on[[File:X729-board blue button 3 seconds to safe shutdown,.png|none]]* press on-board blue button 7-8 seconds to force shutdownNote: the voltage range must be 2.5~4.1vdc.
8. Testing AC power off/loss or power adapter failure detection (need to short the 'PLD' pin on v1.x), also test the buzzer function on v2.1
cd ~
sudo python3 x728pld.py
or
sudo python x728pld.py
[[File7.3 Optional - if you want to run Python Script automatically on Bootup then run the command pi@raspberrypi:X728-pld~/x729 $ sudo crontab -2.jpg]]e
9. '''Testing Auto shutdown when AC power loss''' or power adapter failure
cd ~
sudo python3 x728pld.py
or
sudo python x728plsd.py
==uninstall x728 script==uninsatll x728 shell script, run 7.4 Add a line at the end of the following commandfile that reads like this: sudo @reboot python3 /home/pi/x729/bat./uninstall_x728py[[File:X729-4.shpng|none]]
For the x728 old shell scriptSave and exit. In nano, you also run this command to remove itdo that by hitting CTRL + X, then re-install the x728 scriptanswering Y and hitting Enter when prompted.
==FAQ=8. How to enable OLED display===Q: We want Refer to [[How to automatically shut down when the battery voltage is lower than a certain specified value, is it possible?enable OLED display]]
A: Please ==Uninstall cript==uninsatll x729 shell script, run the followng following command to achieve this function.(Note: 3V is default shut down voltage value ) python3 /home/pi/x728sudo ./x728v2-asduninstall_x729.py &sh
X728==Other resource==X729-Chip-Specifications:
* [[File:MAX17040-MAX17041.pdf]]
*[https://www.instructables.com/Raspberry-Pi-Tutorial-How-to-Use-a-Buzzer/ Raspberry Pi Tutorial: How to Use a Buzzer]
 Return to [[X728X729]] or [[X729-hardware]]
<!--Add review function! -->

Navigation menu