Built to order

IoT-Based Smart Cradle with Cry Detection and Automatic Swinging

This project builds an IoT-based smart cradle that listens for a baby's cry with a KY-038 sound sensor and automatically starts gently swinging the cradle with an MG996R servo motor, while an ESP32 sends cry alerts and room temperature to a parent dashboard over Wi-Fi. It demonstrates embedded sensing, threshold-based event detection, servo control and IoT alerting in one working prototype. Suitable for B.E./B.Tech final-year projects in Electronics, IoT and Embedded Systems.

IoT & Embedded ESP32-WROOM-32Arduino IDEHTML · CSS · JavaScript dashboard16x2 LCD displayDHT11 temperature sensorKY-038 sound sensorMG996R servo motor12 V power adapterHybrid
IoT-Based Smart Cradle with Cry Detection and Automatic Swinging — project thumbnail preview
More project photos (2)

The problem

New parents often cannot stay beside a cradle all day, and a baby who wakes and cries may wait several minutes before anyone in another room hears and responds. Manual cradles need a hand to keep rocking, so a parent busy in the next room has no way to know the baby has woken until the crying grows loud. The IoT-Based Smart Cradle with Cry Detection and Automatic Swinging answers this with a small wooden cradle carrying a sound sensor, a servo motor and an ESP32 controller. When the sensor hears sustained crying, the controller starts the cradle swinging and sends an alert to a parent dashboard over Wi-Fi, so the baby is soothed while the parent is notified. The project is an academic prototype demonstrating sound sensing, threshold-based detection, servo motion control and IoT alerting in one build, made for demonstration and learning — it is not a medical device and never replaces adult supervision of an infant.

SYSTEM FLOW

5 components 4 connections

Live flow
Drag to explore
100%
sensorKY-038 Sensor

Measures the sound level near the cradle and sends an analogue signal.

Follow the working sequence

How it works

The smart cradle works as a short chain from sound to motion to alert. The KY-038 sound sensor, mounted at the head end of the cradle, converts room sound into an analogue voltage that the ESP32 reads every 500 ms (design target). The ESP32 compares each reading with the configured cry threshold of 65 dB (design target) and counts consecutive samples above it; only three in a row count as a cry, which separates sustained crying from a single loud noise. Once a cry is confirmed, the ESP32 drives the MG996R servo through a slow sweep that rocks the cradle, starts the auto-stop timer, sounds the buzzer and sends the cry event and live readings to the parent dashboard over Wi-Fi. The dashboard shows the sound graph, swing state, temperature, humidity and event log, and the parent can stop the swing or change its speed from the same screen.

  1. The KY-038 sound sensor continuously measures the sound level near the cradle and sends an analogue signal to the ESP32.
  2. The ESP32 samples the signal every 500 ms (design target) and compares each reading with the 65 dB cry threshold (design target).
  3. When 3 consecutive samples stay above the threshold, the ESP32 confirms a cry; a single loud noise below 3 samples is ignored.
  4. The ESP32 drives the MG996R servo motor through a slow sweep, rocking the cradle through its linkage arm, and starts the auto-stop timer.
  5. The buzzer sounds a short alert and the 16x2 LCD updates to show the swinging state.
  6. The ESP32 sends the cry event, live sound level, temperature and humidity to the parent dashboard over Wi-Fi.
  7. The parent sees the alert on the dashboard, can stop the swing or change its speed, and the swing stops by itself when the timer ends.

Tech stack:

  • ESP32-WROOM-32
  • Arduino IDE
  • KY-038 sound sensor module
  • MG996R servo motor
  • DHT11 temperature sensor
  • HTML · CSS · JavaScript dashboard
  • 16x2 LCD display
  • 12 V power adapter
Parameter Value
Controller ESP32-WROOM-32, dual-core Xtensa LX6 up to 240 MHz (datasheet value), 520 KB SRAM (datasheet value)
Sound sensor KY-038 module, electret condenser microphone with LM393 comparator (datasheet value), 3.3–5 V supply (datasheet value)
Swing actuator MG996R servo motor, stall torque 9.4 kgf·cm at 4.8 V (datasheet value)
Temperature sensor DHT11, 0–50 °C range ±2 °C and 20–90% RH ±5% RH (datasheet values)
Display 16x2 character LCD with I2C adapter
Connectivity Wi-Fi 802.11 b/g/n up to 150 Mbps (datasheet value), dashboard on local network
Power supply 12 V 2 A DC adapter for the cradle; servo driven from a regulated 5 V rail
Cry threshold 65 dB (design target, configurable in firmware)
Sampling interval 500 ms per sound sample (design target)
Confirmation rule 3 consecutive samples above threshold (design target)
Swing arc Approximately 60° cradle rock (design target, set in firmware)
Auto-stop timer 10 minutes default (design target, configurable 5–30 minutes)
Cradle frame Wooden rocking cradle, approximately 60 cm long (design target)

Project features

The smart cradle combines four capabilities that work together as one system. First, cry detection: a KY-038 sound sensor watches the sound level and flags a cry only when the level stays above a set threshold for three consecutive samples, so a single clap or door knock does not trigger it. Second, automatic swinging: an MG996R servo motor drives the cradle through a linkage arm as soon as a cry is confirmed, and stops by itself after a configurable timer. Third, the parent dashboard: the ESP32 sends live sound levels, swing status, room temperature and an event log to a web dashboard over Wi-Fi, so a parent in another room sees the alert immediately. Fourth, room monitoring: a DHT11 sensor reports temperature and humidity on the same dashboard, giving the parent one screen for the baby's surroundings.

  • [Cry detection with 3-sample confirmation] The KY-038 sound sensor samples the sound level every 500 ms (design target), and the ESP32 flags a cry only after 3 consecutive samples above the 65 dB threshold (design target), so brief household noises do not start the swing.
  • [Automatic swinging on cry] An MG996R servo motor drives the cradle through a metal linkage arm as soon as a cry is confirmed, with a configurable auto-stop timer (default 10 minutes, design target) and 5 speed levels set from the dashboard.
  • [Parent dashboard over Wi-Fi] The ESP32 hosts a web dashboard showing the live sound-level graph, swing status, room temperature and humidity, and an event log of every cry and swing, viewable from any device on the same Wi-Fi network.
  • [Room temperature and humidity display] A DHT11 sensor measures room temperature and humidity and shows them on the dashboard and on the 16x2 LCD, so the parent can check whether the room is comfortable.
  • [Manual swing control] Swinging can also be started and stopped by hand from the dashboard or a push button, independent of cry detection, for testing and demonstration.
  • [Local alert buzzer and LCD status] A buzzer sounds a short alert when a cry is detected and the 16x2 LCD shows the cradle state, so the system gives feedback even when no phone or dashboard is open.
  • [Configurable thresholds] The cry threshold, sample count, swing speed and auto-stop time are all set in the firmware, so the student can tune the behaviour for the demo room and explain each setting in the viva.

What is included

  • Working smart cradle prototype (wooden frame, ESP32, KY-038 sound sensor, MG996R servo, DHT11, LCD, buzzer)
  • Complete firmware source code with configurable threshold, speed and timer settings
  • Companion parent dashboard (single-file web app with live sound graph and event log)
  • Circuit diagram and wiring documentation
  • Component list with part numbers
  • Project report PDF (background, methodology, architecture, results)
  • Project abstract PDF
  • PPT presentation for final review
  • Viva Q&A preparation document

Limitations & prerequisites

  • The KY-038 measures sound loudness, not cry identity: it cannot distinguish a baby's cry from any other sustained loud sound, so the threshold must be tuned for the demo room.
  • This is an academic prototype, not a medical or safety device: it must never be used for unsupervised infant care, and an adult must always supervise the baby.
  • Cry alerts need Wi-Fi: without a network the cradle still swings on detection, but the dashboard and remote alerts do not update.
  • The servo swing suits a light demo cradle only: the MG996R stall torque of 9.4 kgf·cm at 4.8 V (datasheet value) limits the load, and a real infant's weight is out of scope for this prototype.
  • Room temperature and humidity readings come from a DHT11 with ±2 °C and ±5% RH accuracy (datasheet values), so they are indicative, not clinical measurements.
  • Sound detection depends on sensor placement and room noise: a noisy room or a sensor placed far from the cradle can cause missed or false triggers.
  • No camera is included: the system detects sound only and cannot show the baby.

Frequently Asked Questions

Is this project suitable for a final-year project?

Yes — this project suits final-year Electronics, Electronics and Telecommunication, Electrical and IoT students because it combines embedded sound sensing, threshold-based event detection, servo motion control and Wi-Fi dashboard alerting in one working prototype with a clear live demo and a strong viva story. The build is small enough to assemble and explain in a semester, yet it touches four examinable areas: sensors, control, embedded code and IoT.

How does the cradle tell a cry from ordinary household noise?

It does not recognise a cry by its sound pattern — instead it uses sustained loudness, flagging a cry only when the sound level stays above the 65 dB threshold for three consecutive 500 ms samples, so a single clap or door knock never starts the swing. The threshold and sample count are configurable in the firmware, and the demo shows this behaviour live on the dashboard sound graph.

Which controller and sensors are used?

The ESP32-WROOM-32 is the controller, with a dual-core Xtensa LX6 running up to 240 MHz and built-in Wi-Fi, while the KY-038 sound sensor detects sound, the DHT11 measures room temperature and humidity, and the MG996R servo motor drives the swing through a linkage arm. A 16x2 LCD and a buzzer give local status and alerts when no dashboard is open.

Does it work without Wi-Fi?

Partly — cry detection and automatic swinging run entirely on the ESP32 and work without any network, with the buzzer and LCD still reporting the cradle state, while the parent dashboard, remote alerts and event-log sync need Wi-Fi because the dashboard is served over the local network. A mobile hotspot can serve as the network for the demo.

What power supply is needed?

A 12 V 2 A DC adapter powers the cradle, with the servo driven from a regulated 5 V rail and the ESP32 running from the board's own 5 V USB input or a regulated 3.3 V supply, so the demo needs just one wall socket. No battery is included, and battery operation would need a separate pack sized for the servo's current draw.

What are the main limitations?

The KY-038 measures loudness rather than cry identity, so it cannot tell a cry from other sustained loud sounds and needs threshold tuning for the room, and the prototype is a demonstration build for a light load, not a device for a real infant. It is not a medical device — an adult must always supervise the baby — alerts need Wi-Fi, and the DHT11 readings are indicative only.

Components & software requirements
  • ESP32-WROOM-32
  • Arduino IDE
  • KY-038 sound sensor module
  • MG996R servo motor
  • DHT11 temperature sensor
  • HTML · CSS · JavaScript dashboard
  • 16x2 LCD display
  • 12 V power adapter
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation