Skip to the content
2 layers43.1 × 63.5 mmHygienie pcb, the printed circuit board in 3D

This is the refactored code for the Hygienie sensor. Application Behavior: The Hygienie sensor operates in an ultra-low-power mode using ESP32 deep sleep.

Size
43.1 × 63.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
10
Nets
23
Pads
52
Tracks, vias
38, 1
Pours
2
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
18 Jan 2024
Updated
14 Nov 2025

Overview

Hygienie pcb is an open-source printed circuit board by Ward21Century, from the Ward21Century/Hygienie repository on GitHub. It is a 2-layer board of 43.1 × 63.5 mm with 10 parts on 23 nets, routed with 38 tracks and 1 via.

It is built around the DFR0478. Its parts include 2 resistors and 1 switch.

Main components

1

README

README.md

Hygienie Project

This is the refactored code for the Hygienie sensor. Application Behavior: The Hygienie sensor operates in an ultra-low-power mode using ESP32 deep sleep. On first boot, the system initializes all modules (WiFi, MQTT, NTP time sync, LCD graphics) and displays a startup animation. After initialization, the device enters deep sleep and wakes under two conditions:

Timer-based wake-up (ESP_SLEEP_WAKEUP_TIMER):

Wakes at user-configured intervals Displays LCD animation If offline readings are buffered, connects to WiFi, sends all accumulated data via MQTT, syncs time with NTP server, then disconnects Returns to deep sleep

External GPIO wake-up (ESP_SLEEP_WAKEUP_EXT0):

Triggered by reed switch on GPIO 27 (detects hygiene event like door opening or dispenser activation) Records timestamp of event using AppMqttAddTime() Displays LCD animation as visual feedback If buffer reaches MAX_OFFLINE_READINGS threshold, immediately connects to WiFi, uploads all data via MQTT, syncs time, then disconnects Returns to deep sleep

The device maintains event timestamps in RTC memory (survives deep sleep) and only activates WiFi/MQTT when needed, minimizing power consumption. All GPIOs are configured for low-power state before each sleep cycle. This architecture allows the sensor to run on battery power for extended periods while reliably capturing and transmitting hygiene compliance data.This means that source code has been refactored into modules, unit-tests have been written for each module and can be run on the esp32 itself for regression testing, and that project values such as wifi network, password, device id, and sleep duration can be entered in a terminal menu.

Project layout

text
hygienie_project                      — Application project directory
  - components                 — Components of the application project
    + appdata                  — Module that describes how the data is structured.
    + appgraphics              — Module that uses graphics libary and displays animations
    + appmqtt                  — Module that encapsulates mqtt client
    + appsleep                 — Module that controls esp32 sleep  mode
    + appwifi                  — Module that encapsulates wifi libraries
  + main                       - Main source files of the application project
  - test                       — Test project directory
    - main                       — test main directory for test runner
      + hygienie_unit_test.c   — hygienie test runner.
  Makefile / CMakeLists.txt    - Makefiles of the application project

When the main application project is compiled, tests are not included. Test project includes the tests by setting TEST_COMPONENTS variable in the project makefile.

Requirements

Hardware required

  • FireBeetle DFR0478, but any esp32 board will work.
  • USB cable - USBA/

Software Requirements

Please look at https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ for installing esp-idf and https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html#get-started-linux-macos-first-steps for configuring and building project on command line.

It is recommended that you run:

text
. $HOME/esp/esp-idf/export.sh

in your terminal.

and create the alias:

text
alias get_idf='. $HOME/esp/esp-idf/export.sh'# Configure the project

For the menu_config:

For the test project, you can open the project configuration menu (idf.py menuconfig) and explore a few options related to Unity under Component Config, Unity unit testing library.

Build and flash

As explained above, this example contains two projects: application project and test project.

text
* Run `idf.py -p PORT flash monitor` in the current directory (`unit_test`).
* Observe the output: a list of random numbers and their mean value.

2. Test project is responsible for running the tests.

text
* Enter `test` directory (`unit_test/test`), and run `idf.py -p PORT flash monitor`.
* Observe the output: results of test case execution.

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Unit Testing

Inside the testable component, unit tests are added into test directory. test directory contains source files of the tests and the component makefile (component.mk / CMakeLists.txt).

text
unit_test
  - components                              - Components of the application project
    - testable
      - include
      - test                                - Test directory of the component
        * component.mk / CMakeLists.txt     - Component makefile of tests
        * test_mean.c                       - Test source file
      * component.mk / CMakeLists.txt       - Component makefile
      * mean.c                              - Component source file

When the main application project is compiled, tests are not included. Test project includes the tests by setting TEST_COMPONENTS variable in the project makefile.

Application project output

text
In main application. Collecting 32 random numbers from 1 to 100:
   5   66   86   98   62   66   40   42    7   62
  33   77   40   54    8   75   39   82   73    4
  22    5   72   78   53    1    6   48   23    1
  84   55
Mean: 45

Test project output

text
#### Executing one test by its name #####

Running Mean of an empty array is zero...
/Users/ivan/e/esp-idf/examples/system/unit_test/components/testable/test/test_mean.c:16:Mean of an empty array is zero:PASS

-----------------------
1 Tests 0 Failures 0 Ignored
OK

Running Mean of an empty array is zero...
/home/user/esp/esp-idf/examples/system/unit_test/components/testable/test/test_mean.c:15:Mean of an empty array is zero:PASS
Test ran in 16ms

-----------------------
1 Tests 0 Failures 0 Ignored
OK
Enter next test, or 'enter' to see menu

Parts

10
QtyValueFootprintReferences
4MountingHole_PadMountingHole:MountingHole_2.5mmH1, H2, H3, H4
21KResistor_SMD:R_0603_1608MetricR1, R2
1Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalPWR1
1DFR0478KiCad:FIREBEETLE_ESP32_Hygienie_ModFireBeetle1
1SW_ReedResistor_THT:R_Axial_DIN0614_L14.3mm_D5.7mm_P15.24mm_HorizontalSW1
1~Connector_PinHeader_2.54mm:PinHeader_1x20_P2.54mm_VerticalLCD1

Similar boards

  • 2 layers57 × 55.2 mmLogicAnalyzer, the printed circuit board in 3D

    LogicAnalyzer

    gusmanb/logicanalyzer

    24 channel, 100Msps logic analyzer hardware and software

    10 parts5.1kGPL-3.0
  • 2 layers32.2 × 15.4 mmProtector, the printed circuit board in 3D

    Protector

    byrantech/laptop

    anyon_e, a highly integrated, high end, open source laptop. Attempt the impossible.

    10 parts4.3kMIT
  • 2 layers26 × 18 mmConn, the printed circuit board in 3D

    Conn

    yaqwsx/KiKit

    Automation tools for KiCAD

    10 parts2.1kMIT
  • 2 layers44.3 × 30.5 mmLime2-SATA RevA, the printed circuit board in 3D

    Lime2-SATA RevA

    OLIMEX/OLINUXINO

    OLINUXINO is Open Source / Open Hardware, low cost from EUR 24 Linux Industrial grade Single Board Computer capable to operate -25+85C

    10 parts1.5k
  • 2 layers17.8 × 43.2 mmNano Adapter, the printed circuit board in 3D

    Nano Adapter

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    10 parts1.1kGPL-3.0
  • 2 layers53.9 × 23.2 mmBuffer, the printed circuit board in 3D

    Buffer

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    10 parts1kGPL-3.0

Questions

How big is the Hygienie pcb PCB?

It measures 43.1 × 63.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Hygienie pcb use?

10 parts, built around the DFR0478. 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 Hygienie pcb KiCad files?

From the Ward21Century/Hygienie repository on GitHub, at the commit this page was made from: the board is docs/PCB/KiCad Project Files/hygienie_pcb/hygienie_pcb.kicad_pcb and its schematic docs/PCB/KiCad Project Files/hygienie_pcb/hygienie_pcb.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Hygienie pcb design in my own project?

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