Baby Monitoring System

by Daphne_Messing in Circuits > Arduino

161 Views, 2 Favorites, 0 Comments

Baby Monitoring System

IOT

Hello, and welcome to our Instructible!

We are Daphne Messing and Shani White two B.Sc. Computer Science students at Reichman University.

As part of our IoT course this semester, we developed a Baby Monitoring System as our final project. Our goal was to support new parents in caring for and supervising their newborns by leveraging the techniques and tools we learned in the course. Designed to be accessible and easy to use, this system offers real-time monitoring and notifications, providing parents with peace of mind and ensuring their baby's well-being.

This comprehensive system notifies parents when the baby's diaper is wet, detects if the baby is crying and sends a notification, plays calming songs to help the baby sleep, measures the milk bottle temperature, rocks the cradle by a press to soothe the baby , and includes an option to turn on and off a night lamp.


So, what exactly does this system do?

  1. Diaper Wetness Notification: The system uses a soil moisture sensor to detect when the baby's diaper is wet. If the moisture level exceeds a certain threshold, it automatically sends a notification to the parents, alerting them that the baby needs a diaper change.
  2. Crying Detection and Notification: Equipped with a sound sensor, the system can detect when the baby is crying. Upon detecting crying, it sends an immediate notification to the parents, ensuring they are promptly aware of the baby's distress.
  3. Calming Songs: The system can play calming songs through an I2S audio amplifier connected to a speaker, helping to soothe the baby and promote sleep.
  4. Milk Bottle Temperature Measurement: A temperature sensor is used to measure the milk bottle temperature, ensuring the milk is at an optimal temperature before feeding.
  5. Cradle Rocking: The system includes a servo motor that rocks the cradle gently. The rocking motion can be toggled on and off with a button press on a joystick, helping to calm and lull the baby to sleep.
  6. Night Lamp Control: The system provides an option to turn a night lamp on and off, offering soft illumination in the baby's room for added comfort during the night.


Take a look!

Supplies

WhatsApp Image 2024-07-29 at 17.23.04_93c816f4.jpg
WhatsApp Image 2024-07-29 at 17.23.04_3140f260.jpg
WhatsApp Image 2024-07-29 at 17.23.04_7cfe429d.jpg

General:

  • Make.com account + mobile app
  • Blynk.cloud account + mobile app
  • Arduino software

Hardware:

  • 1 x ESP32 Microcontroller (ESP32-WROOM-32)
  • 1 x Arduino board USB cable
  • 1 x Electric Microphone Sensor (MAX4466)
  • 1 x Servo Motor (Micro Servo MG90S)
  • 1 x Temperature and Humidity Sensor (AM2302 DHT22 Sensor)
  • 13 x jumper wires (female to female connection wires)
  • 1 x Led
  • 1 x Speaker
  • 1 x MP3 Player (MAX 98367A I2S Amplifier)
  • 1 x Soil Humidity Sensor (Capacitive Soil Moisture Sensor v2.0)
  • 1 x PS2 Joystick Module


Mechanical Supplies:

  • 1 x Large Shoe Box
  • 1 x Small Shoe Box
  • 1 x Large skewer
  • 1 x Small skewer
  • 1 x Sellotape
  • 1 x Scissors
  • 1 x Small Towel
  • 1 x Elastic Thread
  • 1 x Wrapping Paper (optional)
  • 1 x Cellophane
  • 1 x Clear Vase/ Cup
  • 1 x Baby Doll (optional)
  • 1 x Water Bottle

Downloads

Software

logo.jpg

Arduino:

Install Arduino here

Install the following Driver here

Install ESP32 Board Manager : review

Blynk:

Download the blynk app to your smartphone and create your account in it

Make:

Create a new make account here

Blynk Setup

datastreams.png
blynk1.jpg
blynk4.jpg
blynk2.jpg
blynk3.jpg
blynk5.jpg
blynk6.jpg

1. Create a new template: for "HARDWARE" choose "Arduino" and for "CONNECTION TYPE" choose "WiFi"

2. Datastreams:

We used the data streams presented in the above picture for input and output to and from Blynk.

We created 5 datastreams:

  • v0 - virtual pin datastream of type double which will be used to measure the milk temperature for the baby
  • v1 - virtual pin datastream of type integer which will be used to play a lullaby for the baby when he cries
  • v2 - virtual pin datastream of type integer which is used to lit a night lamp when needed
  • v3 - virtual pin datastream of type integer which will be used to detect if the baby's diaper is wet
  • v4 - virtual pin datastream of type integer which will be used to display the sound level of the baby

3. Click on the search tab and you'll see a "New Device" button, create a new device from the template you've created, you will get few lines of code with your device's information - save it, we will use it soon.

4. Open the Blynk app on your mobile and add buttons to the device according to the description in the figures

5. Download the Arduino code file provided under "Supplies" section.

6. Change the device name, copy your Blynk authentication code under variable 'BLYNK_TEMPLATE_ID’ , Blynk template ID under variable 'BLYNK_TEMPLATE_ID' and template name under variable 'BLYNK_TEMPLATE_NAME'

Set Hardware

חלקים 1.png
חלקים 2.png
חלקים3.png

In this part we are connecting all the hardware parts to the ESP32.

Use the USB cable to connect the ESP32 to your computer.

LED:

  • Anode (longer leg, positive): Connect to GPIO 27 (S pin) on the ESP32.
  • Cathode (shorter leg, negative): Connect to a GND pin on the ESP32.

MOISTURE SENSOR:

  • VCC: Connect to the 3.3V pin on the ESP32.
  • GND: Connect to a GND pin on the ESP32.
  • AOUT (output): Connect to GPIO 34 (S pin) on the ESP32.

MICROPHONE:

  • VCC: Connect to the 3.3V pin on the ESP32.
  • GND: Connect to a GND pin on the ESP32.
  • OUT: Connect to GPIO 35 (S pin) on the ESP32.

SERVO MOTOR:

  • Power (+5V, Red): Connect to the 3.3V pin on the ESP32.
  • GND (0V, Black/Brown): Connect to a GND pin on the ESP32.
  • Control (PWM, Yellow/Orange): Connect to GPIO 23 (S pin) on the ESP32.

TEMPERATURE & HUMIDITY SENSOR:

  • VCC: Connect to the 3.3V pin on the ESP32.
  • GND: Connect to a GND pin on the ESP32.
  • DATA: Connect to GPIO 4 (S pin) on the ESP32.

JOYSTICK:

  • SW (Switch): Connect to GPIO 2 (S pin) on the ESP32.
  • 5V: Connect to the 3.3V pin on the ESP32.
  • GND: Connect to a GND pin on the ESP32.

I2S AUDIO AMPLIFIER:

  • VIN (or VDD): Connect to the 3.3V pin on the ESP32.
  • GND: Connect to a GND pin on the ESP32.
  • LRC (or LRCLK): Connect to GPIO 25 (S pin) on the ESP32.
  • BCLK (or SCK): Connect to GPIO 26 (S pin) on the ESP32.
  • DIN (or SD): Connect to GPIO 22 (S pin) on the ESP32.

Speaker Connections:

  • L+ on MAX98357 -> Positive terminal of the speaker.
  • L- on MAX98357 -> Negative terminal of the speaker.

Build the Smart Cradle

littlebigbox.jpg
bigbox.jpg
littleboxblanket.jpg
servo.jpg
stick.jpg
bottomstick.jpg
IMG_5201.JPG
IMG_5203.JPG
IMG_5200.JPG
IMG_5213.JPG
IMG_8089 (2).jpg
IMG_5214.JPG

1. Prepare the Large Shoe Box:

Cut open one of the edges of the large shoebox.

2. Wrap the Shoe Boxes:

Wrap both shoeboxes with wrapping paper to create a nice cradle.

Use scissors and sellotape to stick the paper securely onto the boxes.

3. Attach the Elastic Thread:

Take a long piece of elastic thread (about 50 centimeters) and tie it onto the small stick.

Wrap the tie with sellotape to ensure it does not move.

4. Insert the Small Skewer:

Make a hole in the middle bottom part of the small shoebox.

Stick the small skewer through this hole, securing it with the small stick.

5. Connect the Thread to the Servo Arm:

Tie the other end of the thread (connected to the small skewer) to one of the servo arms as

shown in the picture.

6. Place the Soil Humidity Sensor:

Make a cut in the bottom part of the small shoebox.

Insert the Soil Humidity Sensor through the cut and position it at the bottom part of the box.

7. Place the Towel:

Place a towel at the bottom part of the small shoebox (over the Soil Humidity Sensor).

8. Assemble the Cradle:

Stick the large skewer through one side of the large shoebox.

Continue through one side of the small box, then through the other side of the small box, and finally

through the other side of the large box, as shown in the picture.

9. Build the Night Lamp:

Wrap the LED light with cellophane paper.

Gently push the wrapped LED into the transparent vase, positioning it as desired.

10. Attach the Temperature Sensor to the Baby's Bottle:

Use sellotape to secure the temperature sensor to the baby's bottle. Position it in such a way that it can accurately detect the temperature of the milk when preparing it.

11. Attach the hardware Components:

Use sellotape to secure the hardware components to the surface of the large shoebox.

12. Position the servo motor:

Position the servo motor so that, when activated, it effectively moves the cradle back and forth.

13. Position the Sound Sensor:

Place the sound sensor (microphone) inside the small shoebox, ensuring it is positioned close to the baby's face. This will help the sensor accurately detect when the baby is crying.

Set Up Make.com and Create the First Scenario

pushover
scenerio1
pushover1.png
pushover2.png
make1.png
make2.png
make3.png
make4.png
make5.png

In this step, we will create our first scenario, which is sending a text message to the baby's mother notifing her when the baby is crying. For this purpose, we will use Pushover which is a service that allows you to send real-time push notifications to your mobile devices.

  1. Sign up to pushover and create an account. Click on "Create an Application/API Token". Fill out the necessary information to create your application. After creating the application, you will receive an API token. Your Pushover user key can be found on your pushover dashboard.
  2. Log in to your "Make.com" account.
  3. Create a new scenario: add a webhook module, in its settings click on "Add" and choose a name, then you'll see an URL, copy it and open it in a new tab, you should see there an "Accepted" message and when you will go back to the scenario you should see a "Successfully determined" message.
  4. Back to the scenario, click on the "+" button sign next to webhook circle and add another module. Choose "pushover" -> "send a message" and a new module will appear.
  5. Connect your Pushover account to Make.com by providing your API token and user key. Fill out the required fields such as the message title, message body, and any other relevant information. This message will be sent automatically once triggered.
  6. Do the same for the second scenario with a different message.

Arduino Code

datafolder.png
spiffsupload.png

1.Enter your wifi under the variable ‘ssid’ , your wifi’s password under the variable ‘password’.

2.Connect the board to your PC, using the USB cable.

3.Upload the File System Image:

  • Ensure you have the SPIFFS tool installed in the Arduino IDE. If not, you can download it from the Arduino ESP32 filesystem uploader.
  • Prepare your files (MP3 files) and place them in a directory named data within your sketch folder.
  • In the Arduino IDE, go to Tools > ESP32 Sketch Data Upload. This will upload the contents of the data folder to the SPIFFS on the ESP32.

4.Click on the Upload button on the top-left part of the screen (a button with an icon of an arrow pointing to the right), and wait for the program to be fully uploaded.

5.Open the Serial Monitor from Tools > Serial Monitor to see the debug messages and confirm that the sensors and actuators are working correctly.

6.Test the Components:

  • Ensure the LED lights up when you send a command from the Blynk app.
  • Check that the soil moisture sensor and sound sensor provide readings.
  • Verify that the servo motor operates correctly when sound levels are above the threshold.

Ready to Go!

Congratulations!

You can now sleep soundly knowing your loved ones are properly taking their medication on time!

We hope you enjoyed the building process and would love to hear if you implemented any of your own features :)