reComputer R1000
© 2009-2024 Seeed Technology Co.,Ltd. All rights reserved.
Once you identify the entry corresponding to your SSD, you can proceed with partitioning or formatting it as needed.
3.21 UPS for Safe Shut Down
A GPIO25 between CPU and DC/AC power in is used to alarm CPU when the 5V power supply is down. Then the CPU shou
ld do something urgent in a script before energy exhaustion of super capacitor and run a "$ shutdown"
Another way to use this function is Initiate a shutdown when GPIO pin changes. The given GPIO pin is configured as an in
put key that generates KEY_POWER events. This event is handled by systemd-logind by initiating a shutdown.
Use /boot/overlays/README as reference, then modify /boot/config.txt.
dtoverlay=gpio-shutdown, gpio_pin=GPIO25,active_low=1
1. For UPS function please contact us for more information.
2. The alarm signal is active LOW.
The python code below is a demo for detecting the working mode of supercapacitor UPS through GPIO25, and automatic
ally saving data and shut down when the system is powered off.
import RPi.GPIO as GPIO
import time,os
num = 0
GPIO.setmode(GPIO,BCM)
#set GPIO25 as input mode
#add 500ms jitter time for software stabilization
GPIO.setup(25,GPIO.IN,pull_up_down = GPIO.PUD_DOWN)
GPIO.add_event_detect(25,GPIO.FALLING, bouncetime = 500)
while True:
if GPIO.event_detected(25):
print('...External power off...')
print('')
os.system('sync')
print('...Data saving...')
print('')
time.sleep(3)
os.system('sync')
#saving two times
while num<5:
print('-----------')
s = 5-num
print('---' + str(s) + '---')
num = num + 1
time.sleep(1)