Skip to the content
PCBKitNew board
2 layers28.4 × 58.5 mmDhtmon, the printed circuit board in 3D

Temperature and humidity monitor

Size
28.4 × 58.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
17
Nets
27
Pads
65
Tracks, vias
78, 4
Pours
2
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
6 Jul 2024
Updated
11 Aug 2024

Overview

Dhtmon is an open-source printed circuit board by apiculallc, from the apiculallc/dhtmon repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 28.4 × 58.5 mm with 17 parts on 27 nets, routed with 78 tracks and 4 vias.

It is built around the ESP-12F and AMS1117-3.3. Its parts include 4 resistors, 2 ICs, 1 capacitor, 1 diode and 1 connector. It belongs with the home automation and IoT boards and the ESP8266 boards of this library.

Main components

2

README

README.md

Objective

To create a small, contained and "offline" temperature / humidity monitoring system for hard-to-reach places like attics, garages, crawlspaces, sheds etc.

Requirements

Hardware / BOM

Total: ~$8 per board

You can also order the board at our blog at https://www.apicula.com/blog/monitoring-temperature-and-humidity-in-unoccupied-zones/

Build

Clone the repository as git clone --recurse-submodules -j8 git://github.com/apiculallc/dht.git

ESP8266 firmware

  • follow the instructions to setup the ESP-IDF toolchain
  • edit nvs.csv file to specify the location and name of the sensor. You can skip this step and configure everything using WiFi setup
    • wifi_ssid - name of the access point to connect to
    • wifi_password - WiFi password
    • app_location - sensor location ( attic, garage etc )
    • app_mqtt_url - the URL to MQTT broker - this is typically the same location as where you will have InfluxDB and the Hub running
  • run make all to build the flash image
  • run make flash to flash the partition table
  • run make nvs to flash the NVS table with the probe settings

Hub

  • change directory to go
  • run make to build the executable for your platform - you'll need to have Golang installed
  • run make docker to build a docker image

Deployment

With use of Docker Compose everything shall be straightforward:

bash
docker-compose up -d

That should create all the necessary pieces

For step-by-step instructions please read below.

Start Mosquitto

Create a config file mosquitto.conf with the content:

text
persistence false

log_dest stdout
log_type warning
log_timestamp true
connection_messages true

listener 1883

## Authentication ##
allow_anonymous true

Then run Mosquitto in Docker as:

bash
docker run --name mosquitto \
 -d --restart=unless-stopped \ 
 -p 1883:1883 \
 -v `pwd`/mosquitto.conf:/mosquitto/config/mosquitto.conf \
eclipse-mosquitto

This will expose Mosquitto on port 1883 and allow anonymous access.

Start InfluxDB

Run in Docker as:

bash
docker run -d -p 8086:8086 \
  --name=dhtmon-influx \
  --restart=unless-stopped \
  -v "/opt/data/influxdb-dhtmon:/var/lib/influxdb2" \
  -v "/opt/config/influxdb-dhtmon:/etc/influxdb2" \
  -e DOCKER_INFLUXDB_INIT_MODE=setup \
  -e DOCKER_INFLUXDB_INIT_USERNAME=admin \
  -e DOCKER_INFLUXDB_INIT_PASSWORD=admin123456 \
  -e DOCKER_INFLUXDB_INIT_ORG=home \
  -e DOCKER_INFLUXDB_INIT_BUCKET=dhtmon \
  -e `DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=token123456 \
  influxdb:2.7-alpine

This will provision the instance of InfluxDB locally that exposes port 8086 if you need to check on the connection string.

Start Hub

In order to test that the Hub works well, you may use the following command ( assuming you have Golang installed ):

text
APP_MQTT_BROKER=mqtt://127.0.0.1:1883 \
INFLUX_DB=http://127.0.0.1:8086 \
INFLUX_TOKEN=token123456 \
go run main.go

This will build the project and start the service. Normal output should look like:

text
DB http://127.0.0.1:8086
TOKEN token123456
2024/07/03 10:11:12 started processing topics

Now the system is ready to receive data from the sensors.

Alternatively, use Docker container that you built as:

text
docker run --rm \
  -it \
  -e APP_MQTT_BROKER=mqtt://mosquitto:1883 \
  -e INFLUX_DB=http://dhtmon-influx:8086 \
  -e INFLUX_TOKEN=token123456 \
  --link dhtmon-influx \
  --link mosquitto \
  ghcr.io/apiculallc/dhtmon:latest  

DB http://dhtmon-influx:8086
TOKEN token123456
2024/07/04 10:11:12 started processing topics

If the Hub is running without any error, you can automate the process with

bash
docker run --restart=unless-stopped \
  -it \
  -e APP_MQTT_BROKER=mqtt://mosquitto:1883 \
  -e INFLUX_DB=http://dhtmon-influx:8086 \
  -e INFLUX_TOKEN=token123456 \
  --link dhtmon-influx \
  --link mosquitto \
  ghcr.io/apiculallc/dhtmon:latest  

This will start the hub in daemon mode.

Start sensor

Just plug the sensor - it shall connect to the WiFi access point and then start sending data to the topics.

Post-installation steps

There is no LCD screens or anything that can be easily observed by a human being, so it is hard to tell whether the system works as expected. The joy of system level programming! So we shall be creative about our means to verify the functionality.

The easiest way to test that everything works as expected is to use an MQTT client and subscribe to the topics. For example, using mqtt-shell:

bash
mqtt-shell -b mqtt://127.0.0.1:1883
>> sub /home/sensor/#
/home/sensor/attic/temp | 29.3
/home/sensor/attic/humid | 55.9
/home/sensor/garage/temp | 27.1
/home/sensor/garage/humid | 56.1

This indicates that sensors actually transmits data.

To verify that we actually receive something in the database ( InfluxDB ) we need to connect to the DB and run a few queries. As we have the installation that exposes ports 8086 - we can simply open http://127.0.0.1:8086 and use login admin and password admin123456 to peek into the storage. Choose Buckets and select dhtmon: explore

From here, you may want to configure Grafana.

Grafana

This is fairly sophisticated and powerful tool for monitoring and alerting in DevOps world. We're going to use it to render the charts and get the most recent data from the set of probes that we setup.

Installation

Pull the docker image and link it to a container that runs InfluxDB.

bash
docker run --restart=unless-stopped \
	-e GF_SECURITY_ADMIN_USER=admin \
	-e GF_SECURITY_ADMIN_PASSWORD=admin123 \
	--link influxdb \
	-p 3000:3000 \
	-v ./grafana/provisioning/:/etc/grafana/provisioning/ \
	-v ./grafana/dashboards/:/var/lib/grafana/dashboards/ \
	grafana/grafana:10.0.10

This will populate the default data source with the InfluxDB and then create a dashboard that shall look like following ( if you have some data in there from the sensors ).

To "prime" some data and verify that this part works fine, you can use the following command:

bash
cat <<EOF | mqtt-shell -b mqtt://127.0.0.1:1883
pub /home/sensor/garage/temp 32.1
pub /home/sensor/garage/humid 55.0
pub /home/sensor/attic/humid 35.0
pub /home/sensor/attic/temp 40.0
pub /home/sensor/crawlspace/temp 27.0
pub /home/sensor/crawlspace/humid 65.0
EOF
Successfully connected to mqtt broker.

The result can look like:

Dashboard After you run that for some time, the result will be much more interesting:

Dashboard 30 days

Parts

17
QtyValueFootprintReferences
310KResistor_SMD:R_0805_2012MetricR1, R2, R3
2MountingHole_2.1mmMountingHole:MountingHole_2.1mmREF1, REF2
150 mFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC1
1AMS1117-3.3Package_TO_SOT_THT:TO-262-3_VerticalU1
1Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalDEBUG1
1Conn_01x06Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_VerticalGPIO1
1ESP-12FLibrary:ESP-12EU3
1FLASHConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJP1
1LEDLED_THT:LED_D3.0mmD1
1RResistor_SMD:R_0805_2012MetricR5
1SETUPButton_Switch_THT:SW_PUSH_6mmSW1
1VINConnector_USB:USB_A_CNCTech_1001-011-01101_HorizontalJ1

The 15 most common of 17 parts.

Questions

How big is the Dhtmon PCB?

It measures 28.4 × 58.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Dhtmon use?

17 parts, built around the ESP-12F and AMS1117-3.3. 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 Dhtmon KiCad files?

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

Can I use the Dhtmon design in my own project?

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

Similar boards

  • 2 layers49.4 × 35.8 mmWS2812Controller, the printed circuit board in 3D

    WS2812Controller

    klein0r/pcb-ws2812-wifi-controller

    WiFi Controller for WS2812 LED Stripes

    22 parts82MIT
  • 2 layers69.9 × 69.9 mmVelux controller, the printed circuit board in 3D

    Velux controller

    thorio/esphome-projects

    collection of open home automation projects

    35 parts29GPL-3.0
  • 2 layers73.1 × 18.3 mmRJ10Adapter, the printed circuit board in 3D

    RJ10Adapter

    klein0r/pcb-ttl-ftdi-esp-adapter

    PCB to connect a TTL reader either to an FTDI or ESP12-E/F (WiFi)

    16 parts25MIT
  • 4 layers44.5 × 22.5 mmIkea fyrtur, the printed circuit board in 3D

    Ikea fyrtur

    mjuhanne/ikea-fyrtur

    ESP8266 WiFi module PCB for Ikea Fyrtur blinds

    46 parts23MIT
  • 2 layers84.3 × 56.9 mmEbus, the printed circuit board in 3D

    Ebus

    piwko28/smart-home-ebus-adapter

    eBUS adapter PCB for use with ebusd-esp firmware as well as with other UART devices.

    51 parts18GPL-3.0
  • 2 layers67.1 × 62.2 mmFeinstaub, the printed circuit board in 3D

    Feinstaub

    str-dst/feinstaub

    piggyback PCB for the SDS011 sensor

    14 parts8CC-BY-SA-4.0
  • 2 layers63.9 × 81.7 mmWifi modem, the printed circuit board in 3D

    Wifi modem

    hanshuebner/wifi-modem

    PCB to be used with Zimodem

    56 parts6
  • 2 layers80 × 48.8 mmESP8266-Sentinel Kinetic Wired Remote, the printed circuit board in 3D

    ESP8266-Sentinel Kinetic Wired Remote

    alextrical/ESP8266-Sentinel-Kinetic-Wired-Remote

    ESP8266 based Re-implementation of the Vent-Axia Sentinel Kinetic Wired Remote Controller

    48 parts4CERN-OHL-S-2.0