Contents — 26 sections
Project Overview
A crib monitor that watches an infant's breathing movement without any contact, alarms locally within seconds if it stops, and — above all — is honest that no monitor prevents SIDS.
This is the most emotionally charged project in the catalogue, and it demands the most caution in how it is presented. Baby breathing monitors are bought by frightened parents, and the industry around them has a genuine problem: there is no evidence that consumer breathing monitors reduce sudden infant death syndrome (SIDS), and there is real concern that they provide false reassurance that leads parents to relax the safe-sleep practices that actually do reduce risk. This documentation leads with that, because a build guide that does not would be irresponsible.
With that understood, what the device actually does is detect the movement associated with breathing and alarm if that movement stops for longer than a set period. It uses contactless radar sensing — a 24 GHz or 60 GHz module that detects the sub-millimetre chest movement of breathing through the air, with no sensor on the baby. Contactless is the right choice here specifically because a sensor pad under a mattress can be defeated by the baby rolling off it, and anything attached to the baby is a hazard in itself.
The signal processing extracts a respiration rate from the radar's phase output and detects the two failure modes that matter: a cessation of movement (apnoea), and a movement pattern that is present but abnormal. A local alarm — loud, immediate, and independent of any network — is the core function. Everything else, including phone notifications, is secondary and must never be the primary alert.
The design deliberately keeps the alarm local and fast, distinguishes a baby who has simply moved out of the sensor field from one who has genuinely stopped breathing, and states its limitations in the device itself. It is presented as an awareness and reassurance aid layered on top of safe-sleep practices, never as a medical device or a substitute for them.
What this project does
- Detects infant breathing movement contactlessly using a 24/60 GHz radar module.
- Extracts respiration rate from the radar phase signal.
- Alarms locally within a configurable period (default 15 s) if breathing movement stops.
- Distinguishes "no breathing detected" from "baby out of sensor field" to reduce false alarms.
- Provides a loud local alarm independent of any network or phone.
- Optionally notifies a phone as a secondary alert, never the primary one.
- Logs respiration rate overnight for review with a paediatrician if wanted.
Real-World Applications
| Setting | How it is used |
|---|---|
| Parental reassurance | The honest primary use — reducing anxiety, layered on top of (never replacing) safe-sleep practice. |
| Monitoring after a clinical concern | For infants a paediatrician is monitoring, as an adjunct to and under medical guidance, not instead of it. |
| Respiration-rate awareness | A rising respiration rate can accompany illness; a trend is informative context for a parent. |
| Learning radar signal processing | Contactless vital-sign sensing is a genuinely advanced and current technique. |
| Elder or patient monitoring | The same contactless respiration sensing applies to any bed-bound person, with fewer of the emotional stakes. |
| Research prototyping | A platform for contactless vital-sign algorithms against a reference. |
Deployment contexts where a build of this kind earns its keep.
Features & Capabilities
- Contactless radar sensing — nothing on or under the baby, no pad to be displaced.
- Respiration-rate extraction from the radar phase, typically 30–60 breaths/min in infants.
- Presence discrimination — an empty field is reported as "no baby", not as apnoea.
- Fast local alarm that works with the network, the phone and the internet all down.
- Configurable apnoea window with a default that reflects clinical apnoea definitions.
- Secondary phone alert clearly subordinate to the local alarm.
- Overnight respiration log for optional clinical review.
- Prominent honesty: the device states it does not prevent SIDS, in its own documentation and setup.
Difficulty, Time & Required Skills
| Attribute | Value |
|---|---|
| Difficulty level | Intermediate |
| Estimated completion time | 12–18 hours |
| Indicative build cost | ₹2,400 – ₹3,200 |
| Primary discipline | Health & Wearables |
| Reference platform | ESP32 DevKit V1 (ESP-WROOM-32) |
Skills you should have (or will pick up)
- Arduino C++ with signal processing
- Radar module configuration over UART
- Phase-signal extraction and band-pass filtering
- Peak detection and rate estimation
- A clear-eyed understanding of what the device can and cannot claim
Bill of Materials
Every part below is commonly available from Indian and international hobby-electronics suppliers. Prices are indicative 2026 retail figures in Indian rupees and will drift — treat them as a budgeting guide, not a quotation.
| Component | Key specification | Qty | Approx. cost |
|---|---|---|---|
| ESP32 DevKit V1 (ESP-WROOM-32) Wi-Fi transmit bursts peak near 500 mA — size the regulator accordingly. | Dual-core Xtensa LX6 @ 240 MHz, 520 KB SRAM, 4 MB flash, Wi-Fi 802.11 b/g/n + BLE 4.2, 34 GPIO, 18× 12-bit ADC, 2× 8-bit DAC | 1 | ₹450 |
| Active piezo buzzer 5 V Active buzzers make tone on DC; passive ones need a PWM carrier. | 85 dB at 10 cm, 2.3 kHz resonance, 12 mm diameter | 1 | ₹25 |
| 0.96″ SSD1306 OLED display Static images burn in — invert or scroll the screen periodically. | 128 × 64 monochrome, 1.3–3.3 V logic, 100 kHz–400 kHz I²C | 1 | ₹250 |
| 5 V 3 A regulated SMPS adapter Measure the real output — many "3 A" adapters sag below 4.7 V at 2 A. | 100–240 VAC in, 5 V ±5 % out, 3 A, short-circuit and over-voltage protection | 1 | ₹350 |
| Double-sided perfboard 7 × 9 cm + headers Solder female headers so the MCU can be swapped without desoldering. | FR-4, 0.1″ pitch, plated through-holes, 24 × 18 grid | 1 | ₹60 |
| IP65 ABS junction enclosure 158 × 90 × 60 mm Fit cable glands, not drilled holes, or the IP rating means nothing. | IP65, ABS, −20 to +80 °C, transparent lid, wall-mount lugs | 1 | ₹260 |
| MR60BHA1 or LD2410 mmWave radar module A respiration-capable 60 GHz module (e.g. Seeed MR60BHA1) reports breathing rate directly. A 24 GHz LD2410 detects presence and gross movement only. | 60 GHz (respiration-capable) or 24 GHz presence, UART | 1 | ₹900 |
| 100 dB piezo alarm | 5 V, loud enough to wake a sleeping adult in another room | 1 | ₹320 |
| Crib-mount arm / bracket The radar must be aimed at the baby's torso from above. | Adjustable, positions the radar 30–60 cm above the mattress | 1 | ₹280 |
| RGB status LED | Common cathode | 1 | ₹20 |
Estimated total: ₹2,915, excluding tools, shipping and consumables.
Tools and consumables
- Soldering iron (temperature controlled, 350 °C) with 0.8 mm 60/40 or lead-free solder
- Digital multimeter — continuity, DC volts and current ranges
- Wire strippers, flush cutters and a small set of precision screwdrivers
- Heat-shrink tubing and a heat gun (or a lighter, carefully)
- A laptop with a USB port and the toolchain listed above
Hardware Specifications
| Part | Specification | Supply | Interface | Reference |
|---|---|---|---|---|
| ESP32 DevKit V1 (ESP-WROOM-32) | Dual-core Xtensa LX6 @ 240 MHz, 520 KB SRAM, 4 MB flash, Wi-Fi 802.11 b/g/n + BLE 4.2, 34 GPIO, 18× 12-bit ADC, 2× 8-bit DAC | 3.3 V logic / 5 V USB | UART, SPI, I²C, I²S, CAN, PWM | Datasheet |
| Active piezo buzzer 5 V | 85 dB at 10 cm, 2.3 kHz resonance, 12 mm diameter | 3–5 V | Digital / PWM | Datasheet |
| 0.96″ SSD1306 OLED display | 128 × 64 monochrome, 1.3–3.3 V logic, 100 kHz–400 kHz I²C | 3.3–5 V | I²C (0x3C) | Datasheet |
| 5 V 3 A regulated SMPS adapter | 100–240 VAC in, 5 V ±5 % out, 3 A, short-circuit and over-voltage protection | 5 V | DC barrel / USB | Datasheet |
| Double-sided perfboard 7 × 9 cm + headers | FR-4, 0.1″ pitch, plated through-holes, 24 × 18 grid | — | — | Datasheet |
| IP65 ABS junction enclosure 158 × 90 × 60 mm | IP65, ABS, −20 to +80 °C, transparent lid, wall-mount lugs | — | — | Datasheet |
Consolidated electrical and interface specifications for every active part in the build.
Power Budget & Supply Sizing
Add up the typical active current of every part, then size the supply with at least 50 % headroom so transmit bursts and motor inrush never brown out the controller.
| Load | Supply rail | Typical current (mA) | Notes |
|---|---|---|---|
| ESP32 DevKit V1 (ESP-WROOM-32) | 3.3 V logic / 5 V USB | 160 | Wi-Fi transmit bursts peak near 500 mA — size the regulator accordingly. |
| Active piezo buzzer 5 V | 3–5 V | 30 | Active buzzers make tone on DC; passive ones need a PWM carrier. |
| 0.96″ SSD1306 OLED display | 3.3–5 V | 20 | Static images burn in — invert or scroll the screen periodically. |
| 5 V 3 A regulated SMPS adapter | 5 V | 3000 | Measure the real output — many "3 A" adapters sag below 4.7 V at 2 A. |
Summed typical draw is 3210 mA. With a 1.5× design margin the supply should deliver at least 4900 mA continuously at the stated rail voltage.
Software Requirements & Development Environment
Reference toolchain: Arduino IDE 2.3.x with the ESP32 board package 3.x (or PlatformIO on VS Code). Anything newer normally works; anything older may lack the board definitions used here.
- Install the Arduino IDE 2.3.x (or PlatformIO if you prefer a real editor and dependency locking).
- Add
https://espressif.github.io/arduino-esp32/package_esp32_index.jsonunder File → Preferences → Additional Board Manager URLs, then install esp32 from the Boards Manager. - Set the correct port under Tools → Port. On Linux add yourself to the
dialoutgroup:sudo usermod -aG dialout $USERand log out and back in. - Open the Serial Monitor at 115200 baud — every sketch here logs its state there.
- Keep File → Preferences → Show verbose output during: compilation switched on while you are debugging build errors.
Required libraries
| Library | Why it is needed | Install |
|---|---|---|
| WiFi (ESP32 core) bundled | Station/AP connection management for the ESP32. | Bundled with the ESP32 Arduino core |
| PubSubClient 2.8 | Lightweight MQTT 3.1.1 client for constrained devices. | Library Manager → "PubSubClient" by Nick O'Leary |
| ArduinoJson 7.x | Zero-allocation JSON serialisation and parsing. | Library Manager → "ArduinoJson" by Benoit Blanchon |
| Adafruit SSD1306 + GFX 2.5.x | Framebuffer and text/graphics primitives for the OLED. | Library Manager → "Adafruit SSD1306" |
| Preferences (NVS) bundled | Wear-levelled key/value storage in ESP32 flash for settings. | Bundled with the ESP32 core |
Block Diagram
The block diagram shows the functional decomposition of the system — what senses, what decides, what acts, and where the data ends up.
Circuit Diagram & Wiring
Every signal line in the build is shown below, followed by a pin-by-pin connection table you can work through with a multimeter in hand.
| Peripheral | Peripheral pin | Controller pin | Signal |
|---|---|---|---|
| mmWave radar module | TX / RX | GPIO 16 / 17 | UART, module-specific baud |
| Radar presence GPIO (if fitted) | OUT | GPIO 32 | Digital presence |
| Silence button | NO | GPIO 33 | Temporarily silence a nuisance alarm |
| 100 dB alarm | Transistor base | GPIO 25 | Local alarm, always works |
| RGB status LED | R / G / B | GPIO 12 / 13 / 14 | Green breathing, amber no-baby, red alarm |
| SSD1306 OLED | SDA / SCL | GPIO 21 / 22 | Rate + status, dimmed |
Wire one row at a time and tick it off — most "it does not work" reports trace back to a single swapped pair.
Wiring explanation
- Mount the radar 30–60 cm above the mattress, aimed at the baby's torso, on a rigid arm that cannot fall into the crib. The mounting must be mechanically secure and free of any cord that could reach the baby.
- A 60 GHz respiration-capable module (like the Seeed MR60BHA1) reports breathing rate over UART directly and is strongly preferred. A 24 GHz LD2410 detects presence and gross movement but not fine breathing — with a 24 GHz module you can detect gross apnoea (no movement at all) but not a true respiration rate.
- Keep the radar's field clear of fans, curtains and other periodic movement, which the radar will happily interpret as breathing. Aim it so the baby's torso fills the beam and little else moves.
- The alarm must be loud and driven directly by the ESP32 through a transistor — it is the primary safety output and must never depend on Wi-Fi. Site it where a sleeping parent will hear it.
- Power from a reliable mains adapter with the electronics well away from the crib. Consider a small battery backup so a power cut does not silently disable the monitor.
- Dim the OLED and LEDs heavily — this is a nursery at night, and a glowing device disrupts the infant's sleep you are trying to protect.
System Architecture
Read the stack from the bottom up: physical hardware, the firmware that drives it, the transport that moves data off the device, and the software a human actually looks at.
Working Principle
A millimetre-wave radar transmits a continuous signal and measures the reflection. When it reflects off a surface that moves — such as a chest wall rising and falling with breathing — the reflected signal's phase shifts in proportion to the movement. Breathing moves the chest by a few millimetres, and at 60 GHz the wavelength is 5 mm, so even sub-millimetre movement produces a measurable, periodic phase change. Extracting that periodicity gives the respiration rate, with no contact at all.
This is genuinely powerful: the same technique measures heartbeat (a much smaller movement at a higher frequency) and is used in contactless vital-sign research and in some commercial products. For an infant monitor, contactless is not just convenient but safer — there is no pad the baby can roll off, no cord, no sensor against delicate skin.
The key distinction the device must make is between no breathing detected and no baby present. If a parent picks the baby up, the radar sees an empty crib — no movement — which is exactly what apnoea looks like on a movement sensor. Alarming then would be a false alarm, and false alarms are the specific failure that makes parents distrust and eventually ignore a monitor. So the device uses a presence signal (the radar's own presence detection, or a distinction between an empty field and a still-but-present body) to gate the alarm: it only alarms on absence of breathing when a baby is present.
The alarm timing reflects clinical definitions loosely. A pathological apnoea in an infant is generally defined as a pause of 20 seconds or more, or a shorter pause with other signs. A default alarm window of around 15 seconds gives a margin before that threshold. Shorter windows produce false alarms from the normal brief irregularity of infant breathing (periodic breathing is common and normal in newborns); longer windows delay a genuine alert. This is a real trade-off and the parent should set it in consultation with their paediatrician.
Everything about the alert prioritises local, immediate, network-independent operation. The 100 dB alarm is driven directly by the microcontroller. A phone notification is added as a secondary channel, but it is explicitly subordinate — Wi-Fi can drop, a phone can be silenced, and the one alert that must always work is the loud noise in the house. A monitor whose primary alert depends on the internet is a monitor that fails exactly when it matters.
Finally, and most importantly, the device is honest in its own interface. It shows a safe-sleep reminder at startup, it never claims to prevent SIDS, and its documentation states plainly that the evidence does not support consumer breathing monitors reducing infant death. This is not legal boilerplate; it is the single most important design requirement, because a device that fosters false reassurance can do net harm.
The maths behind it
Radar phase and chest movement
Transmitted: 60 GHz → wavelength λ = c/f = 5.0 mm
Phase shift from a target moving Δd:
Δφ = 4π·Δd / λ
Chest movement of 3 mm (typical infant breathing):
Δφ = 4π × 3 / 5 = 7.54 rad = 432°
That is comfortably measurable — even 0.1 mm gives 14°.
The respiration signal is the periodic component of φ(t)
in the 0.3–1.5 Hz band (18–90 breaths/min).
Respiration rate extraction
Phase signal φ(t) sampled at fs (module-dependent).
Band-pass 0.3–1.5 Hz to isolate breathing.
Rate by peak counting over a 30 s window:
rate_bpm = 60 · (peaks in window) / window_seconds
Infant reference ranges (breaths/min, at rest):
newborn : 30–60
1–12 months : 25–50
Alarm on: no peak detected for > apnoea_window
AND presence = true.
Alarm-window trade-off
Pathological apnoea (clinical): pause ≥ 20 s
Periodic breathing (normal newborn): pauses up to ~10 s
Alarm window choices:
10 s : frequent false alarms from normal periodic breathing
15 s : reasonable default — margin before 20 s
20 s : matches the clinical threshold, later warning
Set in consultation with a paediatrician. There is no
choice that is both maximally sensitive and free of
false alarms — that is inherent, not a bug.
Program Flowchart
The firmware is a single cooperative loop. Nothing blocks for long, so networking, sensing and the user interface all stay responsive.
Assembly Instructions
Build on a breadboard first and only commit to solder once the whole system has run for an hour without a fault.
Step-by-Step Implementation Guide
Work through these in order. Each step ends in something you can observe, so a failure is always localised to the step you just finished.
Complete Source Code
The listing below is complete and compiles as written — there are no elided sections. Read the annotations under each block before you upload it.
/* ═══════════════════════════════════════════════════════════════
Baby Breathing Monitor — ESP32 + mmWave radar (contactless)
Detects breathing movement with a 60 GHz radar, alarms locally if
movement stops while a baby is present, and distinguishes an empty
crib from apnoea.
IMPORTANT: This device does NOT prevent SIDS. No consumer breathing
monitor has been shown to. It is a reassurance aid layered on top
of safe-sleep practices, which it does not replace.
══════════════════════════════════════════════════════════════════ */
#include <WiFi.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Preferences.h>
#define WIFI_SSID "YOUR_WIFI"
#define WIFI_PASS "YOUR_PASSWORD"
#define MQTT_HOST "192.168.1.50"
#define DEVICE_ID "crib-monitor"
#define PIN_ALARM 25
#define PIN_SILENCE 33
#define PIN_LED_R 12
#define PIN_LED_G 13
#define PIN_LED_B 14
#define APNEA_WINDOW_MS 15000 // set WITH a paediatrician
#define RATE_LOW_BPM 15 // implausibly low — likely artefact
#define RATE_HIGH_BPM 80 // implausibly high for sleep
HardwareSerial radar(2); // GPIO 16/17
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
WiFiClient net;
PubSubClient mqtt(net);
Preferences prefs;
float breathingRate = 0;
bool babyPresent = false, breathingDetected = false, alarming = false;
uint32_t lastBreathMs = 0, silencedUntil = 0, lastLog = 0;
/* ── radar parsing (Seeed MR60BHA1-style frame) ─────────────────
The exact frame format is module-specific; adapt to your module's
protocol. This parser expects a breathing-rate report frame. */
bool parseRadar() {
static uint8_t buf[32]; static int idx = 0;
bool updated = false;
while (radar.available()) {
uint8_t b = radar.read();
// Frame header 0x53 0x59 (example); presence and rate follow.
if (idx == 0 && b != 0x53) continue;
if (idx == 1 && b != 0x59) { idx = 0; continue; }
buf[idx++] = b;
if (idx >= 12) { // complete frame
babyPresent = buf[4] != 0; // presence byte
float rate = buf[6]; // breathing rate byte
bool moving = buf[5] != 0; // movement present
if (rate >= RATE_LOW_BPM && rate <= RATE_HIGH_BPM) breathingRate = rate;
if (moving && babyPresent) {
breathingDetected = true;
lastBreathMs = millis();
}
idx = 0;
updated = true;
}
}
return updated;
}
/* ── feedback ───────────────────────────────────────────────── */
void setLed(uint8_t r, uint8_t g, uint8_t b) {
digitalWrite(PIN_LED_R, r); digitalWrite(PIN_LED_G, g); digitalWrite(PIN_LED_B, b);
}
void alarmOn() {
alarming = true;
digitalWrite(PIN_ALARM, HIGH);
setLed(1, 0, 0);
mqtt.publish("care/" DEVICE_ID "/alarm", "apnea", true); // secondary alert
}
void alarmOff() {
alarming = false;
digitalWrite(PIN_ALARM, LOW);
mqtt.publish("care/" DEVICE_ID "/alarm", "clear", true);
}
/* ── display ────────────────────────────────────────────────── */
void draw() {
oled.clearDisplay();
oled.setTextColor(SSD1306_WHITE);
oled.dim(true); // nursery — keep it dark
if (!babyPresent) {
oled.setTextSize(1); oled.setCursor(0, 24);
oled.println("No baby detected"); oled.println("(monitor idle)");
oled.display();
return;
}
oled.setTextSize(2); oled.setCursor(0, 0);
oled.printf("%2.0f", breathingRate);
oled.setTextSize(1); oled.setCursor(38, 6); oled.print("breaths/min");
oled.setCursor(0, 28);
oled.print(alarming ? "!! NO BREATHING !!"
: breathingDetected ? "breathing detected" : "watching...");
oled.setCursor(0, 54); oled.print("Not a medical device");
oled.display();
}
/* ── setup / loop ───────────────────────────────────────────── */
void setup() {
Serial.begin(115200);
pinMode(PIN_ALARM, OUTPUT); digitalWrite(PIN_ALARM, LOW);
pinMode(PIN_SILENCE, INPUT_PULLUP);
pinMode(PIN_LED_R, OUTPUT); pinMode(PIN_LED_G, OUTPUT); pinMode(PIN_LED_B, OUTPUT);
radar.begin(115200, SERIAL_8N1, 16, 17);
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Safe-sleep reminder at every startup — the most important screen.
oled.clearDisplay(); oled.setTextColor(SSD1306_WHITE); oled.setTextSize(1);
oled.setCursor(0, 0);
oled.println("SAFE SLEEP:");
oled.println("back, firm flat");
oled.println("surface, no loose");
oled.println("bedding. This does");
oled.println("NOT prevent SIDS.");
oled.display();
delay(5000);
WiFi.mode(WIFI_STA); WiFi.begin(WIFI_SSID, WIFI_PASS);
for (int i = 0; i < 40 && WiFi.status() != WL_CONNECTED; i++) delay(250);
mqtt.setServer(MQTT_HOST, 1883);
lastBreathMs = millis();
Serial.println("Monitor running — LOCAL ALARM is the primary alert");
}
void loop() {
if (!mqtt.connected() && WiFi.status() == WL_CONNECTED) mqtt.connect(DEVICE_ID);
mqtt.loop();
parseRadar();
/* Silence button: temporarily mute a nuisance alarm. */
if (digitalRead(PIN_SILENCE) == LOW) {
silencedUntil = millis() + 30000; // 30 s only — never permanent
if (alarming) alarmOff();
}
uint32_t now = millis();
if (!babyPresent) {
// Empty crib is NOT apnoea. Reset the timer and stand down.
setLed(1, 1, 0); // amber: idle
lastBreathMs = now;
if (alarming) alarmOff();
} else {
breathingDetected = (now - lastBreathMs) < APNEA_WINDOW_MS;
if (breathingDetected) {
setLed(0, 1, 0); // green: breathing
if (alarming) alarmOff();
} else if (now > silencedUntil) {
if (!alarming) {
Serial.println("APNEA: no breathing movement detected");
alarmOn();
}
}
}
static uint32_t lastDraw = 0;
if (now - lastDraw > 500) { lastDraw = now; draw(); }
if (now - lastLog > 10000 && babyPresent) {
lastLog = now;
JsonDocument d;
d["rate"] = breathingRate;
d["breathing"] = breathingDetected;
d["present"] = babyPresent;
char b[96]; size_t n = serializeJson(d, b, sizeof(b));
mqtt.publish("care/" DEVICE_ID "/state", (uint8_t *)b, n, true);
}
}
Configuration & Calibration
Configuration steps
- Choose a respiration-capable 60 GHz module if you want a true breathing rate. A 24 GHz LD2410 can only detect gross movement and presence — usable for a crude apnoea detector but not for rate.
- Set
APNEA_WINDOW_MSin consultation with your paediatrician. 15 seconds is a starting default; the trade-off between false alarms and warning time is genuine and personal. - Aim the radar at the baby's torso from 30–60 cm above, and keep fans, curtains and other periodic movement out of its field.
- Site the alarm where a sleeping parent will reliably hear it, and test that they do.
- Adapt the radar frame parser to your specific module's protocol — the byte layout shown is illustrative and modules differ.
Calibration procedure
An uncalibrated sensor produces confident, precise, wrong numbers. Do this once per physical unit and record the constants.
Verify breathing detection
Place a soft toy that you move gently by hand to simulate breathing, or (with appropriate care and supervision) observe with a real infant under a parent's watch. Confirm the device reports a plausible rate and shows green.
Test the presence gate
Remove the target from the field. The device must show "no baby / idle" and must NOT alarm. If it alarms on an empty crib, the presence detection is not working and the device is not safe to rely on.
Test the apnoea alarm
With a target present, stop the movement. The alarm must sound within the configured window. Time it and confirm it matches your setting.
Confirm false-trigger immunity
Introduce a fan or a moving curtain into the field. If the device reports this as breathing, re-aim the radar so only the baby's torso is in the beam.
Network Architecture & Connectivity
Communication protocol
The MQTT layer is deliberately secondary. The device functions completely — detection, presence gating, and the loud local alarm — with no network at all. MQTT adds a phone notification and an optional overnight rate log, and nothing that matters for safety depends on it.
The alarm state is published retained so a phone connecting after the event still sees it, but the phone notification must never be presented to the parent as the primary alert.
| Topic / endpoint | Direction | Payload |
|---|---|---|
care/crib-monitor/alarm | device → broker (retained) | "apnea" / "clear" — secondary alert only |
care/crib-monitor/state | device → broker (retained) | JSON: rate, breathing, present |
Message contract between the device and the broker.
Security considerations
- This is intimate data about an infant. Keep it strictly on a local broker with authentication; never route it through a third-party cloud service.
- A radar in a nursery raises the same privacy considerations as a camera would — treat the data accordingly.
- The phone alert must be subordinate to the local alarm in the parent's mind and in the setup instructions. Never configure it as the only alert.
Testing Procedure & Expected Output
Test from the bottom up. Confirm power, then each sensor in isolation, then the integrated loop — the first failing step tells you exactly where to look.
| Test | What you should see |
|---|---|
| Power on | A five-second safe-sleep reminder stating the device does not prevent SIDS, then the monitoring screen. |
| Empty field | Amber "no baby / idle", no alarm, timer held reset. |
| Simulated breathing movement in the field | Green, a plausible breathing rate, "breathing detected". |
| Stop the movement with a target present | The local alarm sounds within the configured window and the LED goes red. |
| Remove the target during an alarm | The device recognises the empty field and stands down — no more alarm on an empty crib. |
| Introduce a fan into the field | If it is read as breathing, re-aim the radar; the device should ideally not be fooled by non-torso movement in a well-aimed setup. |
| Disconnect Wi-Fi and trigger an apnoea | The local alarm still sounds. Only the phone notification is lost — which is why it is secondary. |
| Press silence during an alarm | Alarm mutes for 30 seconds only, then resumes if the condition persists. It can never be muted permanently. |
Bench-test checklist. If a row fails, stop and fix it before moving on.
Expected output
With everything wired and the firmware uploaded, the Serial Monitor at 115200 baud should look similar to the trace below. Values will differ; the shape of the output should not.
Troubleshooting: Common Errors & Fixes
Performance Optimisation
- Keep the alarm path free of any network or display work — it must respond within a sample of detecting apnoea.
- Filter the radar rate over a short window to reject single-frame artefacts, but not so long that it delays apnoea detection.
- Dim the display and LEDs aggressively; the nursery must stay dark for the infant's sleep.
- Replace every
delay()with amillis()comparison — blocking delays are the single most common cause of dropped readings. - Sample sensors on a fixed cadence and publish on a slower one; you almost never need to transmit at the sampling rate.
- Move networking into its own FreeRTOS task so a slow DNS lookup cannot stall the control loop.
- Use
uint8_t/uint16_twhere the range allows; on an 8-bit AVR a 32-bit add costs four times as much. - Batch several samples into one MQTT publish. Radio time, not CPU time, dominates the energy budget.
- Set the MQTT keep-alive to a value that matches your reporting interval so the broker does not churn reconnections.
- For battery builds use deep sleep between samples: an ESP32 drops from ~160 mA awake to about 10 µA asleep, which is the difference between days and months of runtime.
- Profile before optimising — print
micros()deltas around each stage and fix the slowest one first.
Safety Precautions
- This device does not prevent SIDS. No consumer breathing monitor has been shown to. It must never be presented — to yourself or anyone else — as protection against sudden infant death.
- The evidence-based measures reduce SIDS risk: back sleeping, a firm flat separate sleep surface, no loose bedding or soft objects, avoiding overheating, no smoke exposure, and breastfeeding. This device replaces none of them and must sit strictly on top of them.
- Do not let the monitor create false reassurance that leads to relaxed safe-sleep practice. That is the specific way this class of device can cause net harm.
- The local alarm is the only alert that must be relied upon. Never depend on a phone notification, which can be silenced, delayed or lost to a dropped connection.
- Keep all cords and the mounting arm well out of the crib — a strangulation hazard is a real risk that a breathing monitor must not introduce.
- This is not a medical device. For any genuine concern about an infant's breathing, seek medical care immediately.
- Wear eye protection when soldering or cutting, and solder in a ventilated space — rosin flux fumes are a respiratory irritant.
- Power the circuit through a bench supply with a current limit while you are testing. A 300 mA limit turns a wiring mistake into a beep instead of a dead board.
- Disconnect power before changing any wiring. Hot-plugging a sensor onto a live bus is the fastest way to lose a controller.
Maintenance
- Re-check every screw terminal and header after the first week — thermal cycling loosens connections that felt tight on day one.
- Keep the broker and dashboard containers patched, and rotate device credentials at least once a year.
- Recalibrate at the interval given in the calibration section, and keep the constants in a text file next to the firmware — not only in flash.
- Keep a short logbook of firmware versions and what changed. Six months later you will not remember why that constant is 1.083.
Future Improvements & Upgrades
A working v1 is a platform, not a finish line. These are the upgrades that add the most capability for the least rework.
- Add contactless heart rate from the same radar — a 60 GHz module can resolve the smaller, faster cardiac movement, giving a second vital sign.
- Add a reference validation against a clinically-used monitor to characterise the device's real sensitivity and false-alarm rate honestly.
- Add battery backup so a power cut does not silently disable the monitor overnight.
- Add room temperature monitoring, since overheating is an actual SIDS risk factor and a nursery too warm is worth flagging.
- Add a trend log for a paediatrician, presenting respiration rate over nights in a form a clinician can actually use.
- Design a proper PCB. Once the breadboard version has run for a month, moving to a two-layer board removes the intermittent-contact failures that dominate prototype faults.
- Add over-the-air firmware updates so you never have to physically reach a deployed node again.
- Add persistent local storage (microSD or the on-chip flash) so a network outage does not create a hole in your data.
- Move configuration out of the source: a captive-portal setup page or a JSON config file makes the build reusable without a recompile.
- Add a battery and solar option so the unit survives a power cut and can be sited away from a socket.
- Write a small test harness that feeds synthetic sensor values through the decision logic, so you can validate thresholds without physically triggering the event.
Frequently Asked Questions
References & Learning Resources
These are the primary sources worth reading in full. Manufacturer datasheets always outrank forum posts when the two disagree.
- AAP, "Sleep-Related Infant Deaths: Updated Recommendations for a Safe Infant Sleeping Environment"American Academy of Pediatrics, 2022
- Bonafide et al., "Accuracy of Consumer Smartphone Apps and Monitors for Vital Signs in Infants"JAMA, 2017
- Seeed Studio MR60BHA1 60 GHz mmWave breathing and heartbeat sensorSeeed Studio
- Li et al., "A Review on Recent Advances in Doppler Radar Sensors for Noncontact Healthcare Monitoring"IEEE Trans. Microwave Theory, 2013
- Moon et al., "SIDS and Other Sleep-Related Infant Deaths" (technical report)Pediatrics, 2022
- HLK-LD2410 24 GHz human presence radar — datasheetHi-Link