Skip to the content
4 layers40 × 58 mmSTM32-S Plant, the printed circuit board in 3D

An open-source STM32F103C8T6 development board designed for environmental monitoring, featuring integrated Li-Ion battery management, USB-C, MicroSD data logging, and onboard I2C sensors for temperature, humidity, and ambient light.

Size
40 × 58 mm
Copper layers
4
Thickness
1.6 mm
Parts
59
Nets
69
Pads
254
Tracks, vias
697, 135
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
12 Jul 2026
Updated
3 Sep 2026

Overview

STM32-S Plant is an open-source printed circuit board by Fred98246, from the Fred98246/STM32-Environmental-Sensor-and-Datalogging-Board repository on GitHub, published under the MIT licence. It is a 4-layer board of 40 × 58 mm with 59 parts on 69 nets, routed with 697 tracks and 135 vias.

It is built around the STM32F103C8T6, OPT3001DNPRQ1 and AP2112K-3.3TRG1, with the AP9101CAK-AKTRG1, D3V3XA4B10LP-7(ES) and ZXMN3B14FTA among its other parts. Its parts include 22 capacitors, 17 resistors, 6 ICs, 5 connectors and 4 diodes. It belongs with the sensors and measurement and microcontroller boards boards and the STM32 boards of this library.

Main components

9

README

README.md

Custom STM32 Environmental Sensor & Datalogging Board

Project Overview

This repository contains the complete design files and source code for a custom, battery-powered STM32 microcontroller board designed for environmental monitoring and data logging. Measuring at a compact 40 x 58 mm, the board features integrated temperature, humidity, and ambient light sensors, alongside an SD card slot for local data storage. It includes a complete Li-Ion power management system with USB-C charging, load sharing, and battery protection.

The user interface is driven by a rotary encoder and an external SPI display, making it suitable for standalone automated environments like humidity control or ambient monitoring.

Repository Structure

  • Hardware: Contains the complete KiCad E.D.A. project files, including the schematic and the 4-layer PCB layout.
  • Manufacturing: Includes the generated Gerber files, Drill files, and sheets with the Bill of Materials (BOM) required for PCB fabrication and assembly.
  • Firmware: Contains the STM32CubeMX (.ioc) configuration file for peripheral initialization and the C/C++ code with the needed drivers.
  • docs: Contains component datasheets and a detailed Bill of Materials (BOM) spreadsheet

Hardware Implementation Details

Core Processing

  • Microcontroller: The board is powered by the STM32F103C8T6 ARM Cortex-M3 MCU.
  • Clocking: A 16MHz crystal oscillator (LFXTAL085871) is implemented to provide the precise clocking required for stable USB communication.
  • Debugging/Programming: Connector for SWD programming, via ST-Link V2.

Power Management

The power architecture is designed for safe, continuous operation whether plugged in or running on battery:

  • Battery Charging: Handled by the MCP73831/2 IC, drawing 5V from the USB-C port to charge a connected Li-Ion cell.
  • Battery Protection: An AP9101C IC, paired with dual ZXMN3B14F N-Channel MOSFETs, protects the battery from overcharge, overdischarge, and overcurrent scenarios.
  • Load Sharing: An AO3401A P-Channel MOSFET and an SS14 Schottky diode create a seamless load-sharing circuit. This ensures the system runs directly off USB power when plugged in, allowing the battery to charge optimally without system load interference.
  • Regulation: An AP2112K-3.3TRG1 LDO provides a stable 3.3V supply for the MCU and logic.

Sensors & Interfaces

  • Environmental Sensing: Utilizes the SHT3x-DIS for high-precision temperature and humidity tracking via I2C.
  • Light Sensing: Incorporates the OPT3001DNPRQ1 ambient light sensor, also operating on the I2C bus.
  • Storage: A Molex 47219-2001 MicroSD card receptacle is routed via high-speed SPI for data logging in txt file.
  • Connectivity: USB-C port configured for USB 2.0 data and power. D3V3XA4B10LP TVS diode arrays are placed on both the USB data lines and the SD card lines to protect against electrostatic discharge (ESD).
  • USB-CDC Virtual COM Port Interface: Integrated full-speed USB communication between the STM32 and host PC, enabling real-time serial telemetry and diagnostic logging for hardware bring-up and physical fault isolation.
  • User Input: Hardware debounced rotary encoder footprint with integrated push-button functionality.

Design Challenges & Signal Integrity

Designing this board within a 40x58mm footprint required careful attention to PCB stackup and signal routing:

  • Component Footprints & Tolerances: Extensive review of manufacturer datasheets was required to ensure precise footprint creation and component placement within the restricted 40x58mm board area.
  • 4-Layer Stackup: To accommodate the component density and maintain strict signal integrity, a 4-layer PCB was utilized (Top Signal, Ground Plane, Power Plane, Bottom Signal). This continuous internal ground plane is critical for providing short return paths for high-frequency signals and minimizing electromagnetic interference (EMI).
  • USB Differential Routing: The USB D+ and D- lines require 90-ohm differential impedance matching. The 4-layer stackup allowed for calculating precise trace widths and spacing over the internal ground plane to hit this impedance target, ensuring reliable USB enumeration and data transfer.
  • MicroSD SPI Speeds: Because SD card SPI operates at moderate speeds, it does not require strict impedance matching or length tuning. The 4-layer stackup provided the flexibility to route these signals easily through vias while maintaining a solid ground reference to minimize general EMI.
  • Mixed-Signal Placement: Analog sensor lines (I2C for SHT3x and OPT3001) are physically separated from high-speed digital traces (USB, SPI, and the 16MHz crystal) to prevent digital switching noise from coupling into the sensitive environmental readings.
  • Firmware Architecture: The C/C++ codebase leverages STM32 HAL libraries, structured with modular driver functions and a streamlined main loop to ensure non-blocking sensor reads and efficient peripheral management.

Operational Flow & User Interface:

The firmware is structured around an event-driven state machine that handles user interaction, data logging, and strict power efficiency:

  • Startup & Menu Navigation: The system is awakened by a physical press of the rotary encoder. The TFT display initializes and presents an interactive menu where the user can select to view Temperature, Humidity, or Ambient Light.
  • Active Monitoring: Upon selection, the screen continuously updates with real-time readings from the designated I2C sensor.
  • Concurrent Datalogging & Telemetry: While the system is awake, it automatically mounts the FATFS file system and appends the sensor readings to a .txt file on the MicroSD card at strict 10-second intervals. Simultaneously, this data is continuously broadcast over the USB-CDC COM port to a connected PC for live monitoring.
  • Low-Power Sleep Mode: To conserve battery, if the system detects no rotary encoder rotation or button clicks for 2 minutes, it automatically gracefully closes the SD card file, powers down the display, and puts the STM32 into a low-power STOP state. A subsequent button press triggers an EXTI hardware interrupt, waking the system back to full operation instantly.

🚀 Future Scope: Closed-Loop Automation

While currently operating as a standalone datalogger, this board was engineered to serve as the precision sensor node for future automated control systems. By linking the onboard environmental telemetry to external physical actuators (such as fans, humidifiers, or motorized blinds), the hardware will transition into a dynamic closed-loop control environment.

The high-resolution empirical data currently gathered via the SD card and USB interface provides the foundation for mathematical system identification. This allows the physical environment's behavior to be accurately modeled in software like MATLAB, enabling the future calculation of transfer functions and the implementation of tuned PID or automated sequential control logic directly onto the STM32.

  • Schematic:
image image
  • PCB:
image
  • 3D View:
image

Parts

59
QtyValueFootprintReferences
10100nCapacitor_SMD:C_0402_1005MetricC5, C7, C8, C9, C11, C12, C16, C17, C18, C24
610KResistor_SMD:R_0603_1608MetricR1, R9, R19, R20, R21, R22
410kResistor_SMD:R_0603_1608MetricR10, R16, R17, R18
310nCapacitor_SMD:C_0402_1005MetricC19, C20, C21
310uCapacitor_SMD:C_0805_2012MetricC6, C10, C15
210pCapacitor_SMD:C_0402_1005MetricC22, C23
21uCapacitor_SMD:C_0402_1005MetricC1, C2
24.7uCapacitor_SMD:C_0805_2012MetricC3, C4
25.1KResistor_SMD:R_0603_1608MetricR7, R8
2D3V3XA4B10LP-7SamacSys_Parts:D3V3XA4B10LP7D1, D6
2ZXMN3B14FTASamacSys_Parts:ZXMN3B14FTAQ2, Q3
1100KResistor_SMD:R_0603_1608MetricR6
12.7KResistor_SMD:R_0603_1608MetricR5
12KResistor_SMD:R_0603_1608MetricR3
1330Resistor_SMD:R_0603_1608MetricR4
1470Resistor_SMD:R_0603_1608MetricR2
147219-2001SamacSys_Parts:472192001J4
1AO3401ASamacSys_Parts:SOT95P280X125-3NQ1
1AP2112K-3.3TRG1SamacSys_Parts:SOT95P270X145-5NIC1
1AP9101CAK-AKTRG1SamacSys_Parts:SOT95P270X145-5NIC2
1Battery ConnectorConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ1
1Charging LEDCapacitor_SMD:C_0603_1608MetricD4
1DEBUG CONNECTOR ST-LINKConnector_PinHeader_2.54mm:PinHeader_1x07_P2.54mm_VerticalJ5
1DISPLAYConnector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ3
1LFXTAL085871SamacSys_Parts:LFXTAL085871Y2
1MCP73831-2ATI_OTSamacSys_Parts:SOT95P270X145-5NIC4
1OPT3001DNPRQ1SamacSys_Parts:SON65P200X200X65-7N-DIC6
1RotaryEncoder_SwitchRotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mm_MountingHolesSW1
1SHT3X-DISSamacSys_Parts:SON50P250X250X100-9N-DIC7
1SS14SamacSys_Parts:DIOM5026X230ND5
1STM32F103C8T6SamacSys_Parts:QFP50P900X900X160-48NIC8
1USB_C_Receptacle_USB2.0_16PConnector_USB:USB_C_Receptacle_GCT_USB4105-xx-A_16P_TopMnt_HorizontalJ2

Similar boards

  • 4 layers90 × 50 mmCryobelt, the printed circuit board in 3D

    Cryobelt

    michael201110/cryobelt

    100 parts1
  • 2 layers21.2 × 77.6 mmESPFridge, the printed circuit board in 3D

    ESPFridge

    Ehryk/ehryk.github.com

    Code

    30 parts2
  • 2 layers45 × 45 mmWatch, the printed circuit board in 3D

    Watch

    DINDIN2007/Blystwatch

    This is a demo board to showcase development with both the BlystL15 (based on the nrf54L15) and the IOComposer AI from I-Syst.inc.

    47 parts
  • 4 layers160 × 90 mmMotherboard v3C, the printed circuit board in 3D

    Motherboard v3C

    Astronuat21/4DS

    An unnofficial succesor to the Nintendo 3DS.

    373 parts5AGPL-3.0
  • 6 layers76.5 × 339.8 mmFmc host, the printed circuit board in 3D

    Fmc host

    open-ephys/onix-fmc-host

    FMC board to acquire from ONIX headstages and breakout boards

    320 parts5
  • 8 layers58 × 117 mmRight io, the printed circuit board in 3D

    Right io

    EwoudVV/ducktop2

    An open-source 16-inch laptop designed from scratch.

    174 parts26MIT
  • 2 layers65 × 40 mmRS485 V4, the printed circuit board in 3D

    RS485 V4

    jiazhengfu912-lang/STM32-Isolated-RS485-DevBoard

    STM32F103C8T6 isolated RS485 development board: KiCad schematic, PCB, 3D previews and engineering validation

    63 parts
  • 2 layers304.8 × 95.3 mmSM65, the printed circuit board in 3D

    SM65

    Charading/SM65

    SM65

    290 parts

Questions

How big is the STM32-S Plant PCB?

It measures 40 × 58 mm and has 4 copper layers, 1.6 mm thick.

What parts does the STM32-S Plant use?

59 parts, built around the STM32F103C8T6, OPT3001DNPRQ1, AP2112K-3.3TRG1 and AP9101CAK-AKTRG1. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the STM32-S Plant KiCad files?

From the Fred98246/STM32-Environmental-Sensor-and-Datalogging-Board repository on GitHub, at the commit this page was made from: the board is hardware/STM32-S-Plant.kicad_pcb and its schematic hardware/STM32-S-Plant.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the STM32-S Plant design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).