Example Code for Arduino-UPS Recognition

Upload the example program to make the battery recognized in the system and use system power management functions such as performance limitations and automatic shutdown.

Hardware Preparation

  • LattePanda UPS Hat * 1
  • 18650 3.7V lithium-ion batteries * 3
  • Compatible LattePanda * 1
    • LattePanda Alpha
    • LattePanda Delta
    • LattePanda 3 Delta

Software Preparation

Arduino Library Installation Tutorial

Wiring Diagram

  1. Do not install the lithium battery before the UPS Hat is in place

  2. Align the UPS power interface side with the LattePanda TypeC/RJ45/HDMI interface side
    LattePanda UPS Hardware Installation 1

  3. Insert the UPS Hat into the LattePanda
    LattePanda UPS Hardware Installation 2

  4. Check that the pins are fully inserted in order, without any floating or bent pins.
    To reserve space for heat dissipation and ventilation, the UPS Hat pins are longer. The figure shows the appearance after the installation is in place.
    LattePanda UPS Hardware Installation 3

  5. After checking the installation, install the 18650 lithium battery, paying attention to the positive and negative directions.
    LattePanda UPS Hardware Installation 4

After the UPS Hat is installed, please use the USB-C or DC 5.5x2.1mm interface on the UPS Hat to power the LattePanda. Using the LattePanda's own interface for power will not allow the UPS function to work properly.

Other Preparation Work

Ensure the hardware is installed correctly as per the Wiring Diagram section.

  1. Please make sure you have already installed the Arduino IDE, and LPUPS library.
  2. Launch the Arduino IDE, open the UPS program: "File -> Examples -> DFRobot_LPUPS -> LPUPS"
  3. Select the corresponding development board model: "Tools -> Board -> Arduino Leonardo"
  4. Select the corresponding development board port: "Tools -> Port -> COMx" (Select the port marked with Arduino Leonardo)

Result

Upload the example program, and after a short wait, you can see that the battery has been recognized in the system. If you need to further set the threshold battery level for automatic power-saving and forced sleep on your computer, you can adjust it in the Windows advanced power settings.

LattePanda UPS battery display

Was this article helpful?

TOP