Skip to the content
PCBKitNew board
2 layersWave box, the printed circuit board in 3D

adding repository for strictly arduino

Copper layers
2
Thickness
1.6 mm
Parts
37
Nets
107
Pads
195
Tracks, vias
143, 0
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
25 Aug 2025
Updated
30 Sep 2025

Overview

Wave box is an open-source printed circuit board by Cingciong, from the Cingciong/wave_box repository on GitHub. It is a 2-layer board with 37 parts on 107 nets, routed with 143 tracks and 0 vias.

It is built around the DS18B20. Its parts include 15 resistors, 6 transistors, 6 connectors, 1 IC and 1 diode. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

1

README

readme.md

IoT Power & Sensor Control System

📘 Overview

This project is a modular IoT system built on Arduino Mega / STM32 / ESP32, integrating multiple sensors and actuators with a web-based control interface.
It supports Ethernet communication (static or DHCP), relay/device control, and sensor monitoring, with configuration stored in EEPROM.


📂 Project Structure

  • Schematics: schematic/schematic.pdf
  • PCB Layout: (to be inserted here — export from KiCad)
  • Firmware: src/ directory, modularized by peripherals, network, and utilities

📐 Schematics

In schematics folder whole KiCad's project is available. Also the full circuit design is available in PDF format:

📄 View Schematics

(exported from KiCad)


📑 Bill of Materials (BOM)

ComponentQuantityNotes
Microcontroller1Arduino Mega / STM32 / ESP32
DHT221Temperature & humidity sensor
URS-ES1 LAN module1Ethernet interface
BMP2801Pressure + temperature sensor
SRD-05VDC-SL-C1 relay1System on/off relay
0.1Ω shunt resistor4Current measurement
IRL540N MOSFET54 for shunt circuit, 1 for fan control
Fan1Active cooling
ACS7121AC current sensor
Dallas DS18B201Digital temperature sensor

⚡ Firmware Structure

text
src/
├── config.h // Pin definitions, constants
├── globals/ // Global structs & variables
│ ├── globals.h
│ ├── globals.cpp
├── peripherals/ // Sensors & actuators
│ ├── sensors.h / .cpp
│ ├── basic_peripheral.h / .cpp
│ ├── poe_device.h / .cpp
├── network/ // Ethernet + HTTP
│ ├── ethernet_server_class.h / .cpp
│ ├── routes.h / .cpp
├── utils/ // Helpers
│ ├── fan_controller.h / .cpp
│ ├── env.h / .cpp // EEPROM config persistence
├── main.cpp // setup() + loop()

Typical Flow

  • Global Declarations

    • All peripherals (relays, PoE devices, fan controller, etc.) are declared in globals.cpp.
    • Corresponding extern references are exposed in globals.h.
    • This way, objects are globally accessible across the codebase.
  • setup()

    • Initializes the global objects declared in globals.cpp.
    • Configures network stack (DHCP or static IP, based on saved settings).
    • Loads configuration parameters (e.g., password, IP) from EEPROM via env.
  • loop()

    • Uses the global objects (no new declarations here).
    • Handles Ethernet server requests and routes.
    • Calls sensor read functions (sensors are already objects provided by their libraries, e.g. DHT, BMP280, DS18B20).
    • Applies control logic for relays, PoE devices, and fan.
    • Updates and persists runtime data (e.g., energy usage) into EEPROM when needed.

🌐 Network & Web Interface

Features

  • Supports DHCP or Static IP (configurable).
  • Web interface requires a password (?pwd=your_password).
  • Wrong password attempts are logged in the Serial Monitor (shows correct one).
  • Configurable parameters via web form:
    • DHCP toggle
    • Static IP / Mask / Gateway
    • Password change
  • Config changes are saved to EEPROM → requires manual device restart.
  • Reset available via web UI (watchdog reset).

Key Routes

EndpointDescriptionAuth Required
/Main control panel (status, config)✅
/resetRestart device via watchdog✅
/get_dataJSON with current sensor/device state✅
/system_toggleToggle main system relay✅
/device1_toggleToggle PoE device 1✅
/device2_toggleToggle PoE device 2✅
/device3_toggleToggle PoE device 3✅
/device4_toggleToggle PoE device 4✅

Example Access

http://device_ip/?pwd=my_secret

📝 Notes

  • After changing network/password settings, you must restart the device.
  • To use static IP, set DHCP = false and configure IP, mask, and gateway.
  • All updates are persisted in EEPROM.

🌐 HTTP Routes

The project uses a custom HTTP routing system in routes.cpp.

Route Structure

Each route is defined as a Route object with:

  • Path – the URL endpoint (e.g., /system_toggle)
  • Handler – lambda function (String requestPath, IPAddress clientIP) that returns a string
  • Content Type – "text/html" for pages, "application/json" for API

Example: Simple Route

cpp
Route("/hello", [](String requestPath, IPAddress clientIP) {
    Serial.println("Hello route called from IP: " + ipToString(clientIP));
    return String("Hello, World!");
}, "text/plain"),

🌐 API Routes

The project has two types of routes:

  1. Web pages – return HTML for control/status/configuration.
  2. API endpoints – return JSON with sensor/device states.
EndpointActionReturns JSON
/Main control panel (status, config)❌ HTML
/resetRestart device via watchdog❌ HTML
/get_dataGet current sensor/device state✅
/system_toggleToggle main system relay✅
/device1_toggleToggle PoE device 1✅
/device2_toggleToggle PoE device 2✅
/device3_toggleToggle PoE device 3✅
/device4_toggleToggle PoE device 4✅

📝 Notes

  • Web pages (/ and /reset) require password via ?pwd=YOUR_PASSWORD and return HTML.
  • API endpoints return JSON with the current state, example:
json
{
  "system": {
    "isOn": true,
    "power": 12.34
  },
  "poe": {
    "device1": {"isOn": true, "power": 1.23},
    "device2": {"isOn": false, "power": 0.00},
    "device3": {"isOn": true, "power": 0.56},
    "device4": {"isOn": false, "power": 0.00}
  },
  "sensors": {
    "tempInside": 24.50,
    "tempOutside": 22.30,
    "humidity": 55.30,
    "pressure": 1013.20
  }
}

💾 EEPROM Management

The project uses an Env class (env.h / env.cpp) to handle persistent configuration and energy logging.
EEPROM is limited in write cycles, so special care is taken to extend its lifetime.

🔹 Configuration Storage

  • A magic byte (0xAB) is used to check if EEPROM is initialized.
  • Stored parameters include:
    • DHCP flag
    • MAC address
    • Static IP, Gateway, Subnet
    • Password
    • Ping IP
  • On startup, Env::load() checks if EEPROM is valid:
    • If not, defaults are applied and then saved.
    • If valid, all values are read and applied.

🔹 Energy Data (Power Slots)

Because power measurements are updated very frequently, saving them directly to EEPROM would wear it out quickly.
To prevent this, the project uses a slot-based circular buffer:

  • EEPROM space 100 → 511 is divided into slots.
  • Each slot contains:
    • Marker (0xABCD = valid, 0x0000 = empty)
    • Energy value (float, Wh)
  • When saving:
    1. The last used slot is cleared.
    2. Data is written into the next slot.
    3. Wraps back to the start if end is reached.
  • This way, writes are distributed across many slots, dramatically extending EEPROM lifetime.

🔹 Key Functions

  • Env::loadPowerFromEEPROM() → Reads the last valid saved energy value.
  • Env::savePowerToEEPROM(float energy) → Stores the latest energy measurement into the next free slot.
  • Env::debugEEPROMPower() → Dumps all EEPROM slots to the Serial Monitor for debugging.

✅ Benefits

  • Protects EEPROM from early wear-out.
  • Ensures configuration and energy data survive restarts.
  • Allows debugging of power history in raw EEPROM memory.

⚙️ PlatformIO Configuration

The project is built using PlatformIO.
Below is the configuration from platformio.ini:

ini
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
monitor_speed = 115200
lib_deps = 
    adafruit/Adafruit NeoPixel@^1.15.1
    Wire
    LiquidCrystal_I2C
    adafruit/DHT sensor library@^1.4.6
    adafruit/Adafruit Unified Sensor@^1.1.15
    adafruit/Adafruit BMP280 Library@^2.6.8
    https://github.com/adafruit/Ethernet2.git
    https://github.com/NicksonYap/Arduino-Ping-W5500.git
    bblanchon/ArduinoJson@^7.0.4
    https://github.com/RobTillaart/ACS712.git
    paulstoffregen/OneWire@^2.3.7
    milesburton/DallasTemperature@^3.11.0

Parts

37
QtyValueFootprintReferences
61kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR2, R4, R7, R10, R13, R15
5500Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R5, R8, R11, R14
5NMOSLibrary:TO-220-3_VerticalQ1, Q2, Q3, Q4, Q5
40.1Resistor_THT:R_Axial_DIN0922_L20.0mm_D9.0mm_P25.40mm_HorizontalR3, R6, R9, R12
4Screw_Terminal_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2_1x02_P5.00mm_HorizontalJ2, J3, J4, J5
11N4148Diode_THT:D_DO-35_SOD27_P7.62mm_HorizontalD1
1Arduino_Mega2560_R3_ShieldPCM_arduino-library:Arduino_Mega2560_R3_ShieldA1
1DS18B20Package_TO_SOT_THT:TO-92_InlineU1
1Q_NPN_BCEPackage_TO_SOT_THT:TO-92_InlineQ6
1SANYOU_SRD_Form_CRelay_THT:Relay_SPDT_SANYOU_SRD_Series_Form_CK1
1Screw_Terminal_01x03TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-3-5.08_1x03_P5.08mm_HorizontalJ6
1Screw_Terminal_01x04TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-4_1x04_P5.00mm_HorizontalJ7
1~Library:acs712ACS_1
1~Library:RLEAYSRD-05VDC-SL-C1
1~Library:DHT22DHT1
1~Library:bmp-280BMP-2
1~Library:USR-ES1USR-ES1

The 36 most common of 37 parts.

Questions

What parts does the Wave box use?

37 parts, built around the DS18B20. 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 Wave box KiCad files?

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

Can I use the Wave box design in my own project?

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

Similar boards

  • 2 layers33.7 × 97.8 mmHAN ESP TSS721, the printed circuit board in 3D

    HAN ESP TSS721

    UtilitechAS/amsreader-firmware

    ESP8266 and ESP32 compatible firmware to read, interpret and publish data to MQTT from smart electrical meters, both DLMS and DSMR is supported

    29 parts470
  • 2 layers121 × 68 mmFreeds sanchez, the printed circuit board in 3D

    Freeds sanchez

    pablozg/freeds

    Derivador de energía solar excedente creado por Pablo Zerón, Diseño PCB por Amcalo, Tester original por Aeizoon, Wiki por Zoilo Mora

    42 parts108
  • 2 layers80 × 54.9 mmESP32WifiAisTempVolt2, the printed circuit board in 3D

    ESP32WifiAisTempVolt2

    AK-Homberger/NMEA2000WifiGateway-with-ESP32

    This repository shows how to build a NMEA2000 WiFi Gateway with voltage and temperature alarms.

    18 parts94GPL-3.0
  • 2 layers52 × 61 mmArduino motorfocus, the printed circuit board in 3D

    Arduino motorfocus

    fehlfarbe/arduino-motorfocus

    Arduino motorfocus with moonlite protocol for telescopes

    23 parts58MIT
  • 2 layers69 × 57 mmBuoy4, the printed circuit board in 3D

    Buoy4

    wjpavalko/Maker-Buoy

    Repository of Open Source Maker Buoy Files

    46 parts39
  • 2 layers26 × 34.8 mmWemosD1Mini, the printed circuit board in 3D

    WemosD1Mini

    RuiSantosdotme/ESP8266-Multisensor-Shield

    Complete step-by-step instructions »

    10 parts29
  • 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 layers123 × 87.5 mmFastLOGIC, the printed circuit board in 3D

    FastLOGIC

    Neumi/fastLOGIC

    An affordable Arduino-based board designed for straightforward (industrial) logic control, ideal for building small-scale automation and control solutions.

    180 parts23MIT