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.
- Parts
- ₹3,000
- Build
- 12 weeks
- Board
- ESP32
- Objectives
- 6
Block diagram
- MicrophoneHears crying
- Wetness stripSenses a wet bed
- Temperature sensorChecks the room
- CameraCaptures a photo when the event happens+
- ESP32Decides when to swing and alert
- Servo swingRocks the cradle gently
- Phone alertTells the parent
- Cloud dashboardStores readings, plots trends and sends alerts+
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.
- To capture and store an image automatically when an event is detected.
- To publish readings over MQTT and show them on a live dashboard with threshold alerts.
Parts and specifications
- ESP32 DevKit V1Dual-core 240 MHz, 520 KB SRAM, Wi-Fi + Bluetooth, 3.3 V logic, 12-bit ADC (use ADC1 pins when Wi-Fi is on)₹450Buy
- MAX9814 microphone with AGCElectret mic with automatic gain 40/50/60 dB, 2 V p-p output centred at 1.25 V₹250Buy
- Wetness sensor stripExposed traces give an analog level over 4 cm; for drip chambers use the IR method instead₹50Buy
- DHT22 temperature and humidity sensor−40 to 80 °C ±0.5 °C, 0 to 100% RH ±2%, one reading every 2 s, single-wire₹250Buy
- MG996R metal gear servo9.4 kg·cm at 4.8 V, 0 to 180°, stall up to 2.5 A so give it its own 5 to 6 V supply₹350Buy
- LM2596 buck (servo 6 V)4 to 40 V in, 1.25 to 37 V out, up to 2 A continuous (3 A peak), about 85% efficient₹90Buy
- Model cradle and linkage₹500
- ESP32-CAM with OV2640ESP32 + 4 MB PSRAM + 2 MP OV2640 camera, microSD slot, needs 5 V 500 mA for stable Wi-Fi₹550Buy
Total about ₹3,000 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
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 ±15° at about 0.5 Hz (one full swing every 2 s), stepping the servo 1° every 33 ms, similar to a hand rocking.
Alert when room temperature is outside 20 to 28 °C, a common range for infant sleep.
Pin map
| Signal | Pin or connection |
|---|---|
| MAX9814 OUT | GPIO 36 (ADC1) |
| Wetness strip | GPIO 39, powered from GPIO 25 while reading |
| DHT22 | GPIO 4 |
| Swing servo | GPIO 18 (6 V buck) |
| DFPlayer TX / RX | GPIO 16 / 17 |
Firmware outline
- Continuously compute frame energy and a zero-crossing pitch estimate.
- On a detected cry, swing for 2 minutes and play a lullaby.
- If crying continues past the swing, send a phone alert (Telegram or app).
- Every 30 s check wetness and room temperature; alert on change.
- Night mode: lower the volume and swing amplitude.
Test plan
| Test | Expected result |
|---|---|
| 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 |
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.
Make it yours
One or two upgrades for a mini project, two to four for a major one.
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.
