Skip to the content
2 layers100.5 × 83 mmPicoLogger, the printed circuit board in 3D

A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

Size
100.5 × 83 mm
Copper layers
2
Thickness
1.6 mm
Parts
65
Nets
73
Pads
219
Tracks, vias
421, 43
Pours
2
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
24 May 2026
Updated
24 May 2026

Overview

PicoLogger is an open-source printed circuit board by WestianPKl, from the WestianPKl/Logger_Dashboard repository on GitHub. It is a 2-layer board of 100.5 × 83 mm with 65 parts on 73 nets, routed with 421 tracks and 43 vias.

It is built around the LTV-817S-TA1-C and PCF8563T/5. Its parts include 22 resistors, 12 diodes, 8 connectors, 6 switches and 5 ICs. It belongs with the RP2040 boards of this library.

Main components

2

README

README.md

🌡️ IoT Logger Dashboard

A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices. The system integrates custom-built hardware (ESP32, STM32, MicroPython nodes) with a modern web dashboard, communicating over MQTT and WebSockets for real-time data streaming.


📋 Table of Contents


Overview

IoT Logger Dashboard is designed to monitor environmental conditions (temperature, humidity, atmospheric pressure, altitude, voltage) across multiple locations. Sensor nodes deployed in buildings collect data and transmit it via MQTT to a centralized backend. Users interact with the system through a responsive web dashboard that provides real-time charts, floor plan visualizations, equipment management, and a full role-based administration panel.

Key metrics:

  • 380+ tracked devices (loggers, sensors, relays)
  • 247,000+ recorded measurements
  • 12 measurement parameter types
  • Multi-location, multi-floor support
  • 90 concurrent database connections
  • 4 JWT token types for layered security

Architecture

text
┌──────────────────┐      MQTT       ┌──────────────────┐     HTTP/WS     ┌──────────────────┐
│   Sensor Nodes   │ ──────────────► │     Backend      │ ◄────────────── │    Frontend      │
│                  │                 │                  │ ──────────────► │                  │
│  ESP32 + STM32   │  devices/+/    │  Express.js 5.2  │   Socket.io     │  React 19 + TS   │
│  MicroPython     │  status        │  Sequelize ORM   │   4.8           │  MUI 7 + Redux   │
│  SHT40 / BME280  │                │  MQTT Client     │                 │  ECharts + XYFlow│
│  PCF8563T RTC    │  ◄──────────── │  Socket.io 4.8   │                 │  RTK Query       │
│                  │  devices/      │  Sharp + Multer  │                 │  Vite 7.3 (SWC)  │
│                  │  {id}/cmd      │  Nodemailer      │                 │                  │
└──────────────────┘                 └────────┬─────────┘                 └──────────────────┘
                                              │
                                     ┌────────▼─────────┐
                                     │   MySQL 9.x DB   │
                                     │  14 tables       │
                                     │  5 views         │
                                     │  Pool: 90 conn   │
                                     └──────────────────┘

Technology Stack

Backend

TechnologyVersionPurpose
Node.jsES ModulesRuntime environment
Express.js5.2.1HTTP framework
Sequelize6.37.7MySQL ORM with transactions & soft deletes
mysql23.16.1MySQL driver
Socket.io4.8.3Real-time WebSocket communication
MQTT.js5.14.1IoT message broker client
JSON Web Token9.0.3Authentication (4 token types)
express-validator7.3.1Request body validation
bcryptjs3.0.3Password hashing
Sharp0.34.5Image processing & WebP conversion
Multer2.0.2File upload handling (500KB limit)
Nodemailer7.0.12Email via Gmail SMTP (password reset)
Morgan1.10.1HTTP access logging
Compression1.8.1Gzip response compression
uuid13.0.0Unique filename generation
dotenv17.2.3Environment variable management
Jest30.2.0Testing framework
Supertest7.2.2HTTP integration testing
ESLint + Prettier—Code quality & formatting

Frontend

TechnologyVersionPurpose
React19.2.3UI framework
TypeScript5.9.3Type safety
Vite7.3.1Build tool (SWC transpiler)
Material UI (MUI)7.3.7Component library
MUI X Data Grid8.26.0Advanced sortable/paginated tables
Redux Toolkit2.11.2State management with RTK Query
React Redux9.2.0React-Redux bindings
React Router7.13.0Client-side routing with loaders
Socket.io Client4.8.3Real-time device updates
ECharts3.0.6Time-series data visualization
XYFlow (React Flow)12.10.0Graph / flow diagrams
Styled Components6.3.8CSS-in-JS styling
Emotion11.14.0MUI styling engine
xlsx0.18.5Excel spreadsheet generation
file-saver2.0.5Client-side file download
jwt-decode4.0.0Client-side JWT inspection

Embedded / Logger

TechnologyPurpose
ESP32 (MicroPython)Main IoT gateway — WiFi, MQTT, UART to STM32
STM32L476RG / STM32F412RG (CMSIS)Low-level sensor hub — bare-metal C with DMA
MicroPython (generic)Standalone sensor nodes — HTTP POST to API
PlatformIOSTM32 build & flash toolchain
KiCadPCB schematic & layout design

Sensors & Peripherals

ComponentTypeMeasurements / Function
SHT30 / SHT40I2C sensorTemperature (-40–125°C), Humidity (0–100%)
BME280I2C sensorTemperature, Humidity, Atmospheric Pressure, Altitude
PCF8563TI2C RTCReal-Time Clock with battery backup
I2C LCDDisplaySensor readings & status display
RGB LEDsOutputStatus indication (PWM, 0–65535 range)
Relay moduleOutput4-channel relay control (pins 12–15)
BuzzerOutputAudible alerts on threshold breach
Push ButtonsInputUser interaction (debounced, long-press 3s)

Features

  • Real-Time Monitoring — Live sensor data via MQTT → Socket.io WebSocket pipeline with per-logger events
  • Interactive Charts — Time-series visualization with ECharts, range selection, and XLSX export
  • Floor Plan Visualization — Upload floor plan images, place loggers with x/y positioning and zoom control
  • Multi-Location Support — Organize devices by house → floor → logger hierarchy
  • Equipment Inventory — Full CRUD for loggers, sensors, relays with soft delete and restore
  • Device Telemetry — Track firmware/hardware versions, serial numbers, build dates, IP address, last seen
  • Sensor Capability Mapping — Many-to-many mapping of sensors to data definition parameters
  • Role-Based Access Control — Three-dimensional permission matrix: functionality × object × access level
  • Superuser Override — Superuser flag bypasses all permission checks
  • User Management — Registration, login, avatar upload with Sharp WebP conversion, password reset via Gmail SMTP
  • Data Export — Export sensor data to XLSX spreadsheets with pivot view support
  • Error Tracking — Log device and system errors with type (Equipment/DB/Other) and severity (Critical→Info)
  • Equipment Event Logs — Track STATUS, DATA, OTA, ERROR events per device
  • Process Management — Define and manage operational process types and definitions
  • Audit Trail — created_by / updated_by user tracking on all key entities
  • OTA Support — Custom UART bootloader for STM32 firmware updates (app at 0x08008000)
  • Service Mode — ESP32 3-hour OTA window for configuration and firmware updates
  • Image Processing — Automatic thumbnail generation and WebP conversion for avatars and floor plans
  • HTTP Access Logging — Morgan combined-format logging to access.log
  • Gzip Compression — Response compression via compression middleware
  • Transaction Safety — Sequelize transactions with rollback on all write operations

Project Structure

text
Logger_Dashboard/
│
├── backend/                    # Node.js Express API server
│   ├── server/
│   │   ├── app.js              # Express app setup, middleware, CORS
│   │   ├── mqttClient.js       # MQTT subscriber & data processing
│   │   ├── api/
│   │   │   ├── controller/     # Request handlers
│   │   │   ├── model/          # Sequelize models
│   │   │   └── routes/         # Express route definitions
│   │   ├── bin/www.js          # HTTP server bootstrap + Socket.io init
│   │   ├── libs/jwtToken.js    # JWT generation (4 token types)
│   │   ├── middleware/
│   │   │   ├── body-validation.js   # Request body validation
│   │   │   ├── file.js              # File upload handling (multer)
│   │   │   ├── jwtValidation.js     # JWT auth + permission checking
│   │   │   └── socket.js           # Socket.io middleware
│   │   └── util/
│   │       ├── database.js          # Sequelize connection config
│   │       ├── nodemailer.js        # Email transport setup
│   │       ├── responseHelper.js    # Standardized API responses
│   │       └── sequelizeTools.js    # Query builder utilities
│   ├── uploads/                # Uploaded files (avatars, floor plans)
│   ├── data.json               # Static configuration data

Backend

Express API Server

The backend is a Node.js Express 5.2 server with ES module support. It provides a RESTful API, handles MQTT message ingestion from IoT devices, and broadcasts real-time updates to connected clients via Socket.io.

Middleware stack (in order):

  1. CORS — Configurable origins via FRONTEND_ORIGIN_DEV / FRONTEND_ORIGIN_PROD env vars (comma-separated)
  2. Compression — Gzip response compression
  3. Morgan — HTTP access logging (combined format → access.log)
  4. Express JSON/URL-encoded — Body parsing with 10MB limit
  5. Cookie Parser — Cookie handling
  6. Static Files — Serves /uploads and frontend build (dist-frontend/)
  7. JWT Validation — Bearer token verification on protected routes
  8. Permission Checking — Granular RBAC enforcement per endpoint

Route mounting:

Mount PathModule
/api/userUser
/api/dataData
/api/equipmentEquipment
/api/processProcess
/api/houseHouse
/api/commonError Logs
/api/mqttMQTT
/api/admAdmin

Error handling:

  • 404 → notFound() for unknown routes
  • Global error handler → internalServerError()
  • In production, unknown routes serve index.html (SPA fallback)

Standardized API response format:

json
{
	"success": true,
	"message": "Description of result",
	"data": {}
}

HTTP status code helpers: 200, 201, 204, 400, 401, 403, 404, 409, 422, 429, 500, 503

File Upload & Image Processing

SettingValue
Max file size500 KB
MIME typesimage/png, image/jpeg, image/jpg
Storageuploads/ directory
Filename${uuid()}.${extension}
ProcessingSharp — auto WebP conversion, thumbnail generation

Image variants stored:

  • Avatars: avatar (thumbnail) + avatar_big (full-size)
  • House pictures: picture_link + picture_link_big
  • Floor layouts: layout (small) + layout_big (full-size)

MQTT Data Pipeline

When sensor data arrives over MQTT:

  1. Message is parsed from the devices/+/status topic (QoS 0)
  2. Message type is identified: DATA, STATUS, ERROR, or OTA
  3. Timestamps are normalized to Europe/Warsaw timezone (UTC+1/+2)
  4. For DATA messages:
    • SHT40 readings extracted → temperature, humidity
    • BME280 readings extracted → temperature, humidity, pressure → atmPressure, altitude
    • Voltage readings extracted → vin array → individual voltage values
    • Each measurement matched to DataDefinition by name
    • DataLogs record created with value + timestamp
    • DataLastValue cache replaced with latest reading
  5. For all messages: EquStats updated (firmware versions, serial numbers, build dates, IP, last_seen)
  6. Socket.io emits logger_${loggerId} event with 'refresh' payload
  7. For ERROR messages: ErrorLog record created in database

MQTT connection config:

text
Reconnect period: 2000ms
Keep-alive: 30s
Clean session: true

Frontend

React SPA

The frontend is a single-page application built with React 19, TypeScript, and Material UI 7. It uses Redux Toolkit with RTK Query for API calls and Socket.io for real-time updates.

State management (Redux store slices):

  • accountSlice — User profile data, avatar
  • authenticateSlice — JWT tokens, login state, permissions
  • applicationSlice — Global UI state (snackbar alerts, loading indicators)
  • api — RTK Query endpoints with auto-caching and tag-based invalidation

RTK Query features:

  • Auto Bearer token injection from localStorage
  • 401 error handling → automatic logout + redirect to /login
  • Zero retry policy (maxRetries: 0)
  • Cache tags: User, Equipment, House, Data, Admin (14 tag types)

Socket.io client:

  • Timeout: 5000ms, reconnection attempts: 3, delay: 1000ms
  • Listens to logger_${loggerId} events for per-device data refresh

Routes & Pages

text
/ ........................... Main menu
/login ...................... Login page
/register ................... Registration page
/logout ..................... Logout action
/password-reset ............. Request password reset email
/password-reset/:token ...... Complete password reset

/house ...................... House management
  /house/houses ............. House list & CRUD
  /house/floors ............. Floor list & CRUD
  /house/loggers ............ Logger placement management
/house-details/:houseId ..... Floor plan viewer with logger positions

/equipment .................. Equipment inventory
  Types, vendors, models, equipment CRUD
  Equipment log viewer

/logs/:equLoggerId .......... Equipment event log

/data ....................... Data module
  /data ..................... Data summary & definitions
  /data/data-logger/:id ..... Time-series chart view (ECharts)

/admin-panel ................ Administration

Module views:

ModuleDescription
DashboardReal-time overview cards with latest device readings
DataTime-series charts (ECharts), pivot tables, XLSX export, layout visualization
EquipmentCRUD for devices, vendors, models, types; soft delete/restore; event logs
HouseLocation CRUD, floor plans with image upload, interactive logger placement
House DetailsFloor plan viewer with logger positions, floor tree navigation, edit forms
AdminFunctionality/object/access level definitions, role CRUD, permission matrix
UserLogin, registration, profile with avatar upload, password reset, permission view
ProcessProcess type & definition management

Reusable Components

18 Select dropdowns: HouseSelect, HouseFloorSelect, EquipmentSelect, EquipmentVendorSelect, EquipmentTypeSelect, EquipmentModelSelect, EquipmentLoggerSelect, EquipmentSensorSelect, DataDefinitionSelect, AdminUserSelect, AdminAccessLevelSelect, AdminFunctionalityDefinitionSelect, AdminObjectDefinitionSelect, and more.

UI components: SnackBar (alert notifications), LoadingCircle (spinner), Wrapper (layout), TabPanel (tabbed content).


Logger Firmware

ESP32 (MicroPython) — IoT Gateway

The ESP32 acts as the main IoT gateway, bridging STM32 sensor hardware to the cloud. On boot it:

  1. Configures GPIO pins (status LED, STM32 control, power LED)
  2. Initializes I2C bus for sensor modules and LCD
  3. Connects to WiFi (up to 20 retries, 1s each)
  4. Synchronizes time via NTP (UTC+1, max 10 retries)
  5. Initializes MQTT connection to the broker
  6. Establishes UART communication with the STM32 (115200 baud)
  7. Enters the main loop publishing status and sensor data

GPIO Configuration:

PinFunctionMode
18Status interruptInput, IRQ rising
19STM32 PWM controlOutput
22Status LEDOutput

STM32 UART Protocol:

  • Baud rate: 115200
  • Device address: 0xB2
  • Frame length: 32 bytes
  • Status OK: 0x40, Error: 0x7F
  • Authentication key for secure UART communication

I/O Mapping (via STM32):

IDInputsIDOutputs
0x01BTN10x01LED1
0x02BTN20x02LED2
0x03ESP_STS0x03–0x07PB12, PC0–PC3

FRAM Persistent Storage:

  • 0x008 — Logger ID
  • 0x028 — Sensor ID
  • 0x128 — Measurement interval

Key features:

  • Service Mode: 3-hour OTA update window (triggered by command)
  • Debounced IRQ handling (50ms debounce)
  • Color mapping for RGB LEDs (0–255 → 0–65535 PWM)
  • Automatic WiFi reconnection (5s interval)
  • MQTT keepalive: 7200s (2 hours)
  • Error reporting to backend via HTTP POST (3s timeout)

STM32 (Bare-Metal C / CMSIS) — Sensor Hub

The STM32 handles all low-level sensor communication using DMA for efficient, non-blocking peripheral access.

Target MCUs:

MCUBoardFrameworkDebug
STM32L476RGNUCLEO-L476RGCMSISST-Link
STM32F412RGT6Custom PCBCMSISST-Link

Memory layout:

text
0x08000000 ─ Bootloader (UART-based, for OTA updates)
0x08008000 ─ Application (sensor management + data streaming)
0x080FF800 ─ Info page (device production data, flashed via OpenOCD)

Application source modules (bare-metal C):

ModuleFunction
main.cSystem init, DMA config, main state machine
adc_dma.cADC voltage readings with DMA transfer
bme280_dma.cBME280 pressure/altitude sensor (I2C + DMA)
sht40.cSHT40 temperature/humidity sensor
pcf8563t_dma.cPCF8563T RTC clock with DMA
i2c_dma.cI2C peripheral driver with DMA
spi_dma.cSPI peripheral driver with DMA
uart_dma.cUART communication with ESP32 (115200 baud)
dma.cDMA controller configuration
lcd.cLCD display driver
rtc.cInternal RTC peripheral
irq.cInterrupt request handlers
timer.cGeneral-purpose timers (PWM, compare)
systick.cSystem tick timer (1ms resolution)
support.cSystem support (clock config, reset)

Bootloader: Minimal UART bootloader (main.c, uart.c, systick.c) enabling firmware updates without physical access to the device.

MicroPython Sensor Nodes — Standalone

Independent nodes that periodically read sensors and POST data directly to the backend REST API (no MQTT).

FilePurpose
main.pyBoot, WiFi, sensor loop, HTTP POST
config.pyIDs, WiFi, server URL, intervals
sht30.pySHT30 full driver (I2C protocol)
sht30_simple.pySHT30 simplified driver
sht40.pySHT40 driver
bme280_i2c.pyBME280 driver (pressure/altitude)
i2c_lcd.pyI2C LCD display driver
lcd_api.pyLCD abstraction layer
rtc_clock.pyPCF8563 RTC full driver
rtc_simple.pyRTC simplified driver
test.pySensor interface tests

Configuration:

  • Post interval: 600 seconds (configurable)
  • Endpoint: http://{SERVER_IP}:{PORT}/api/data/data-log
  • Thresholds: Temperature 20–25°C, Humidity 30–80% (triggers buzzer/LED alerts)
  • LCD backlight auto-off: 20 seconds
  • Long-press button detection: 3000ms threshold

Database

MySQL 9.x database with 14 tables and 5 views. Connection pool: max 90 connections, idle timeout 10s, timezone UTC.

Entity-Relationship Overview

text
┌───────────┐    ┌───────────────┐    ┌─────────────┐
│   users   │───►│ adm_roles_user│◄───│  adm_roles  │
└─────┬─────┘    └───────────────┘    └──────┬──────┘
      │                                      │
      │          ┌───────────────────┐        │
      └─────────►│  superusers       │        │
                 └───────────────────┘        │
      │                                      ▼
      ▼                              ┌──────────────────────┐
┌─────────────────┐                  │ adm_functionality_def│
│ adm_permissions  │◄────────────────└──────────────────────┘
│ (user/role →     │                 ┌──────────────────────┐
│  func → obj →    │◄────────────────│ adm_object_definition│
│  access level)   │                 └──────────────────────┘
└─────────────────┘                  ┌──────────────────────┐
                                     │ adm_access_level_def │
                                     └──────────────────────┘

┌───────────┐    ┌─────────────┐    ┌────────────┐
│ equ_type  │◄───│equ_equipment│───►│ equ_vendor │
└───────────┘    └──────┬──────┘    └────────────┘
                        │           ┌────────────┐
                        ├──────────►│ equ_model  │
                        │           └────────────┘

Complete Table Reference

Users & Authorization
TableKey ColumnsRecords
usersid, username (UNIQUE), email (UNIQUE), password (bcrypt), avatar, avatar_big, reset_password_token, reset_password_expires, confirmed~23
superusersid, user_id (FK → users) — bypasses all permission checks~2
adm_roles_userrole_id (PK), user_id (PK) — many-to-many—
Admin Permissions
TableKey ColumnsRecords
adm_rolesid, name, description, created_by_id, updated_by_id~4 (Admin, Common, Technician)
adm_functionality_definitionid, name, description~17 (equ, house, data, adm, process, common)
adm_object_definitionid, name, description~27 (equType, equVendor, equEquipment, houseHouse, houseFloor, dataDefinition, etc.)
adm_access_level_definitionid, name, access_level (INT)~20 (READ, WRITE, DELETE, Admin; levels 0–50)
adm_permissionsid, user_id (nullable), role_id (nullable), adm_functionality_definition_id, adm_object_definition_id (nullable), adm_access_level_definition_id~56
Equipment
TableKey ColumnsRecords
equ_typeid, name~14
equ_vendorid, name~18
equ_modelid, name~21
equ_equipmentid, serial_number, equ_vendor_id, equ_model_id, equ_type_id, created_by_id, updated_by_id, deleted_at, is_deleted~380
equ_sensor_functionsequ_sensor_id (PK), data_definition_id (PK) — composite key, M:M—
equ_statsid, equipment_id, last_seen, sn_contr, fw_contr, hw_contr, build_contr, prod_contr, sn_com, fw_com, hw_com, build_com, ip_address~3,045
equ_logid, equipment_id, message, type (ENUM: STATUS/DATA/OTA/ERROR/OTHER)~32
Data Measurements
TableKey ColumnsRecords
data_definitionsid, name, unit, description~12 (temperature °C, humidity %, atmPressure hPa, altitude m, voltage V)
data_logsid, value, data_definition_id, equ_logger_id, equ_sensor_id, time~247,158
data_last_valueid, data_log_id, equ_logger_id, equ_sensor_id, data_definition_id~247,150
Houses & Locations
TableKey ColumnsRecords
house_houseid, name, postal_code, city, street, house_number, picture_link, picture_link_big, created_by_id, updated_by_id~60
house_floorsid, name, layout, layout_big, house_id, x, y, zoom, pos_x, pos_y~17
house_loggerid, equ_logger_id (UNIQUE), house_floor_id, pos_x, pos_y~38
Other
TableKey ColumnsRecords
process_typeid, name~6
process_definitionid, process_type_id, name, created_by_id, updated_by_id~2
error_logid, message, details (JSON), type (Equipment/DB/Other), severity (Critical/Error/Warning/Info), equipment_id (nullable)~937

Database Views

ViewPurpose
adm_view_permissionFlattened permission matrix joining adm_permissions with adm_roles
data_view_last_valueLatest sensor values enriched with time, value, parameter name, unit, floor IDs
data_view_logsPivoted data logs — columns: temperature, humidity, atmPressure, altitude
data_view_connected_sensorSensors connected to loggers on house floors with vendor, model, serial
equ_view_unused_loggerLoggers of type 'logger' not yet assigned to any house floor

Authentication & Authorization

JWT Token System

TypeExpirySecretPurpose
05 hoursTOKENStandard authentication
1365 daysTOKEN"Remember me" persistent session
25 hoursTOKEN_SECRET_PERMISSIONPermission token (stores user perms)
31 minuteTOKENShort-lived data access token

Protected routes require a Bearer token in the Authorization header. The middleware validates the token signature and attaches the decoded user object to req.user.

Login Flow

text
1. User submits username + password → POST /api/user/user-login
2. Backend finds user by username in users table
3. bcrypt.compare() against stored password hash
4. On success:
   ├─ Generate Type 0 auth token (5h) with TOKEN secret
   ├─ Generate Type 2 permission token (5h) with TOKEN_SECRET_PERMISSION
   └─ Return both tokens to frontend
5. Frontend stores both tokens in localStorage
6. Permission token used for client-side UI access control
7. Auth token sent as Bearer header on every API request

Password Reset Flow

text
1. User submits email → POST /api/user/reset-password-request
2. Backend generates reset token + expiry, saves to users table
3. Nodemailer sends email via Gmail SMTP with reset link
4. User clicks link → POST /api/user/reset-password/:token
5. Backend validates token + expiry, hashes new password, clears token

Role-Based Access Control (RBAC)

Permissions are defined as a three-dimensional matrix:

text
Permission = Functionality × Object × Access Level
  • Functionality — module scope: equ, house, data, adm, process, common (~17 definitions)
  • Object — resource type: equType, equVendor, equEquipment, houseHouse, houseFloor, dataDefinition, etc. (~27 definitions)
  • Access Level — operation: READ, WRITE, DELETE, Admin (levels 0–50, ~20 definitions)

Permission resolution (checkPermission()):

text
1. Extract user from JWT token
2. Find direct user permissions (adm_permissions.user_id = userId)
3. Find user's roles via adm_roles_user
4. Find role-based permissions (adm_permissions.role_id IN userRoles)
5. Combine all permissions
6. Check superuser flag → if superuser, grant all (bypasses checks)
7. Match required: functionality + object (optional) + accessLevel
8. Return 403 Forbidden if no match

Default Roles:

RoleCapabilities
CommonRead-only access across modules
TechnicianRead + limited write on equipment and data
AdminFull access including user and permission management

Permissions support both user-specific (user_id set, role_id null) and role-based (role_id set, user_id null) assignment, allowing fine-grained overrides.


MQTT Communication

Topic Structure

text
Inbound (Device → Backend):   devices/+/status     (subscribed, QoS 0)
Outbound (Backend → Device):  devices/{deviceId}/cmd  (published via API)

Message Format

json
{
	"type": "DATA",
	"result": "OK",
	"info": {
		"logger_id": 376,
		"sensor_id": 377,
		"rtc": "2026-03-22T10:30:00",
		"ip_address": "192.168.1.100",
		"controller_serial": "SN-001",
		"controller_sw": "v1.2.3",
		"controller_hw": "v2.0",
		"controller_build_date": "2025-12-01",
		"controller_prod_date": "2025-11-15",
		"communication_sw": "v1.0.0",
		"communication_build": "2025-12-01",
		"communication_prod": "2025-11-15",
		"sht40": {
			"temperature": "23.45",
			"humidity": "55.20"
		},
		"sht40_error": 0,
		"bme280": {
			"temperature": "23.40",
			"humidity": "55.10",

Message Types

TypeBackend Action
DATAStore sensor values in data_logs, update data_last_value, update equ_stats, emit Socket.io event
STATUSUpdate equipment telemetry (equ_stats)
ERRORCreate error_log record with device details
OTAPrepared for over-the-air firmware update handling

Connection Configuration

ParameterValue
QoS0 (at most once)
Keepalive30 seconds
Reconnect period2000ms
Clean sessiontrue
Timezone normalizationEurope/Warsaw

Hardware

PCB Designs (KiCad)

Custom PCB designs located in docs/PCB/PicoLogger/:

BoardDescription
IoT_Logger_B_1.0Base logger board, revision B
IoT_Logger_C_1.0Base logger board, revision C
Pico_TH_Logger_SMD_PCF8563T_2.1SMD temperature/humidity logger with RTC
Pico_TH_Logger_Relay_SMD_PCF8563T_2.1SMD logger with relay output + RTC

3D-Printable Enclosures

Located in docs/Cover/PicoLogger/:

  • Pico_TH_Logger — Standard logger enclosure
  • Pico_TH_Logger_Relay — Relay variant enclosure
  • ButtonExtender.stl — Button extender accessory

STM32 Reference Documentation

MCU datasheets, reference manuals, and safety library guides are stored alongside each target in logger/STM32/STM32F412RGT6/ and logger/STM32/STM32L4/.


Getting Started

Prerequisites

  • Node.js (v18+)
  • MySQL 9.x
  • MQTT Broker (e.g., Mosquitto)
  • PlatformIO (for STM32 firmware development)
  • Python 3 (for MicroPython device flashing)

1. Database Setup

bash
# Create the database and load schema
mysql -u root -p < database/db.sql

# Load seed data (types, roles, definitions)
mysql -u root -p < database/db_data.sql

2. Backend Setup

bash
cd backend
npm install

# Copy the example file and fill in your values
cp .env.example .env

# Development
npm run dev

# Production
npm run prod

The server starts on port 3000 (dev) or 8000 (prod) by default.

3. Frontend Setup

bash
cd frontend
npm install

# Copy the example file and fill in your values
cp .env.example .env

# Development
npm run dev

# Production build
npm run build:prod

The dev server runs at http://localhost:5173.

4. Logger Firmware

ESP32 / MicroPython:

  1. Edit config.py with your WiFi, MQTT, and device IDs
  2. Flash MicroPython firmware to the device
  3. Upload all .py files to the device

STM32:

bash
cd logger/STM32/application
# Build and flash via PlatformIO + ST-Link
pio run --target upload

cd ../bootloader
pio run --target upload

Environment Variables

Backend (.env)

env
# Server Mode
NODE_ENV=development

# Database (Development)
DB_DEV=logger_dashboard
DBUSER_DEV=root
DBPASSWORD_DEV=your_password
DBHOST_DEV=localhost
DBPORT_DEV=3306

# Database (Production)
DB_PROD=logger_dashboard
DBUSER_PROD=root
DBPASSWORD_PROD=your_password
DBHOST_PROD=localhost
DBPORT_PROD=3306

# Server Ports
PORT_DEV=3000
PORT_PROD=8000

# MQTT Broker (Development)
MQTT_URL_DEV=mqtt://localhost:1883
MQTT_USER_DEV=mqtt_user

Frontend (.env)

env
# Backend API URL (used for API calls, Socket.IO and asset URLs)
VITE_API_IP=http://localhost:3000

Logger (config.py)

python
SSID = "your_wifi_ssid"
PASSWORD = "your_wifi_password"
NTP_SERVER_IP = "pool.ntp.org"
MQTT_SERVER = "broker_ip"
MQTT_PORT = 1883
MQTT_USER = "mqtt_user"
MQTT_PASSWORD = "mqtt_password"
LOGGER_ID = 376
SENSOR_ID = 377
SERVER_IP = "backend_ip"
SERVER_PORT = 3000

API Reference

A Postman collection with all endpoints is available at docs/LoggerDashboard.postman_collection.json.

Endpoint Overview

ModuleBase PathAuthEndpointsDescription
User/api/userPartial8Registration, login, profile, password reset
Equipment/api/equipmentYes25+Device CRUD — types, vendors, models, equipment, stats, logs
Data/api/dataYes20Data definitions, logs, last values, chart views
House/api/houseYes16Locations, floors, logger placement
Admin/api/admYes18Roles, permissions, functionality/object/access level definitions
Common/api/commonPartial5Error logging
Process/api/processYes10Process types and definitions
MQTT/api/mqttYes1Send commands to devices

All Endpoints

User (/api/user)
text
POST   /users                          # Get all users (paginated)
GET    /user/:userId                   # Get single user
POST   /user-register                  # Register new user
POST   /user-login                     # Login → JWT tokens
PATCH  /user/:userId                   # Update profile + avatar upload
DELETE /user/:userId                   # Delete user
POST   /reset-password-request         # Send password reset email
POST   /reset-password/:token          # Complete password reset
Equipment (/api/equipment)
text
# Types
POST   /equ-types                      # Get equipment types
GET    /equ-type/:id                   # Get single type
POST   /equ-type                       # Add type
PATCH  /equ-type/:id                   # Update type
DELETE /equ-type/:id                   # Delete type

# Vendors (same CRUD pattern as types)
POST   /equ-vendors                    # Get vendors
GET    /equ-vendor/:id                 # Get vendor
POST   /equ-vendor                     # Add vendor
PATCH  /equ-vendor/:id                 # Update vendor
DELETE /equ-vendor/:id                 # Delete vendor

# Models (same CRUD pattern)
POST   /equ-models                     # Get models
GET    /equ-model/:id                  # Get model
POST   /equ-model                      # Add model
PATCH  /equ-model/:id                  # Update model
DELETE /equ-model/:id                  # Delete model

# Equipment
POST   /equipments                     # Get all equipment
POST   /equipments-admin               # Admin view (includes soft-deleted)
Data (/api/data)
text
# Definitions
POST   /data-definitions               # Get all data definitions
GET    /data-definition/:id            # Get single definition
POST   /data-definition                # Add definition
PATCH  /data-definition/:id            # Update definition
DELETE /data-definition/:id            # Delete definition

# Logs
POST   /data-logs                      # Get data logs (filtered/paginated)
GET    /data-log/:id                   # Get single log
POST   /data-log                       # Add data log
PATCH  /data-log/:id                   # Update log
DELETE /data-log/:id                   # Delete log

# Last Values
POST   /data-last-values               # Get last values
GET    /data-last-value/:id            # Get single last value
POST   /data-last-value                # Add last value
PATCH  /data-last-value/:id            # Update last value
DELETE /data-last-value/:id            # Delete last value

# Views & Special
POST   /data-last-values-view          # Latest values with metadata
POST   /data-connected-sensor-view     # Sensor network topology
House (/api/house)
text
# Houses
POST   /houses                         # Get all houses
GET    /house/:id                      # Get house + floors + loggers
POST   /house                          # Add house + image upload
PATCH  /house/:id                      # Update house + image
DELETE /house/:id                      # Delete house

# Floors
POST   /house-floors                   # Get all floors
GET    /house-floor/:id                # Get single floor
POST   /house-floor                    # Add floor + layout image
PATCH  /house-floor/:id                # Update floor + layout
PATCH  /house-floor-layout/:id         # Update layout position only
DELETE /house-floor/:id                # Delete floor

# Logger Placement
POST   /house-loggers                  # Get logger placements
GET    /house-logger/:id               # Get single placement
POST   /house-logger                   # Add logger to floor
PATCH  /house-logger/:id               # Update position (x, y)
DELETE /house-logger/:id               # Remove from floor
Admin (/api/adm)
text
# Permissions
POST   /adm-permissions                # Get permissions (user/role based)
POST   /adm-permission                 # Add permission
DELETE /adm-permission/:id             # Delete permission

# Functionality/Object/AccessLevel Definitions (same CRUD pattern each)
POST   /adm-functionality-definitions  # Get all
GET    /adm-functionality-definition/:id
POST   /adm-functionality-definition
PATCH  /adm-functionality-definition/:id
DELETE /adm-functionality-definition/:id

POST   /adm-object-definitions
GET    /adm-object-definition/:id
POST   /adm-object-definition
PATCH  /adm-object-definition/:id
DELETE /adm-object-definition/:id

POST   /adm-access-level-definitions
GET    /adm-access-level-definition/:id
POST   /adm-access-level-definition
PATCH  /adm-access-level-definition/:id
DELETE /adm-access-level-definition/:id
Common (/api/common)
text
POST   /error-logs                     # Get error logs (no auth required)
GET    /error-log/:id                  # Get single error
POST   /error-log                      # Add error log
PATCH  /error-log/:id                  # Update error log
DELETE /error-log/:id                  # Delete error log
Process (/api/process)
text
POST   /process-types                  # Get process types
GET    /process-type/:id               # Get single type
POST   /process-type                   # Add type
PATCH  /process-type/:id               # Update type
DELETE /process-type/:id               # Delete type

POST   /process-definitions            # Get definitions
GET    /process-definition/:id         # Get single definition
POST   /process-definition             # Add definition
PATCH  /process-definition/:id         # Update definition
DELETE /process-definition/:id         # Delete definition
MQTT (/api/mqtt)
text
POST   /:deviceId/cmd                  # Send MQTT command to device

Testing

Backend tests use Jest 30.2 with Supertest for HTTP endpoint integration testing. Tests run with experimental VM modules for ESM support.

bash
cd backend

# Run all tests
npm test

# Run specific test file
npx jest server/__tests__/equipment.test.js

Jest configuration:

  • --experimental-vm-modules flag for ES modules
  • --detectOpenHandles for async leak detection
  • --forceExit to prevent hanging on open connections

Test Suites

Test FileCoverage
user.test.jsUser registration, login, profile CRUD, password reset
equipment.test.jsEquipment types, vendors, models, devices, soft deletes
data.test.jsData definitions, logs, views, last values
house.test.jsHouse, floor, logger placement CRUD
adm.test.jsRoles, permissions, admin definitions
common.test.jsError log CRUD
process.test.jsProcess types and definitions

Parts

65
QtyValueFootprintReferences
8220Resistor_SMD:R_0805_2012MetricR1, R2, R3, R4, R5, R6, R7, R20
5LEDLED_SMD:LED_0805_2012MetricD1, D2, D3, D4, D12
4120Resistor_SMD:R_0805_2012MetricR12, R13, R14, R15
41N4007 M7Diode_SMD:D_SMAD6, D7, D8, D9
4470Resistor_SMD:R_0805_2012MetricR8, R9, R10, R11
4BC847B-DIOPackage_TO_SOT_SMD:SOT-23Q1, Q2, Q3, Q4
4G5Q-14-EU-5DCRelay_THT:Relay_SPDT_Omron-G5Q-1K1, K2, K3, K4
4LTV-817S-TA1-CPackage_DIP:SMDIP-4_W9.53mmU1, U2, U3, U4
34K7Resistor_SMD:R_0805_2012MetricR16, R17, R18
3ARK KF301 raster 5,0mm 3 pinTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-3_1x03_P5.00mm_HorizontalJ5, J6, J7
2100KResistor_SMD:R_0805_2012MetricR21, R22
2LL4148-DIODiode_SMD:D_MiniMELFD10, D11
2MountingHoleMountingHole:MountingHole_3.2mm_M3H3, H4
2MountingHole_PadMountingHole:MountingHole_3.2mm_M3_DIN965_PadH1, H2
2Tact Switch 6x6mm / 13mmButton_Switch_THT:SW_PUSH_6mmSW1, SW2
110KResistor_SMD:R_0805_2012MetricR19
132.768K-CFPX217Crystal:Crystal_SMD_3215-2Pin_3.2x1.5mmY1
1ARK KF301 raster 5.0mm 3 pinTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-3_1x03_P5.00mm_HorizontalJ4
1Additional connectorConnector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_HorizontalJ3
1Buzzer 5V 12mmBuzzer_Beeper:Buzzer_12x9.5RM7.6BZ1
1CR2032 3VBattery:BatteryHolder_Keystone_104_1x23mmBT1
1LCD 16x2Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ2
1OSTBPCS2C2BLED_SMD:LED_Avago_PLCC4_3.2x2.8mm_CWD5
1PCF8563TPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU5
1RaspberryPi_Pico_WLibrary:RaspberryPi_Pico_Common_THTA1
1SPIConnector_PinHeader_2.54mm:PinHeader_1x07_P2.54mm_HorizontalJ8
1SensorConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1

More from WestianPKl/Logger_Dashboard

7
  • 2 layers100.5 × 83 mmPicoLogger, the printed circuit board in 3D

    PicoLogger

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    63 parts
  • 2 layers51.5 × 83 mmPicoLogger Small, the printed circuit board in 3D

    PicoLogger Small

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    29 parts
  • 2 layers78.5 × 84 mmPicoLogger, the printed circuit board in 3D

    PicoLogger

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    28 parts
  • 2 layers51.5 × 83 mmPicoLogger Small, the printed circuit board in 3D

    PicoLogger Small

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    27 parts
  • 2 layers51.5 × 83 mmPicoLogger Small, the printed circuit board in 3D

    PicoLogger Small

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    24 parts
  • 2 layers75 × 83.5 mmPico Relay, the printed circuit board in 3D

    Pico Relay

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    19 parts
  • 2 layers62 × 83 mmPicoLogger Small, the printed circuit board in 3D

    PicoLogger Small

    WestianPKl/Logger_Dashboard

    A full-stack IoT monitoring platform for collecting, visualizing, and managing environmental sensor data from distributed devices.

    13 parts

Similar boards

  • 2 layers74 × 38 mmBoop, the printed circuit board in 3D

    Boop

    dekomote/boop

    Power and reset your PC with ESPHome

    27 parts2CC-BY-SA-4.0
  • 4 layers130 × 150 mmCampervan management V2, the printed circuit board in 3D

    Campervan management V2

    akladnig/CamperVan

    - CamperVan Design and Arduino Circuit Design - Campervan Design Overview - Dashboard App - Electrical System - Sensors - Circuit Design - Battery and voltage monitoring - Voltage Divider Design - Low Pass Filter - TODO

    183 parts
  • 2 layers100 × 100 mmUlva controller, the printed circuit board in 3D

    Ulva controller

    ivere27/ulva

    controller board for robotics and agriculture

    106 partsMIT
  • 4 layers159.6 × 130 mmFE UFPR 4 0, the printed circuit board in 3D

    FE UFPR 4 0

    josearistidesbail/FE_UFPR_4_0

    KiCad 10 project for the board that sits between a TI LAUNCHXL-F28379D (runs the FOC firmware) and an Infineon PrimeSTACK 6PS04512E43W39693 inverter driving an EMRAX 208 motor.

    374 parts
  • 2 layers70 × 40 mmHallTapBoard, the printed circuit board in 3D

    HallTapBoard

    ssbingo/samba-solar-track

    Samba Solar Track – Solarnachführung mit Sturmschutz: Handbuch, Platine und Gehäuse für den Nachbau (10,1-Zoll-Version)

    58 parts
  • 2 layers10 × 50.8 mmIN-24V, the printed circuit board in 3D

    IN-24V

    Thierry-oshw/Allumettes

    module 5mm x 34mm de fonction unitaire

    15 partsCERN-OHL-P-2.0
  • 2 layers100.5 × 83 mmPicoLogger, the printed circuit board in 3D

    PicoLogger

    WestianPKl/pcb-docs

    A collection of custom PCB designs created in KiCAD, centered around the Raspberry Pi Pico (RP2040) platform. Each board is a standalone module that connects to the Main Board and extends its functionality via I2C, SPI…

    81 parts

Questions

How big is the PicoLogger PCB?

It measures 100.5 × 83 mm and has 2 copper layers, 1.6 mm thick.

What parts does the PicoLogger use?

65 parts, built around the LTV-817S-TA1-C and PCF8563T/5. 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 PicoLogger KiCad files?

From the WestianPKl/Logger_Dashboard repository on GitHub, at the commit this page was made from: the board is docs/PCB/PicoLogger/Archive/Pico_TH_Logger_Relay_SMD_PCF8563T_2.0/PicoLogger.kicad_pcb and its schematic docs/PCB/PicoLogger/Archive/ESP8266_TH_Logger/ESP8266Logger.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the PicoLogger design in my own project?

Its repository states no licence, so its author keeps all rights: ask WestianPKl before reusing the design.