Skip to content
Shop

Libraries and board definitions

Set up with your favorite AI

Gemini & other AI

Copy the setup prompt into your AI. Work through each step together, from checking your kit to getting it running.

Open Gemini

Copy the prompt, then paste it into Gemini’s message box.

View prompt

To upload a program, select the board definition for your MCU and the libraries needed by your leaves and example. First run the initial program in development environment setup, then add the libraries you need.

LeafArduino IDEPlatformIO
AP01 AVR MCUArduino AVR BoardsArduino Pro or Pro MiniATmega328P (3.3V,8MHz). Setupplatform = atmelavr, board = pro8MHzatmega328. Setup
AP02 ESP32 MCUesp32 by Espressif SystemsESP32 Dev Module. Setupplatform = espressif32, board = esp32dev. Setup
AP03 STM32 MCUUse Leafony’s board package. URL and setupUse Leafony’s LEAFONY_AP03 definition and variant files. File placement and upload settings

For AP03 in PlatformIO, selecting a name in the board list is not enough. Follow the linked instructions to place the files and set the upload tool and port. For AP01, the reset procedure depends on the USB leaf model; also check the AZ01C instructions if you use it.

AP03B and AP05 are different models. Before reusing the settings above, check each model’s documentation for available software and connection requirements.

These are the main sources referenced by the published examples. You do not need to install them all. Follow the example’s leaf and library requirements and the distributed project’s platformio.ini. A row does not mean that every library in it works with every MCU or leaf.

Leaf or functionSource / headerWhat to check
Shared 4-Sensors functionsAdafruit Unified Sensor / Adafruit_Sensor.h, Adafruit BusIO / Adafruit_BusIO_Register.hAlso check dependencies required by the sensor library
HTS221 temperature and humiditySmartEverything HTS221 / HTS221.hUse the implementation specified by the example
OPT3001 illuminanceClosedCube OPT3001 / ClosedCube_OPT3001.hSearch Arduino Library Manager for ClosedCube OPT3001
AI01 acceleration (LIS2DHTR)Adafruit LIS3DH / Adafruit_LIS3DH.hThe published examples use Adafruit LIS3DH. This is not for AI05’s LIS2DW12
BLE leafTBGLib / TBGLib.hSeparate from libraries for ESP32’s built-in BLE
AI04 LCDtomozh/arduino_ST7032 / ST7032.hSee the AI04 notes below
RTC on RTC & microSDRTClib / RTClib.hSeparate from the STM32 internal RTC library
AVR timer interruptsMsTimer2 / MsTimer2.hFor STM32, see HardwareTimer
STM32 internal RTC and low powerSTM32RTC / STM32RTC.h, STM32LowPower / STM32LowPower.hCheck Arduino Core compatibility
Existing LTE-M examplesLteLeafV4 / LteLeafV4.hMatch the communication leaf model to the example
Wi-Fi MaryWiFi101Leafony / WiFi101Leafony.hSeparate from settings for AP02’s built-in Wi-Fi
LoRa and signed communicationarduino-LoRa / LoRa.h, arduino-tca9536 / TCA9536.h, SparkFun ATECCX08a / SparkFun_ATECCX08a_Arduino_Library.hFollow the example for the communication leaf and function you use

The published AI04 examples use arduino_ST7032 by tomozh. LCD_ST7032 and ST7032_asukiaaa are different implementations. For Arduino IDE, download the ZIP from the source and install it as described below.

If you see ST7032.h: No such file or directory, check the installation. Installing the library does not enable LCD power. See AI04 power and initialization and the LCD example for your MCU.

  1. Check the library name, author and version specified by the example.
  2. If available in Library Manager, open Tools → Manage Libraries, search by name, check the author and version, and install it.
  3. For ZIP distributions, download the file using Code → Download ZIP or the source’s download link, then import it with Sketch → Include Library → Add .ZIP Library.
  4. Compile the example. If a header is missing, compare the filename in the error with the library you installed.

See Arduino’s library installation instructions for details.

Add lib_deps inside the [env:...] section you use in platformio.ini. If it already exists, add entries to the same list. Dependencies are downloaded during the build. If the example includes a complete configuration file, use its settings.

; Syntax example. Hello World does not need additional libraries.
lib_deps =
adafruit/Adafruit Unified Sensor
adafruit/Adafruit BusIO

Installing from a GitHub URL also requires Git. Restart VS Code after installing it and check that git --version works in a terminal. See PlatformIO’s lib_deps reference for syntax.

Earlier lists included the following dependencies. They help you interpret existing projects. Before copying them into a new project, check the example and Arduino Core compatibility.

LibraryExisting PlatformIO dependency example
Adafruit Unified Sensoradafruit/Adafruit Unified Sensor@^1.1.6
Adafruit BusIOadafruit/Adafruit BusIO@^1.14.1
ClosedCube OPT3001closedcube/ClosedCube OPT3001@^1.1.2
Adafruit LIS3DHadafruit/Adafruit LIS3DH@1.1.2
AI04 LCDtomozh/ST7032@0.0.0-alpha+sha.501bf64fe6
MsTimer2paulstoffregen/MsTimer2@^1.1
RTClibadafruit/RTClib@^2.1.1
STM32RTCstm32duino/STM32duino RTC@1.2.0
STM32LowPowerstm32duino/STM32duino Low Power@^1.2.2

STM32RTC and STM32LowPower in particular must match the STM32 Arduino Core version. If a build changes after a library update, check the full error, board package and library versions, and include them in the question template.