AI05 Env Sensors
Use this page with AI
Explore with your favorite AI
Gemini & other AI
Copy this page’s context into your AI to explore how it works and what you can build.
Copy the prompt, then paste it into Gemini’s message box.
View prompt
These photos show the AI05 board from the front, back, and an angle.
Features
This leaf measures temperature, humidity, pressure and 3-axis acceleration. Combine it with an MCU (microcontroller) leaf to read environmental conditions and the leaf’s tilt and motion.
The standard configuration uses a BME280 temperature, humidity and pressure sensor and a LIS2DW12 3-axis accelerometer. It operates from the Leafony Bus 3.3 V supply, and readings are obtained over I2C. A four-pin connector is available for external I2C devices.
Pads are also provided for SHT40, SGP40 and BME680 sensors. These are not fitted as standard. Using them requires the components and program described under optional assembly.
Sensor and external pad locations
- Temperature, humidity and pressure: BME280 (U3). This environmental sensor is fitted as standard.
- 3-axis acceleration: LIS2DW12 (U5). Use it to read tilt and motion.
- External I2C connection: J1. These four pads bring out 3.3 V, GND, SDA and SCL. See External I2C connector J1 for the pin order.
Click the diagram to enlarge it. The empty pads for additional sensors in the photo are unpopulated as standard. Gas measurements require the components and matching program described under optional assembly.
Specifications
Board and interfaces
| Item | Description |
|---|---|
| Board dimensions | 23 × 20 mm |
| Board thickness | 0.8 mm (excluding component height) |
| Board layers | 4 |
| Power and signal voltage | 3.3 V |
| Communication | I2C, up to 400 kHz |
| Acceleration interrupt | LIS2DW12 INT1 connected to Leafony Bus D3 |
| External connector J1 | 4 pins, 2.54 mm pitch, for a right-angle pin header |
| SDA/SCL pull-ups | R18 and R19 (2.7 kΩ each) are not fitted as standard |
Standard configuration
| Reference | Part | Manufacturer | Measurements |
|---|---|---|---|
| U3 | BME280 | Bosch Sensortec | Temperature, humidity and pressure |
| U5 | LIS2DW12TR | STMicroelectronics | 3-axis acceleration |
The BME280 operating temperature range is −40 to 85 °C, and the pressure measurement range is 300 to 1100 hPa. Accuracy conditions depend on temperature; see the BME280 manufacturer documentation.
The LIS2DW12 acceleration range can be set to ±2 g, ±4 g, ±8 g or ±16 g (manufacturer documentation).
Optional assembly
DNP (Do Not Populate) means the component is not fitted.
| Reference | Part | Function | Standard configuration |
|---|---|---|---|
| U1 | SHT40-AD1B-R2 | Temperature and humidity | DNP |
| U2 | SGP40-D-R4 | Gas sensor responding to volatile organic compounds (VOCs) | DNP |
| U4 | BME680 | Temperature, humidity, pressure and gas sensor | DNP |
The BME280 (U3) and BME680 (U4) have separate footprints, but only one is fitted. Both use I2C address 0x76, so they cannot both be fitted and read independently.
The standard configuration populates U3, C21 and C22, leaving U4, C23 and C24 unpopulated. Reverse that choice to use BME680. SHT40 and SGP40, which are not fitted as standard, will not respond to an I2C scan.
When adding SHT40, also fit C20. When adding SGP40, also fit R10 (4.7 Ω), C2 and C3. These are also unpopulated as standard; without R10, SGP40 receives no power.
Gas measurement is not included in the standard configuration. Using metrics such as SGP40’s VOC Index requires the sensor and corresponding signal processing (SGP40 manufacturer information, BME680 manufacturer information).
I2C addresses
All addresses use 7-bit notation.
| Device | Address | Configuration |
|---|---|---|
| LIS2DW12 | 0x18 | Standard; SDO/SA0 connected to GND |
| BME280 | 0x76 | Standard; SDO connected to GND |
| SHT40 | 0x44 | Optional |
| SGP40 | 0x59 | Optional |
| BME680 | 0x76 | Alternative to BME280; SDO connected to GND |
Pin connections
Leafony Bus
Click the diagram to enlarge it. F24 is the LIS2DW12 INT1 interrupt output. Select AI05 in the Pin Assignment Editor to edit the same diagram and save it as PNG or SVG.
| Signal | Connector contacts | AI05 function |
|---|---|---|
| V33 | F1 / B1 | 3.3 V power |
| SDA | F23 / B23 | I2C data |
| D3 | F24 / B24 | LIS2DW12 INT1 interrupt |
| SCL | F25 / B25 | I2C clock |
| GND | F27 / B27 | Power and signal ground |
F/B are the front/back contact names on the KiCad Leafony Bus connector CN1. LIS2DW12 INT2 is not connected. See the Leafony Bus for the overall bus specification.
External I2C connector J1
| Pin | Signal | Function |
|---|---|---|
| 1 | GND | Power and signal ground |
| 2 | +3.3V | Leafony Bus 3.3 V supply |
| 3 | SDA | I2C data |
| 4 | SCL | I2C clock |
J1 accepts a four-pin, 2.54 mm pitch header and shares the Leafony Bus power and I2C bus. Check pin numbers and 3.3 V compatibility before attaching cables or external devices.
Connection requirements
- Check the I2C pull-ups. R18 and R19 are not fitted. When paired with AP03 STM32 MCU, the pull-ups on AP03 are used. For other MCUs and external devices, also check that SDA/SCL are pulled up to 3.3 V.
- The I2C address conflicts with AX06 Grove&5V. AI05’s LIS2DW12 and AX06’s I/O expander both use
0x18. Do not connect them to the same bus with their standard settings. - The D3 interrupt line conflicts with AI01 4-Sensors. AI05 uses acceleration address
0x18and AI01 uses0x19, but the interrupt line is shared, so do not combine them unchanged. If SHT40 is added,0x44may also conflict, depending on the address setting of AI01’s light sensor. - Devices connected to J1 also share the I2C bus. Check the I2C address map for conflicts with other leaves.
PCB layout
These reference images were generated from the KiCad board data. They omit component 3D models and include pads for optional components. See standard configuration and optional assembly for fitted and unpopulated components.
Top
Bottom
Software
For a complete walkthrough of the regular-reading sample, including measured output, see Read temperature, humidity, pressure and acceleration with AI05.
PlatformIO + Arduino examples are available for AI05 with the AP03 STM32 MCU. Each example is a separate project.
| Example | Behavior | Output to check |
|---|---|---|
| read_sensors (Japanese README) | Detects and initializes sensors at startup, then reads them every second | BME280 temperature, humidity and pressure; LIS2DW12 X/Y/Z acceleration |
| accel_wakeup (Japanese README) | Receives LIS2DW12 motion detection interrupts | Time since startup, event count, detected axes and X/Y/Z acceleration |
| accel_shock_fifo (Japanese README) | Reads 100 acceleration samples from the FIFO after detecting a shock | Browser plots of X/Y/Z and acceleration magnitude, with CSV export |
All examples use 400 kHz I2C with SDA on AP03 PB9 (D14) and SCL on PB8 (D15). Serial output is 115200 bps; connect to a PC through a USB serial leaf or equivalent interface. Periodic sensor readings, motion detection interrupts, and capture and waveform display of 100 samples after a shock have been tested on AP03 with a standard AI05.
Read sensors periodically
read_sensors detects BME280 at 0x76 and LIS2DW12 at 0x18. It displays temperature in °C, humidity in %RH, pressure in hPa and acceleration in g. Acceleration includes gravity even when the board is stationary. This example does not use the D3 interrupt.
The code also supports optional SHT40, SGP40 and BME680 sensors, and skips sensors that are not fitted. BME280 and BME680 are distinguished by their chip IDs. SGP40 outputs a raw VOC signal (SRAW_VOC), and BME680 gas output is a resistance value; the example does not convert these to a VOC Index, IAQ score or ppm.
Receive motion detection interrupts
accel_wakeup receives interrupts through LIS2DW12 INT1 → Leafony Bus D3 → AP03 PB3. No additional wiring is required when connected through Leafony Bus. Defaults are 100 Hz, ±2 g, a motion threshold of 0.250 g and a duration of 20 ms.
Keep the board still during initialization. After LIS2DW12: ready and Move the board... appear, move the board gently. Lines such as Wake-up #1 appear, and the event count increases with repeated motion. Measurements are not printed periodically while the board is stationary. The displayed acceleration includes gravity and is read when the event is processed; it is not the peak value at the instant the interrupt occurred. The event count reflects processed interrupts and may differ from the number of physical movements.
This example uses the sensor’s Wake-up function. The MCU keeps running normally; it does not wake from Sleep or Stop mode. See the example README for sensitivity adjustments.
Record 100 samples after a shock with the FIFO and view the waveform
accel_shock_fifo records 100 acceleration samples when the LIS2DW12 generates a Wake-up interrupt. It uses the same INT1 → D3 → PB3 interrupt path as accel_wakeup. Defaults are 400 Hz, ±8 g, and a shock detection threshold of 0.500 g. The sensor’s FIFO, a buffer that stores readings in order, holds 32 samples. The program drains it into RAM repeatedly to collect 100 samples.
Each capture contains only data acquired after shock detection. The first sample after the FIFO starts is discarded before saving 100 samples, so the capture is not guaranteed to include the peak at the instant of impact. The MCU continues running normally.
After building and uploading, run the following command from the repository root to start the supplied waveform viewer. It uses Python 3 and requires no additional packages.
python3 -m http.server 8765 --bind 127.0.0.1 --directory platformio/accel_shock_fifo/viewer
- Open http://127.0.0.1:8765/ in desktop Chrome or Edge.
- Close the serial monitor, click “シリアル接続” (Connect serial) in the viewer, and select AP03’s USB serial port.
- Set AP03 to Run, press Reset, and keep the board still during initialization. Once “衝撃を待っています” (Waiting for a shock) appears, move the board gently.
- The waveform appears after all 100 samples arrive. Toggle X/Y/Z and acceleration magnitude as needed, and click “CSVを保存” (Save CSV) to save a capture.
This example shows a waveform recorded on hardware in the Japanese viewer interface (100 samples, 400 Hz, ±8 g). The maximum acceleration magnitude in this capture is 5.002 g. You can also reload CSV files and switch between the most recent 20 captures. Without a connected device, “デモを見る” (View demo) displays generated data.
The horizontal axis starts at the first retained sample and shows estimated times from 0 to 247.5 ms, calculated from the configured 400 Hz rate. These are neither times relative to shock detection nor measured timestamps for each sample. The displayed acceleration and magnitude include gravity, so the magnitude is approximately 1 g while stationary. The detection threshold applies to the high-pass-filtered signal and cannot be compared directly with the displayed values.
Additional shocks during acquisition, transmission, or the 500 ms waiting period are not saved as separate captures. FIFO overruns, I2C read failures, timeouts, or excessive readout delays invalidate a capture. Captures are kept only in browser memory, so save the required data as CSV before closing the page. See the example README (Japanese) for threshold adjustments and error output.
Build and upload
Download or clone the repository. In VS Code, open the folder containing the platformio.ini for the example you want to run. Use the supplied settings (board = leafony_ap03). With PlatformIO Core, choose the command for the example you want to build and run it from the repository root:
pio run -d platformio/read_sensors
pio run -d platformio/accel_wakeup
pio run -d platformio/accel_shock_fifo
To upload over USB serial, close the serial monitor and disconnect the waveform viewer, set AP03 to Program and press Reset before uploading. After the upload completes, return to Run, connect either the serial monitor or waveform viewer at 115200 bps, and press Reset. They cannot connect to the same port at the same time. See each example’s README (Japanese) for port selection, upload commands and sample output.
AI01 4-Sensors uses different sensors, so its temperature/humidity and acceleration examples cannot be used unchanged.
Documents
- AI05 Env Sensors repository
- Schematic (PDF)
- PCB layout (PDF)
- KiCad project
- KiCad schematic
- KiCad PCB layout
- Panelized manufacturing data
- BME280 manufacturer information
- LIS2DW12 manufacturer information
- SHT40 manufacturer information
- SGP40 manufacturer information
- BME680 manufacturer information
Revision history
- November 3, 2026: Added AP03 examples for sensor readings, motion interrupts and FIFO capture after a shock, with a recorded waveform and the scope of hardware testing.
- September 2026: Initial version.




