Skip to the content
2 layers77.1 × 47.9 mmEnvMonDev Continuous Power, the printed circuit board in 3D

This project is a device that measures CO2 concentration, temperature and relative humididty using Sensirion's SCD4x sensor and a Raspberry Pi Zero W. The data is then stored internally and, optionally, transmitted via MQTT.

Size
77.1 × 47.9 mm
Copper layers
2
Thickness
1.6 mm
Parts
33
Nets
22
Pads
86
Tracks, vias
170, 44
Pours
6
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
3 Nov 2025
Updated
10 Sep 2026

Overview

EnvMonDev Continuous Power is an open-source printed circuit board by msbavaresco, from the msbavaresco/Environmental-Monitoring-Device repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 77.1 × 47.9 mm with 33 parts on 22 nets, routed with 170 tracks and 44 vias.

It is built around the AP63205WU, MCP7940N-I/SN and RSX068MP2STR, with the HV-5RGB25 among its other parts. Its parts include 8 capacitors, 6 connectors, 3 resistors, 3 diodes and 2 ICs. It belongs with the sensors and measurement boards of this library.

Main components

4

README

README.md

Environmental Monitoring Device

This project is an open source environmental monitoring device designed to measure and record CO2 concentration, temperature and relative humidity. It uses a Sensirion SCD4x sensor and a Raspberry Pi Zero W to collect and process the data. This data is then stored locally on the device and can optionally be transmitted via MQTT.

Hardware Requirements

  • Raspberry Pi Zero W
  • Sensirion SCD4x sensor (SCD40 or SCD41)
  • Tactile button
  • Common cathode RGB LED

Wiring

The following connections are required for the environmental monitoring device to work. These can be made directly using a Raspberry Pi and the required components, without replicating the PCB.

ComponentRaspberry Pi Pin
SCD4x VCC3.3V
SCD4x GNDGND
SCD4x SDAGPIO2 (Pin 3)
SCD4x SCLGPIO3 (Pin 5)
ButtonGPIO4 (Pin 7)
Blue LEDGPIO14 (Pin 8)
Red LEDGPIO15 (Pin 10)
Green LEDGPIO17 (Pin 11)

The button uses the Raspberry Pi's internal pull-up resistor.

The RGB LED colour mapping is based on the actual LED connections rather than the internal pin order of the LED:

  • GPIO14 (Pin 8) → Blue
  • GPIO15 (Pin 10) → Red
  • GPIO17 (Pin 11) → Green

PCB

A custom PCB was designed for this project to integrate the Raspberry Pi, SCD4x sensor, RTC, power management circuit, button and RGB LED. The PCB design files and schematic are included in the repository.

The custom PCB is not required to reproduce the device. If building the circuit without the PCB, follow the schematic for the required connections and components.

Installation

1. Clone the repository

bash
git clone https://github.com/msbavaresco/Environmental-Monitoring-Device.git
cd Environmental-Monitoring-Device

2. Install required packages

bash
sudo apt update
sudo apt full-upgrade
sudo apt install -y \
    build-essential \
    gcc \
    g++ \
    cmake \
    libgpiod-dev \
    i2c-tools \
    util-linux-extra \
    libpaho-mqttpp-dev \
    libpaho-mqtt-dev \
    nlohmann-json3-dev

3. Enable I2C on the Raspberry Pi

Run:

bash
sudo raspi-config

Then go to:

text
Interface Options -> I2C -> Enable

Reboot:

bash
sudo reboot

4. Set up the MCP7940N RTC

Check that hwclock is available:

bash
command -v hwclock

You should see:

bash
/usr/sbin/hwclock

Check that the RTC was detected:

bash
sudo i2cdetect -y 1

The address for the MCP7940N should show up as:

bash
0x6f

Enable the RTC kernel overlay by editing the Raspberry Pi boot configuration:

bash
sudo nano /boot/firmware/config.txt

Add the following line at the end:

bash
dtoverlay=i2c-rtc,mcp7940x

Save and exit nano:

bash
Ctrl + O
Enter
Ctrl + X

Reboot:

bash
sudo reboot

Confirm the RTC device exists:

bash
ls /dev/rtc*

You should see:

bash
/dev/rtc0

If the Raspberry Pi is connected to the internet, the system time should normally be set automatically using network time synchronisation:

bash
date

If the date is wrong, set it manually (example):

bash
sudo date -s "2026-09-10 09:50:17"

Write the system time to the RTC:

bash
sudo hwclock -w

Check the RTC time is correct:

bash
sudo hwclock -r

5. Create the configuration directory

bash
sudo mkdir -p /var/lib/thisdevice

6. Copy the example configuration file

bash
sudo cp Source/config/config.example.json /var/lib/thisdevice/config.json

7. Edit the configuration file

bash
sudo nano /var/lib/thisdevice/config.json

Example:

json
{
  "mqtt": {
    "host": "localhost",
    "port": 1883,
    "username": "",
    "password": "",
    "base_topic": "envmon"
  },
  "device": {
    "location": "Office",
    "id": "Sensor1",
    "interval_minutes": 15
  }
}

8. Build the project

bash
mkdir build
cd build
cmake ..
make

You should get:

bash
envmonitor

9. Run the program

To be able to shut down the Pi when pressing the button, the program needs to be executed using sudo:

bash
sudo ./envmonitor

Hosting an MQTT Server on the Raspberry Pi

If you want the MQTT server to be hosted on the same device, install the Mosquitto broker and clients:

bash
sudo apt install mosquitto mosquitto-clients

Make Mosquitto start running when the Pi boots:

bash
sudo systemctl enable --now mosquitto

Check the status:

bash
sudo systemctl status mosquitto

It should show:

bash
Active: active (running)

To verify it is working, open two command prompts. First, the subscriber:

bash
mosquitto_sub -h localhost -t test

Then in another command prompt window, the publisher:

bash
mosquitto_pub -h localhost -t test -m "Hello World"

To subscribe to the environmental monitoring device:

bash
mosquitto_sub -h localhost -t "envmon/#"

To subscribe to all MQTT topics:

bash
mosquitto_sub -h localhost -t "#"

Creating a systemd service

By creating a systemd service, the program runs in the background and starts running automatically once the Raspberry Pi boots.

After building the program, copy the executable to /usr/local/bin/:

bash
sudo cp envmonitor /usr/local/bin/envmonitor

Create a new systemd service file:

bash
sudo nano /etc/systemd/system/envmonitor.service

Add the following:

ini
[Unit]
Description=Environmental Monitoring Device
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/envmonitor

Restart=on-failure
RestartSec=5

User=root

[Install]
WantedBy=multi-user.target

Reload service configurations:

bash
sudo systemctl daemon-reload

Enable the service so that it starts automatically when the Raspberry Pi boots:

bash
sudo systemctl enable envmonitor.service

Start the program without needing to reboot:

bash
sudo systemctl start envmonitor.service

Check if the program is running:

bash
sudo systemctl status envmonitor.service

The service should show:

bash
Active: active (running)

Reboot the Raspberry Pi:

bash
sudo reboot

After the Pi starts, check the service status:

bash
sudo systemctl status envmonitor.service

The service should show:

bash
Active: active (running)

To view the program output via the system journal:

bash
sudo journalctl -u envmonitor.service

Useful commands

CommandAction
sudo systemctl start envmonitorStart program
sudo systemctl stop envmonitorStop program
sudo systemctl restart envmonitorRestart program
sudo systemctl status envmonitorCheck status
sudo systemctl enable envmonitorEnable automatic start
sudo systemctl disable envmonitorDisable automatic start
sudo journalctl -u envmonitorView logs
sudo journalctl -u envmonitor -fView logs continuously

Notes

  • The software may need to be adapted if a different LED configuration or GPIO mapping is used.
  • The configuration file must exist at /var/lib/ThisDevice/config.json.
  • I²C must be enabled for the SCD4x sensor to work.
  • Update the MQTT settings and device information in config.json before running the program.
  • The envmonitor service runs as root to allow access to the required hardware interfaces and to perform system shutdown.

Parts

33
QtyValueFootprintReferences
5100nF 16VEnvMonDev_Continuous_Power:CAPACITOR-CC0603RC2, C37, C44, C45, C46
4EnvMonDev_Continuous_Power:STANDOFF-HEX-M2.5, , ,
3EnvMonDev_Continuous_Power:MOUNTING-HOLE-3.2MM, ,
31KEnvMonDev_Continuous_Power:RESISTOR-RC0603RR18, R19, R20
3CONNECTOR-MOLEX-KK6373-02EnvMonDev_Continuous_Power:CONNECTOR-MOLEX-KK6373-02CN2, CN3, CN4
2100uF 10VEnvMonDev_Continuous_Power:CAPACITOR-CC1210RC40, C41
2RSX068MP2STREnvMonDev_Continuous_Power:SOD-123D16, D18
110uF 35VEnvMonDev_Continuous_Power:CAPACITOR-CC0805RC34
132.768 KHzEnvMonDev_Continuous_Power:CRYSTAL-3.20X1.50-2PX1
14.7uH 3AEnvMonDev_Continuous_Power:INDUCTOR-FERRITE-NRS6045TL5
1AP63205EnvMonDev_Continuous_Power:SOT-23-6IC9
1CONNECTOR-RECEPTACLE-2X6-P2.54EnvMonDev_Continuous_Power:CONNECTOR-RECEPTACLE-2X6-P2.54CN6
1HV-5RGB25EnvMonDev_Continuous_Power:LED-RGB-D5.00-P1.588-4PD1
1MCP7940N-I/SNEnvMonDev_Continuous_Power:SOIC-08-150IC4
1POWER BRICKEnvMonDev_Continuous_Power:CONNECTOR-JACK-J4-HORIZCN1
1SENSOREnvMonDev_Continuous_Power:CONNECTOR-RECEPTACLE-1X4-P2.54CN5
1SWITCH-TACTILE-MINI-VERTICALEnvMonDev_Continuous_Power:SWITCH-TACTILE-MINI-VERTICALCH1
1~EnvMonDev_Continuous_Power:SOCKET-BATTERY-CR2032BT1

Similar boards

  • 2 layers96 × 57 mmActivePrecharge RevB, the printed circuit board in 3D

    ActivePrecharge RevB

    lhr-solar/PS-PrechargeBoard

    High-voltage contactor control PCB

    92 parts1
  • 2 layers174 × 97.8 mmTop Level, the printed circuit board in 3D

    Top Level

    TheGreatGambit/Capstone-Electrical

    All the PCB files

    229 partsMIT
  • 4 layers85 × 56 mmAnthC, the printed circuit board in 3D

    AnthC

    Anthilla/AnthC

    Anthilla AnthC Board

    211 parts40
  • 4 layers100 × 100 mmX16fpga, the printed circuit board in 3D

    X16fpga

    eshankiyer/x16-fpga-board

    Commander X16-compatible computer on one 100x100 mm 4-layer board: Spartan-6 + iCE40 (official VERA), SDRAM, two expansion slots. KiCad, JLCPCB fab files, Verilog gateware.

    224 parts
  • 2 layers100 × 100 mmPdu, the printed circuit board in 3D

    Pdu

    SBC-PDU/unit-hardware

    Hardware disign files for SBC PDU

    128 parts
  • 2 layers23.4 × 26.7 mmEpoch, the printed circuit board in 3D

    Epoch

    winneymj/kicad-mem_disp_adaptor

    Memort Display Kicad adapter board

    9 partsMIT
  • 2 layers94.7 × 71.8 mmDevice Board, the printed circuit board in 3D

    Device Board

    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…

    104 parts
  • 2 layers28.3 × 14.3 mmTap Photosensor PCB, the printed circuit board in 3D

    Tap Photosensor PCB

    VoronDesign/Voron-Tap

    Tap is a nozzle-based z-probe for the V2 and Trident printer designs. The entire toolhead moves to trigger an optical switch. Tap offers many advantages:

    18 parts716GPL-3.0

Questions

How big is the EnvMonDev Continuous Power PCB?

It measures 77.1 × 47.9 mm and has 2 copper layers, 1.6 mm thick.

What parts does the EnvMonDev Continuous Power use?

33 parts, built around the AP63205WU, MCP7940N-I/SN, RSX068MP2STR and HV-5RGB25. 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 EnvMonDev Continuous Power KiCad files?

From the msbavaresco/Environmental-Monitoring-Device repository on GitHub, at the commit this page was made from: the board is KiCAD/EnvMonDev_Continuous_Power.kicad_pcb and its schematic KiCAD/EnvMonDev_Continuous_Power.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the EnvMonDev Continuous Power design in my own project?

Its repository publishes it under the GPL-3.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).