Skip to the content
2 layersRoomTwin, the printed circuit board in 3D

A lightweight IoT digital twin for indoor environment monitoring. Room Twin reads real-time sensor data from a physical room and exposes it via MQTT and HTTP, ready to be consumed by any digital twin platform or…

Copper layers
2
Thickness
1.6 mm
Parts
7
Nets
9
Pads
52
Tracks, vias
0, 0
Routed
Not yet
KiCad
KiCad 9.0 (file 20241229)
Created
15 Mar 2026
Updated
15 Mar 2026

Overview

RoomTwin is an open-source printed circuit board by RiccardoCataldi, from the RiccardoCataldi/RoomTwin repository on GitHub. It is a 2-layer board with 7 parts on 9 nets.

It is built around the DHT22. Its parts include 6 connectors and 1 resistor.

Main components

1

README

README.md

Room Twin

A lightweight IoT digital twin for indoor environment monitoring. Room Twin reads real-time sensor data from a physical room and exposes it via MQTT and HTTP, ready to be consumed by any digital twin platform or visualization tool (e.g. Grasshopper/Rhino).

Features

  • Temperature and humidity monitoring (DHT22)
  • Light level monitoring (LDR)
  • Presence detection (HC-SR501 PIR)
  • Local OLED display with rotating pages
  • HTTP web server with auto-refresh dashboard
  • MQTT publishing for IoT integration
  • Resilient: works without MQTT broker, reconnects automatically
  • Node.js dashboard that subscribes to MQTT and streams data to the browser via Socket.IO

Hardware Requirements

ComponentModelNotes
MicrocontrollerESP32 NodeMCU (e.g. AZDelivery, CP2102)WiFi and enough GPIO
Temp/Humidity sensorDHT22 (AM2302)3-pin module
Light sensorLDR photoresistorWith 10k Ohm pull-down resistor
Presence sensorHC-SR501 PIRPowered at 5V
DisplayOLED 0.96" I2C SSD1306128x64 px
Resistor10k OhmFor LDR voltage divider
Breadboard830 tie-pointsOr perfboard for a stable build
Jumper wiresMale-to-male and male-to-female
Power supply5V USB charger (min 1A)Micro-USB

Wiring

ComponentPinESP32 GPIO
DHT22+3.3V
DHT22-GND
DHT22OUTGPIO 4
OLEDVCC3.3V
OLEDGNDGND
OLEDSCLGPIO 22
OLEDSDAGPIO 21
LDRleg A3.3V
LDRleg BGPIO 34 and 10k Ohm to GND
HC-SR501VCC5V
HC-SR501GNDGND
HC-SR501OUTGPIO 32

Software Requirements

For the Node.js dashboard

  • Node.js 18+
  • MQTT broker on your network (e.g. Mosquitto)

For the ESP32 firmware

  • Arduino IDE 2.x
  • ESP32 board package by Espressif (via Board Manager)
  • Libraries:
    • DHT sensor library (Adafruit)
    • Adafruit Unified Sensor
    • PubSubClient (Nick O'Leary)
    • Adafruit SSD1306
    • Adafruit GFX Library

MQTT Broker (optional)

The device works without a broker; MQTT is optional and used when available.

Install Mosquitto on Linux:

bash
sudo apt install mosquitto mosquitto-clients
sudo systemctl enable mosquitto
sudo systemctl start mosquitto

Add to /etc/mosquitto/mosquitto.conf:

text
listener 1883
allow_anonymous true

MQTT Topics

TopicTypeExample
stanza/temperaturafloat24.3
stanza/umiditafloat61.5
stanza/luceint1823
stanza/presenzabool1

HTTP Endpoints (ESP32)

When running the full firmware on the ESP32:

EndpointDescription
http://<ESP32_IP>/Dashboard with auto-refresh
http://<ESP32_IP>/jsonJSON data for integrations

Quick start (Node.js dashboard)

bash
npm install
npm start

Open http://localhost:3000 in your browser. Data updates in real time when the broker receives messages on stanza/#.


Configuration

Node.js dashboard

Environment variables:

  • MQTT_BROKER — MQTT broker URL (default: mqtt://192.168.0.196:1883)
  • PORT — Web server port (default: 3000)

Example:

bash
MQTT_BROKER=mqtt://192.168.0.196:1883 PORT=3000 npm start

ESP32 / ESP8266 sketch

Do not put WiFi or MQTT credentials in the sketch. Use a separate header that is not committed:

  1. Copy the example: cp secrets.example.h secrets.h
  2. Edit secrets.h and set your WiFi SSID, password, and MQTT broker IP.
  3. Do not commit secrets.h; it is listed in .gitignore.

The sketch includes secrets.h and uses WIFI_SSID and WIFI_PASSWORD (and optionally broker address if defined there).


Access from mobile (outside your LAN)

To open the dashboard from your phone when you are not at home:

Option 1: Tailscale (recommended)

  1. On the machine running npm start: install Tailscale and run tailscale up (log in with the link it prints).
  2. On your phone: install the Tailscale app and sign in with the same account.
  3. In Tailscale, find the machine IP (e.g. 100.x.x.x), then in the phone browser open http://100.x.x.x:3000.

No router port forwarding needed.

Option 2: ngrok

For a quick public URL:

bash
ngrok http 3000

Use the generated URL (e.g. https://xxxx.ngrok.io) in your phone browser. On the free tier the URL changes each time you start ngrok.


Check MQTT data

To confirm messages are reaching the broker:

bash
mosquitto_sub -h 192.168.0.196 -t "stanza/#" -v

Next steps

  • PCB design with KiCad
  • 3D-printed enclosure
  • Grasshopper/Rhino digital twin visualization
  • InfluxDB and Grafana time-series dashboard
  • CO2 / air quality sensor (e.g. SGP30)

License

Use and adapt as you like. If you reuse it, a link back or credit is appreciated.

Parts

7
QtyValueFootprintReferences
2Conn_01x19Connector_PinHeader_2.54mm:PinHeader_1x19_P2.54mm_VerticalJ1, J2
110kResistor_SMD:R_0805_2012MetricR1
1DHT22Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ4
1HC-SR501 PIRConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ5
1LDRConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ6
1OLEDConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ3

Similar boards

  • 2 layers271.8 × 114.3 mmArdumower mega shield svn, the printed circuit board in 3D

    Ardumower mega shield svn

    Ardumower/ardumower

    Develop an open source robotic lawn mower (HW+SW reference platform)

    426 parts282
  • 2 layers104.8 × 72.1 mmSST V2 4, the printed circuit board in 3D

    SST V2 4

    mcbittech/souliss-smart-thermostat-WiFi

    ESP8266 WiFi Smart Thermostat based on Souliss IoT Framework

    53 parts110GPL-2.0
  • 2 layers40.6 × 50.8 mmIot sourdough starter monitor, the printed circuit board in 3D

    Iot sourdough starter monitor

    justinmklam/iot-sourdough-starter-monitor

    Tracking the fermentation of sourdough starter over the cloud.

    7 parts93GPL-3.0
  • 2 layers28 × 13 mmDHT22 pcb, the printed circuit board in 3D

    DHT22 pcb

    MakersAsylumIndia/M19O2

    M19O2 open source hardware Oxygen Concentrator based on the Pressure Swing Adsorption cycle aka Skarstorm cycle

    5 parts68MIT
  • 2 layers136 × 100 mmClimateSprinklerController, the printed circuit board in 3D

    ClimateSprinklerController

    kbx81/ClimateSprinklerController

    ESP32-based climate and sprinkler controller for use with ESPHome

    194 parts56
  • 2 layers162 × 60 mmEsp shield, the printed circuit board in 3D

    Esp shield

    felixwittwer/homeassistant_automaic_greenhouse

    A cool Project to make your greenhouse smart. What about automaic irrigation and collecting enviromental data right from your garden.

    20 parts27
  • 2 layers74.9 × 40.6 mmAnavi thermometer, the printed circuit board in 3D

    Anavi thermometer

    AnaviTechnology/anavi-thermometer

    WiFi Smart Thermometer with ESP8266, DHT22, DS18B20, OLED display and slots for up to 3 I2C sensor modules

    25 parts17
  • 2 layers81.3 × 36.8 mmAirQualitySensor, the printed circuit board in 3D

    AirQualitySensor

    Finomnis/AirQualitySensor

    Simple Air Quality sensor based on nRF52840, Zigbee, AM2302/DHT22 and Senseair S8

    44 parts16Apache-2.0

Questions

What parts does the RoomTwin use?

7 parts, built around the DHT22. 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 RoomTwin KiCad files?

From the RiccardoCataldi/RoomTwin repository on GitHub, at the commit this page was made from: the board is kicad/kicad.kicad_pcb and its schematic kicad/kicad.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the RoomTwin design in my own project?

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