Smart baby cradle with cry detection and auto swing

Working parents and joint families often leave a baby sleeping while they cook or work. A cradle that swings when the baby cries, senses a wet bed and alerts the parent's phone gives peace of mind.

ESP32Mini or Major projectECE, EEE, BME, Diploma
ESP32MICROPWETNESTEMPER22.5°CFeatured
Parts
₹3,000
Build
12 weeks
Board
ESP32
Objectives
6
Test with a doll. Keep the swing slow and short, with a mechanical end stop, and never leave a baby unattended with a prototype.

Block diagram

Inputs
  • MICROP
    MicrophoneHears crying
  • WETNES
    Wetness stripSenses a wet bed
  • TEMPER
    Temperature sensorChecks the room
  • ESP32
    CameraCaptures a photo when the event happens+
Controller
  • ESP32
    ESP32Decides when to swing and alert
Outputs
  • 71°
    Servo swingRocks the cradle gently
  • PHONE
    Phone alertTells the parent
  • CLOUD
    Cloud dashboardStores readings, plots trends and sends alerts+

Objectives

  1. To detect crying from sound level and pitch, ignoring a single loud noise.
  2. To swing the cradle gently for 2 minutes and play a lullaby on crying.
  3. To alert the parent's phone on crying that continues, a wet bed or a hot room.
  4. To measure detection rate on 30 recorded cry and non-cry clips.
  5. To capture and store an image automatically when an event is detected.
  6. To publish readings over MQTT and show them on a live dashboard with threshold alerts.

Parts and specifications

Total about ₹3,000 at typical online prices. Tap a part for its pinout and datasheet notes.

Design calculations

Cry detection

Sample sound at 8 kHz, compute energy in 250 ms frames. A cry is loud and has a pitch of about 300 to 600 Hz lasting over 1 s; count it when 3 of 4 frames qualify.

Swing motion

Swing ±15° at about 0.5 Hz (one full swing every 2 s), stepping the servo 1° every 33 ms, similar to a hand rocking.

Comfort

Alert when room temperature is outside 20 to 28 °C, a common range for infant sleep.

Pin map

SignalPin or connection
MAX9814 OUTGPIO 36 (ADC1)
Wetness stripGPIO 39, powered from GPIO 25 while reading
DHT22GPIO 4
Swing servoGPIO 18 (6 V buck)
DFPlayer TX / RXGPIO 16 / 17

Firmware outline

  1. Continuously compute frame energy and a zero-crossing pitch estimate.
  2. On a detected cry, swing for 2 minutes and play a lullaby.
  3. If crying continues past the swing, send a phone alert (Telegram or app).
  4. Every 30 s check wetness and room temperature; alert on change.
  5. Night mode: lower the volume and swing amplitude.

Test plan

TestExpected result
30 recorded cries and 30 other sounds (TV, talk, utensils)Detection and false alarm rate
Water drop on the stripWet alert
SwingSmooth, stops at limits
Room warmed with a heaterTemperature alert

These rows start your results table when you plan the project.

Viva practice

Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.

1. How do you tell a cry from other noise?
2. Why sample at 8 kHz?
3. Why limit the swing?
4. How does AGC help?
5. How would ML improve it?

Make it yours

One or two upgrades for a mini project, two to four for a major one.

Build these first

Datasheets and sources to cite

  • Maxim MAX9814 datasheet
  • TowerPro MG996R datasheet
  • IS 17384 / EN 1130 (cribs and cradles safety)

About this project

How much does the smart baby cradle with cry detection and auto swing project cost?

About ₹2,300 for the parts in the base list: ESP32 DevKit V1, MAX9814 microphone with AGC, Wetness sensor strip, DHT22 temperature and humidity sensor, MG996R metal gear servo, LM2596 buck (servo 6 V), 12 V 2 A DC adapter, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, Model cradle and linkage.

How long does it take?

About 8 weeks for the base project, built on an ESP32. Each upgrade adds time.

Which branches is it suitable for?

Electronics and Communication, Electrical and Electronics, Biomedical, Diploma (any electronics branch), as a mini or major project.

Which pins and design calculations does it use?

MAX9814 OUT on GPIO 36 (ADC1); Wetness strip on GPIO 39, powered from GPIO 25 while reading; DHT22 on GPIO 4. Worked calculations on this page: cry detection, swing motion, comfort.

How do I test it?

30 recorded cries and 30 other sounds (TV, talk, utensils): Detection and false alarm rate. Water drop on the strip: Wet alert. Swing: Smooth, stops at limits. Room warmed with a heater: Temperature alert.

What are the objectives?

To detect crying from sound level and pitch, ignoring a single loud noise. To swing the cradle gently for 2 minutes and play a lullaby on crying. To alert the parent's phone on crying that continues, a wet bed or a hot room. To measure detection rate on 30 recorded cry and non-cry clips.