From f50396cccb01848f14d99828a96117c332ed9150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B2=E5=B1=8E=E5=B0=86=E5=86=9B?= <37292630+wlmh110@users.noreply.github.com> Date: Mon, 10 Jan 2022 19:20:05 +0800 Subject: [PATCH] Created PiSugar 3 Series (markdown) --- PiSugar-3-Series.md | 231 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 PiSugar-3-Series.md diff --git a/PiSugar-3-Series.md b/PiSugar-3-Series.md new file mode 100644 index 0000000..b93fe47 --- /dev/null +++ b/PiSugar-3-Series.md @@ -0,0 +1,231 @@ +PiSugar3 Plus英文版 + PiSugar3 is the third generation of PiSugar Raspberry Pi battery power supply series, making Raspberry Pi a portable device. With the on-board RTC, the Raspberry Pi can get the correct time whether it’s powered or networked. + + A new design based on the feedback of PiSugar2, using independent MCU control to achieve communication and functions. The device firmware can be upgraded without any additional equipment. Only with a simple demand, firmware upgrades can be achieved through Raspberry Pi, let the device get new features at any time. + + PiSugar3 continues to use the pogo pin design to connect with Raspberry Pi from the back. In this way, it does not occupy the GPIO, and is compatible with other GPIO devices. + + PiSugar3 communicates with the Raspberry Pi through the I2C interface and is compatible with most I2C devices. In addition, the I2C communication address can be customized to avoid I2C address conflicts. + + PiSugar3 has full UPS functions and can set up multiple awakening methods to meet various unique project needs. + + Pisugar3 plus keeps running/working when external power is connecting or disconnecting to avoid data loss. PiSugar 3 can infer whether the external power supply is powered, whether the external power supply is disconnected, and also the battery voltage status through the data interface. Users can determine if they need to actively shut down for data protection and can set the device to automatically turn on when the external power supply is restored. With the combination of the above functions, the device can keep running as long as possible on the premise of safety. + + PiSugar3 adds a software watchdog function. When the function is turned on, the dog needs to be kicked regularly, which can effectively prevent the Raspberry Pi from crashing and improve the reliability of the system. + + In light load condition, the 5000mah battery can be continuously used for Raspberry Pi 4B for 6 hours. With ultra-low power consumption design, the on-board RTC can keep the clock running for more than one year when PiSugar is off. + + PiSugar3 provides hardware battery protection like never before, limiting battery voltage to nearly 80%. When charging protection is turned on, the battery cycles life can be improved. + + Set up quadruple overvoltage protection function, overcurrent protection function and undervoltage protection function to ensure the safety of the Raspberry Pi, PiSugar as well as the lithium battery. +Features + Full functions UPS + Anti-Mistaken Touch Switch + OTA firmware upgrade + TypeC/mircroUSB dual charging interface + Designed for Raspberry Pi 3B/3B+/4B + Back contact, easy to install, does not occupy GPIO + I2C function control, address can be set + Custom button + Soft shutdown (hardware notification software shutdown) + WebUI + Software watchdog + On-board RTC + Hardware battery protection + + +Electrical Specifications + Input: 5V-3Amax + Output: 5V-3Amax + Battery capacity: 5000mah + Communication interface: I2C interface 0x57/0x68 address (can be set) + + + + + + +Table of I2C +Control Register Address: 0x57 + + Register address 7 6 5 4 3 2 1 0 +0x02 Power supply Charging switch Output switch Device turns on when power is connected Anti-Mistaken Touch Retention Power button state + R RW RW RW RW R R +0x03 Retention Automatic hiberate Retention Soft shutdown Soft shutdown sign Retention + R RW R RW R R +0x04 Chip temperature, -40-85 degrees Celsius, 0 means -40 degrees Celsius + R +0x06 Software watchdog Retention Kick the dog Retention + RW R W R +0x07 Software watchdog timeout setting (*2s) + RW +0x08 Retention Custom button + R RW +0X20 Charging protection Retention SCL awakening Retention + RW R RW R +0x22 High battery voltage + RW +0x23 Low battery voltage + RW +0x2A The proportion of electricity (0-100%) + R +0x30 Write protection Retention Write protection Retention Write protection Retention + RW R RW R RW R +0X31 RTC-YY + RW +0X32 RTC-MM + RW +0X33 RTC-DD + RW +0X34 RTC-WeekDay + RW +0X35 RTC-HH + RW +0X36 RTC-mm + RW +0X37 RTC-SS + RW +0X40 Timing boot Retention + RW R +0X44 Retention ALM-WeekDay + R RW +0X45 ALM-HH + RW +0X46 ALM-mm + RW +0X47 ALM-SS + RW + + + In the I2C register, the retention bit is reserved for the system test interface and it is forbidden to read-in the data. + When directly modifying the I2C register, you need to read the value of the corresponding register first. Write the calculated value into this register after performing AND operation on the BIT bits that need to be modified. At the same time, make sure that only the bits that need to be modified are modified, and the values of other bits cannot be modified at will. + + +Function specifications +PiSugar 3 has many advanced power functions that can be set up, which are described below. + +Some functions can be operated on WebUI, indicating that this function does not need to be manually set up by I2C, only in WebUI. At the same time, the WebUI interface can be set up directly through the command line. The function set through the WebUI will retain the settings in the Raspberry Pi system and will not be set to the default value after restart or battery reset. +1.External power supply detection +Register address: the 6th bit of the 0X02 address +Register operation: can be read or written +Data description: 1 means external power supply access, 0 means no external power supply +Function description: It can be judged whether the external power supply is connected by querying the 7th bit of the 0X02 address. The detection is to detect whether the power input interface has voltage. If the plug is inserted but there is no power supply, it will be detected that the external power supply is not connected. +WebUI supports reading the status. + +2.Charging switch +Register address: the 6th bit of the 0X02 address +Register operation: can be read or written +Data description: 1 is on, 0 is off +Function description: When charging switch is turned on, once the external power access, the device begins charging. +Default value: This function will be reset to on each time the device is turned off +WebUI Does not support this function. + +3.Output switch +Register address: the 5th bit of the 0X02 address +Register operation: can be read or written +Data description: 1 is on, 0 is off +Function description: When output switch is turned off, PiSugar does not output voltage externally. When output switch is turned on, PiSugar outputs 5V voltage externally. If the automatic hibernate +function is turned on and PiSugar is turned off, the PiSugar system will immediately go into the hibernate +state, and I2C will be inoperable. +(About turning off PiSugar: The shutdown command is executed in the PiSugar-Poweroff client.) +Default value: This function will be reset to on each time the device is turned on. +WebUI does not support this function. + +4. Automatically resume booting when power is reconnected +Register address: the 4th bit of the 0X02 address. +Register operation: can be read or written. +Data description: 1 is on, 0 is off. +Function description: a. When this function is turned on and PiSugar is turned off, once the external power supply is restored, PiSugar will automatically turn on and start the external output. b. When this function is turned off, once the external power supply is restored, PiSugar will charge, but will not output externally. +If you need to awake the Raspberry Pi even when PiSugar is powered on, please refer to the SCL awakening function. +Default value: This function is on by default. It resets to on each time the PiSugar system is completely reset. +WebUI supports this function. + +5. Anti-mistaken touch function +Register address: the 3rd bit of the 0X02 address. +Register operation: can be read or written. +Data description: 1 is on, 0 is off. +Function description: +a. When anti-mistaken touch function is turned on, if PiSugar shuts down, first short press the power button, and then release, the LED will indicate the current power. Next, press and hold the power button to achieve the purpose of booting. When anti-mistaken touch function is turned off, short press the power button to trigger the boot. +b. Whether the function is turned on or not, when Pisugar is turned on, it needs to be turned off by a long press. +c. We can judge whether the current power button is pressed by reading the last bit of the 0X02 address. +Default value: This function is on by default. It resets to on each time the PiSugar system is completely reset. +WebUI does not support this function. + +6. Automatic hiberate function: +Register address: the 6th bit of the 0X03 address. +Register operation: can be read or written. +Data description: 1 is on, 0 is off. +Function description: This function is related to the output switch function. +a. When automatic hiberate function is turned on, once the output function is turned off, PiSugar will go into hiberate. At that time, I2C communication and custom switches are not available, while the power button, external power detection, RTC and timer switch machines work normally. +b. When the automatic hiberate function is turned off, PiSugar is always on regardless of whether the output switch is off. At that time, all functions including I2C are working normally. +c. This function can be used to maintain PiSugar's I2C communication after shutdown, so as to awake or perform other status queries. +d. When PiSugar turns off the output but does not go into hiberate, the power consumption is 1mA +Default: This function is on by default, it resets to on when restarting the device. +WebUI does not support this function. + +7. Soft shutdown function +Register address: 1. set up:he 4th bit of the 0x03 address;2. query whether to enter the soft shutdown state: the 3rd bit of the 0x03 address. +Register operation: can be read or written +Data description: 1 is on, 0 is off +Function description: The soft shutdown function is set for shutdown behavior for the power button. +a. When the soft shutdown function is turned off, while PiSugar is working, press and hold the power button for more than 2 seconds to directly turn off the power. +b. When the soft shutdown function is turned on, press and hold the power button will not directly turn off the output. Instead, it indicates that the system has triggered the shutdown process and should start to execute the shutdown command through the 3rd query bit of the 0x03 address. +Default value: This function is off by default, it resets to off when restarting. + +8. Chip temperature +Register address: 0X04 address. +Register operation: can be read +Data description: 0 means -40 degrees Celsius +Function description: The temperature measurement is in the range of -40 to 85 degrees Celsius. This temperature is only the temperature of the chip itself, it does not represent the temperature of the Raspberry Pi, nor does it represent the temperature of the battery. +WebUI does not support this function. + +9. Software watchdog +Register address: The function switch: the 7th bit of the 0X06 address, the watchdog reset: the 5th bit of the 0x06 address, the watchdog interval time: the 0x07 address. +Register operation: can be read or written. +Data description: 1 is on, 0 is off. +Writing 1 on the watchdog reset setting bit will reset the watchdog timer (kicking the dog). The watchdog delay is set to the register value*2s, for example, when the register value is 0x05, the actual watchdog delay is 5*2s=10s. +Function description: The software watchdog provides a watchdog other than the Raspberry Pi system, which restarts the Raspberry Pi system when the Raspberry Pi system crashes. When this function is turned on, if the watchdog timer is not reset (kicking the dog) within the software watchdog time interval, PiSugar will temporarily turn off the output to achieve the purpose of restarting the Raspberry Pi system. The operation of kicking the dog needs to be completed by the user. +Default value: This function is off by default. It is off by default each time it restarts. +WebUI does not support this function. + +10. Charging protection +Register address: the 7th bit of the 0X20 address. +Register operation: can be read or written. +Data description: 1 is on, 0 is off. +Function description: PiSugar3 provides hardware charging protection function. +When this function is turned on, the fully charged power is approximately equivalent to 80% of the battery power, and the voltage will be limited to about 3.8V. Enabling this function will greatly extend the cycle life of the battery by about 8 times (calculated as the battery cycle life doubles for every 0.1V drop in the charge cut-off voltage). It is recommended to turn it on under long-term charging conditions. +Default value: This function is off by default, it resets to off when restarting. +WebUI supports this function. + +11. SCL awakening +Register address: the 3rd bit of the 0X20 address. +Register operation: can be read or written. +Data description: 1 is on, 0 is off. +Function description: This function is related to the booting function. +When the function is turned on, the SCL pin will be pulled down once PiSugar is turned on. If the Raspberry Pi is connected to the power supply but not turned on, it will be awakened. +Default value: This function is off by default, it resets to off when restarting. +Webui does not support this function. + +12. Battery capacity reading +Register address: 0X22, 0X23, 0X2A +Register operation: can be read +Data description: 0x22 is high battery voltage, 0x23 is low battery voltage. When reading, you should first arrange the two bits of data in order to get the actual voltage in mA. +For example, if the data read are 0x10 and 0x1F, the combined result will be 0x101F=4127mV=4.127V. +The 0X2A address is the calculated battery power percentage. +Function description: WebUI can read the battery power percentage + +13.RTC function +Register address: write protection: 0x30, data address: 0x31-0x37 +Register operation: can be read or written +Operating instructions: RTC has a write protection function in order to prevent data fluctuations caused by misoperation or system instability. + +14. Timing boot function +Register address: control bit: the 7th bit of 0x40, data address: 0x44-0x47 +Register operation: can be read or written. +Data description: Write the control bit to 1 to turn on the timing boot function, write 0 to turn off the timing boot function. The Weekday bit ranked by bit represents from Sunday to Saturday, where 0 represents Sunday. +Function description: a. When the function is turned on, PiSugar will turn on the output each time the specified time is reached. +b. This function will not be reset due to restart. +c. Turning off this function requires manual settings. +WebUI supports this function. + +