Community project
Smart Child Health Box

The Smart Child Health Box is an environmental monitoring station designed to track air quality, weather, and light conditions in spaces where children learn and play. Built around an ESP32 microcontroller, it combines CO2 and particulate matter sensors with temperature, humidity, light, and UV measurement to provide comprehensive indoor and outdoor environmental data.
This guide includes a complete parts list, wiring diagram, PCB layout, and step-by-step assembly instructions for building the device into a wall-mounted enclosure. The included firmware reads all sensors via I2C and serial interfaces, displays real-time measurements on an OLED screen, and supports long-range data transmission via LoRa or LTE connectivity. Solar charging with battery backup ensures continuous operation in any location.
Wiring diagram
Interactive · read-only
Pan and zoom to explore the wiring. Remix the project to edit it in your own workspace.
Parts list
Bill of materials| Component | Qty | Notes |
|---|---|---|
| Sensirion SCD41CO2 / temperature / RH | 1 | Sensirion SCD41 true-CO₂, temperature and humidity sensor (photoacoustic NDIR, I²C). Pin- and library-compatible with the SCD40. |
| PMS5003 Particulate Matter SensorPM1/PM2.5/PM10 | 1 | Plantower PMS5003 laser particulate matter sensor. Reports PM1.0, PM2.5, and PM10 concentrations (plus six particle-size bins) once per second over a 9600-baud UART. The fan and laser diode run on 5V while the SET/RXD/TXD/RESET control and data pins are 3.3V TTL, so only power plus the sensor TX-to-MCU RX line is needed for basic readings. Ships on an 8-pin, 1.25mm-pitch cable; Adafruit sells it with a 0.1in breadboard adapter. PMS7003 is the compact-form-factor sibling in the same family and shares the same wiring/protocol. |
| BH1750UV index | 1 | Rohm BH1750FVI 16-bit digital ambient light sensor with I2C interface. Measures illuminance from 1 to 65535 lux. Two selectable I2C addresses (0x23 / 0x5C) via ADDR pin. |
| BH1750Illuminance | 1 | Rohm BH1750FVI 16-bit digital ambient light sensor with I2C interface. Measures illuminance from 1 to 65535 lux. Two selectable I2C addresses (0x23 / 0x5C) via ADDR pin. |
| SSD1306 OLED128x64 status display | 1 | 0.96 inch 128x64 OLED display with I2C interface |
| HC-SR501 PIR Motion SensorOptional occupancy | 1 | Passive Infrared (PIR) motion detection module with adjustable sensitivity and delay potentiometers. Operates on 5V supply; digital output is nominally 3.3V or 5V depending on module variant (verify before connecting directly to ESP32 3.3V GPIO — use a voltage divider if output is 5V). Outputs HIGH when motion is detected, LOW when idle. Ideal for triggering countdown timer resets in Focus Mode applications. No firmware library required — output read via standard GPIO digitalRead(). |
| RFM95W LoRa Transceiver Module (SX1276)Regional LoRa | 1 | HopeRF RFM95W long-range LoRa/LoRaWAN radio module based on Semtech SX1276. Typically used at 868 MHz (EU) or 915 MHz (US) ISM bands. SPI interface plus RESET and DIO interrupt lines. 3.3 V logic only. Requires an external antenna — never transmit without one. |
| SIM7600 LTE CAT-4 Module4G / GNSS | 1 | SIMCom SIM7600-series LTE CAT-4 cellular module or breakout. It is typically controlled over UART with AT commands and needs a stable high-current cellular supply; many maker boards accept 5V input but the bare module uses a lower VBAT rail. |
| 5V / 1W Solar Panel6 V, 5 W external | 1 | Small 5 V / ~200 mA peak solar panel. Used as the upstream input to a TP4056 (or solar charge controller) for off-grid / outdoor projects. |
| CN3791 MPPT Solar ChargerMPPT solar charger | 1 | CN3791-based MPPT-style switch-mode charger module for single-cell Li-ion/LiPo solar charging. Routes solar input to battery charge terminals and needs a downstream regulator/load path for stable MCU power. |
| 18650 Li-ion Cell3.7V 3000mAh protected | 1 | 18650 lithium-ion cell, nominal 3.7 V, ~2500 mAh. Common for higher-capacity portable / battery-bank style projects; needs a holder and protection / charger circuit. |
| TP4056 Li-Ion/LiPo charger module with protection3.3V / 1A buck-boost | 1 | TP4056 single-cell Li-Ion/LiPo linear charger module, 5V USB input, 1A charge current (programmable). Common variants ship with DW01 protection. Pair with battery_lipo_storage for the cell. |
| TP4056 Li-Ion/LiPo charger module with protection4.0V / 2A peak buck-boost | 1 | TP4056 single-cell Li-Ion/LiPo linear charger module, 5V USB input, 1A charge current (programmable). Common variants ship with DW01 protection. Pair with battery_lipo_storage for the cell. |
| HC-SR501 PIR Motion Sensor0.2mm/tip | 1 | Passive Infrared (PIR) motion detection module with adjustable sensitivity and delay potentiometers. Operates on 5V supply; digital output is nominally 3.3V or 5V depending on module variant (verify before connecting directly to ESP32 3.3V GPIO — use a voltage divider if output is 5V). Outputs HIGH when motion is detected, LOW when idle. Ideal for triggering countdown timer resets in Focus Mode applications. No firmware library required — output read via standard GPIO digitalRead(). |
Assembly
4 stepsPrepare the enclosure and wall plate
Use a 10 in high × 4 in wide × 6 in deep IP65 ABS/polycarbonate enclosure. Fit the sliding backplate rails, two keyhole wall slots, and a bottom security-screw hole. Install filtered downward-facing lower louvers; keep the sensor chamber thermally separated from the RF/power area.
- Tip: Use a closed-cell gasket and stainless mounting screws.
- Tip: Put a drip loop in the solar cable before the upper-side DC entry.
- ⚠ Do not place the solar panel on the enclosure; mount it outside on its own tilt bracket.
- ⚠ Do not obstruct PM sensor airflow or cover the cellular/GNSS/LoRa antenna areas.
Install the single vertical PCB and electronics zones
Mount one vertical PCB on standoffs: radios and antenna connectors at the top, ESP32/power/display connector in the middle, and SCD41/PMS5003 at the bottom directly above the filtered vents. Fix the protected 18650 holder close to the back wall/lower board.
- Tip: Keep the PM optical inlet/outlet aligned to separate lower vent paths.
- Tip: Keep cellular supply traces short and use the modem manufacturer’s bulk capacitors at VCC.
- ⚠ Use only a protected 18650 Li-ion cell of the specified type; observe holder polarity.
- ⚠ The SIM7600 needs a 4.0V rail able to tolerate 2A transmit pulses.
Connect front components and outdoor interfaces
Mount the OLED, UV window, light aperture, PIR lens and alert light pipes in the front cover. Connect the tipping-bucket rain gauge through a weatherproof cable gland. Connect the detached panel to the recessed locking DC input and attach the approved regional LoRa, LTE and GNSS antennas to top SMA connectors.
- Tip: Use a UV-transparent window only over the UV sensor.
- Tip: Use a rain gauge with a dry-contact output and keep its cable away from antenna cables.
- ⚠ Disconnect solar and remove the battery before servicing.
- ⚠ Use the legal LoRa frequency and certified cellular antenna/SIM for the deployment country.
Mount and commission
Screw the plate securely to brick, concrete or wood, slide the unit down until seated, then fit the bottom security screw. Insert the battery, connect the solar panel, and use Schematik’s Deploy button to flash the supplied firmware. Confirm the display changes after each five-second sensor sampling cycle.
- Tip: Orient the external panel toward maximum daily sunlight and adjust its tilt seasonally.
- Tip: Record rain-gauge millimetres-per-tip locally; the sample firmware currently reports raw tip count.
- ⚠ The unit is weather-resistant only when the cover gasket, cable glands and unused ports are sealed.
- ⚠ Do not operate a cellular modem without its antenna connected.
Pin assignments
Board wiring reference| Pin | Connection | Type |
|---|---|---|
| EXT | solar_1 +5V → CN3791 MPPT Solar Charger SOLAR+ | power |
| EXT | solar_1 GND → CN3791 MPPT Solar Charger SOLAR- | ground |
| EXT | battery_1 +V → CN3791 MPPT Solar Charger BAT+ | power |
| EXT | battery_1 GND → CN3791 MPPT Solar Charger BAT- | ground |
| EXT | charger_1 OUT+ → TP4056 Li-Ion/LiPo charger module with protection IN+ | power |
| EXT | charger_1 OUT- → TP4056 Li-Ion/LiPo charger module with protection IN- | ground |
| EXT | reg_3v3_1 B+ → CN3791 MPPT Solar Charger OUT+ | power |
| GND | reg_3v3_1 B- | ground |
| 3V3 | reg_3v3_1 OUT+ | power |
| GND | reg_3v3_1 OUT- | ground |
| EXT | reg_4v0_1 IN+ → CN3791 MPPT Solar Charger OUT+ | power |
| GND | reg_4v0_1 IN- | ground |
| EXT | reg_4v0_1 B+ → CN3791 MPPT Solar Charger OUT+ | power |
| GND | reg_4v0_1 B- | ground |
| 4V | reg_4v0_1 OUT+ | power |
| GND | reg_4v0_1 OUT- | ground |
| 3V3 | scd41_1 VCC | power |
| GND | scd41_1 GND | ground |
| GPIO 21 | scd41_1 SDA | i2c |
| GPIO 22 | scd41_1 SCL | i2c |
| 5V | pm25_1 VCC | power |
| GND | pm25_1 GND | ground |
| GPIO 16 | pm25_1 TX | data |
| 3V3 | uv_1 VCC | power |
| GND | uv_1 GND | ground |
| GPIO 21 | uv_1 SDA | i2c |
| GPIO 22 | uv_1 SCL | i2c |
| 3V3 | lux_1 VCC | power |
| GND | lux_1 GND | ground |
| GPIO 21 | lux_1 SDA | i2c |
| GPIO 22 | lux_1 SCL | i2c |
| 3V3 | oled_1 VCC | power |
| GND | oled_1 GND | ground |
| GPIO 21 | oled_1 SDA | i2c |
| GPIO 22 | oled_1 SCL | i2c |
| 3V3 | pir_1 VCC | power |
| GND | pir_1 GND | ground |
| GPIO 25 | pir_1 OUT | digital |
| 3V3 | rain_1 VCC | power |
| GND | rain_1 GND | ground |
| GPIO 32 | rain_1 OUT | digital |
| 3V3 | lora_1 VCC | power |
| GND | lora_1 GND | ground |
| GPIO 23 | lora_1 MOSI | spi |
| GPIO 19 | lora_1 MISO | spi |
| GPIO 18 | lora_1 SCK | spi |
| GPIO 13 | lora_1 NSS | spi |
| GPIO 14 | lora_1 RESET | digital |
| GPIO 4 | lora_1 DIO0 | digital |
| 4V | lte_gps_1 VCC | power |
| GND | lte_gps_1 GND | ground |
| GPIO 26 | lte_gps_1 TXD | uart |
| GPIO 27 | lte_gps_1 RXD | uart |
| GPIO 33 | lte_gps_1 PWRKEY | digital |
Firmware
ESP32#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SensirionI2cScd4x.h>
#include <Adafruit_PM25AQI.h>
#include <BH1750.h>
#include <Adafruit_VEML6075.h>
#define I2C_SDA 21
#define I2C_SCL 22
#define PM_RX_PIN 16
#define PIR_PIN 25
#define RAIN_PIN 32
#define OLED_ADDR 0x3C
// Forward declarations
void sampleSensors();
void drawScreen();
Adafruit_SSD1306 display(128, 64, &Wire, -1);
SensirionI2cScd4x scd4x;
Adafruit_PM25AQI pm;
HardwareSerial pmSerial(2);
BH1750 lightMeter;
Adafruit_VEML6075 uv;
uint16_t co2ppm = 0;
float tempC = NAN, humidity = NAN, lux = NAN, uvi = NAN;
uint16_t pm25 = 0;
uint32_t rainTips = 0;
bool lastRain = HIGH;
uint32_t lastSample = 0;
uint32_t lastScreen = 0;
void sampleSensors() {
uint16_t error;
char errorMessage[64];
error = scd4x.readMeasurement(co2ppm, tempC, humidity);
if (error && error != 0x0000) { co2ppm = 0; }
PM25_AQI_Data data;
if (pm.read(&data)) pm25 = data.pm25_env;
lux = lightMeter.readLightLevel();
uvi = uv.readUVI();
}
void drawScreen() {
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(1);
display.setCursor(0, 0); display.println("SCHEB CHILD HEALTH");
display.printf("T: %.1f C RH: %.0f%%\n", tempC, humidity);
display.printf("PM2.5: %u ug/m3\n", pm25);
display.printf("CO2: %u ppm\n", co2ppm);
display.printf("UV: %.1f Lux: %.0f\n", uvi, lux);
display.printf("Rain: %lu tips\n", (unsigned long)rainTips);
display.printf("Occupancy: %s", digitalRead(PIR_PIN) ? "MOTION" : "clear");
display.display();
}
void setup() {
pinMode(PIR_PIN, INPUT);
pinMode(RAIN_PIN, INPUT_PULLUP);
Wire.begin(I2C_SDA, I2C_SCL);
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay(); display.display();
scd4x.begin(Wire);
scd4x.stopPeriodicMeasurement();
scd4x.startPeriodicMeasurement();
lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE, 0x23, &Wire);
uv.begin();
pmSerial.begin(9600, SERIAL_8N1, PM_RX_PIN, -1);
pm.begin_UART(&pmSerial);
}
void loop() {
bool rainNow = digitalRead(RAIN_PIN);
if (lastRain == HIGH && rainNow == LOW) rainTips++;
lastRain = rainNow;
uint32_t now = millis();
if (now - lastSample >= 5000) { lastSample = now; sampleSensors(); }
if (now - lastScreen >= 1000) { lastScreen = now; drawScreen(); }
}“Deploy to device” opens this project in Schematik, where you can flash it to your board over USB.
Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace — diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.