Introduction: Crying Baby Detector Using 1Sheeld
The biggest problem that mothers face is that they can't leave their babies alone in a room asleep, That they must sit next to them, And leave anything else in there hand because getting afraid if the baby starts to wake up which is a wasting of time, From there came my IDEA
Crying Baby Detector is a project taken from Baby Monitor concept but the differences are that my idea take some ACTIONS like automatic playing music for the baby So that the baby get back to sleep , Using what's called White Noise which is some quiets noise or music that comfort the baby which get him/her back to sleep , And if the baby doesn't get back to sleep , it starts playing more louder music so that the baby feel safe.
Step 1: Materials
Components:
Arduino UNO
1Sheeld
Android Phone
2 LEDS (Green-Yellow)
5V Relay
NPN Transistor 2N2222
10K resistor
1N4004 Diode
Baby Toy
9V Battery and a clip
Box
Switch
Tools:
Soldering Iron
Solder
Step 2: Downloads
1-Download 1Sheeld app from the play store
https://play.google.com/store/apps/details?id=com....
2-Download 1Sheeld library
Step 3: Installing the Library & Installing the App on Android
Installing the library:
1-open the Arduino ADK
2-open sketch then Import library then add the library
3-Choose the zip file from where you downloaded
Installing the App on Android:
After downloading the app ,open it and search for the 1Sheeld and connect it , then choose the needed shield (Mic-MusicPlayer-Twitter)
,Then log in with Twitter, and Choose the tracks for MusicPlayer , I made 2 tracks one for SleepingMode (Quiet music) and the other for WakingMode (Children songs)
Step 4: Code
In this code I wrote in different style,I wrote it from downside to upside ,I had 3 Functions (1-SleepingMode1())-(2-SleepingMode2())-(3-WakingMode()) ,I wrote the third at first , then the second then the first
SleepingMode1: if the Baby starts crying the arduino starts playing some quiet Music
SleepingMode2: if the baby didn't stop crying the arduino continue playing the quiet music
In all these functions arduino send to the parents message on the twitter to inform them any updates
include<one.sheeld.h> String account = "imtheparent2015";// The parent account on twitter String Message0 ="Arduino Now is on Monitoring Mode , Stay tuned for any updates"; String Message1 = "The baby is crying ,The Arduino is on SleepingMode right now stay Tuned For any updates";// The Arduino message for the parent at the Sleeping Mode String Message2 = "The baby is awake ,The Arduino is on WakingMode right now , and playing some songs";// The Arduino message for the parent at the Waking Mode String Message3 = "The baby is now asleep ,You Are Safe :D";// The Arduino message for the parent at the Sleeping Mode String Message4 ="The Baby is still crying ,Stay tuned for any updates"; int green=13;//Green LED (Checking LED) int red=12;//Red LED (Alert LED) int toy=10;//Toy relay pin int cry=0;//Checking if the baby is crying,If cry ==10 so the baby is crying int x=0;//For checking if the program passes through sleepingMode 1 int y=1;//For checking if the program passes through sleepingMode 2 int z=0;//For checking if the program passes through WakingMode boolean mon=true;//For the monitoring mode to run it only one time //////////////////////////////////////////// void setup() { pinMode(toy,OUTPUT);//Toy relay circuit pinMode(green,OUTPUT);//Green for Monitoring Mode pinMode(red,OUTPUT);//red for alert OneSheeld.begin();//Begining of 1SHEELD } //////////////////////////////////////////// bool Crying()//Responsible for getting the value of the Mic(Crying Sound) { //Getting the sound if(Mic.getValue() >=80)// Sound of the crying baby (Measured by dBs) return true; // True = Baby is crying else return false; //False = Baby is sleeping } /////////////////////////////////////////// void MonitoringMode()//send the message to confirm that arduino is working { if(mon==true) { Twitter.sendMessage(account,Message0);//sending message mon=false;//to insure that the program doesn't run it again } } /////////////////////////////////////////// void SleepingMode()//First function that the program passes by`if the baby is crying { MusicPlayer.play();//Playing some quiet music for the baby Twitter.sendMessage(account,Message1);// Sending a message on twitter for the parents delay(30000);//Delay for playing Quiet music for 5 Mins MusicPlayer.pause(); //Pause the music to check whether the baby slept or not x=1;//Confirm that the program passes thourght this function y=0;//to avoid looping delay(5000);//Silent delay to check whether the baby still crying or not } /////////////////////////////////////////// void WakingMode()//Third Fn that the program passes by if the baby still crying { digitalWrite(green,LOW);//Turn off the green light Twitter.sendMessage(account,Message2);// Sending a message on twitter for the parents MusicPlayer.next();//switch to WakingMode songs (Ex:Old MacDonald Had A Farm ) MusicPlayer.play();//Playing songs for the baby digitalWrite(toy,HIGH);//turn on the Children toy delay(30000);//Delay for the songs MusicPlayer.previous();//Back to the previous Song(Quiet songs) MusicPlayer.stop();//stops the MusicPlayer digitalWrite(toy,LOW);//turn it off cry=0;//Reset the value to the intial value z=0;//Reset the value to the intial value y=1;//Reset the value to the intial value x=0;//Reset the value to the intial value } ////////////////////////////////////////// void SleepingMode2()//Second Fn that the program passes by if the baby still crying { digitalWrite(green,LOW);//turn off the monitoring LED Twitter.sendMessage(account,Message4);//Sending a message on twitter for the parents MusicPlayer.play();//Continuing the quiet music for the baby delay(30000);//Delay for music MusicPlayer.pause();//Pause the music for checking z=1;////Confirm that the program passes thourght this function x=0//for preventing the program to run these function again } //////////////////////////////////////////\ void loop() { MonitoringMode(); //////////////////////////////////////////// if(y==1)//If the baby is sleeping { digitalWrite(green,HIGH);//Turning on the Green LED(Checking LED) //////////////////////////////////////////// if(Crying())//If the baby is crying { digitalWrite(red,HIGH);//Turn on the Sound LED delay(100); digitalWrite(red,LOW);//Turn off the Sound LED cry++;//Increment the cry value intial value =0,The program starts at cry =10 delay(300);//Delay to cancel the noise } } /////////////////////////////////////////// if ((Crying())&&(z))//if baby is crying and the program passes through sleepingMode 2 { WakingMode();//starts the WakingMode delay(5000);//Delay before looping } ////////////////////////////////////////// if((Crying())&&(x==1))//if baby is crying and the program passed through sleepingMode 1 SleepingMode2();//Starts the SleepingMode2 else if((!Crying())&&(x==1))//if the baby isn't crying and the program passed through sleepingMode 1 { Twitter.sendMessage(account,Message3);// Send a message on twitter for the parents \ cry=0;//Reset the value to the intial value z=0;//Reset the value to the intial value y=1;//Reset the value to the intial value x=0;//Reset the value to the intial value } /////////////////////////////////////////// if(cry==10)//If the cry=10 means the baby is crying { digitalWrite(green,LOW);//Turn off the green LED SleepingMode();//starts the SleepingMode 1 } }
Step 5: Circuits & Soldering All the Components
I didn't solder the components on a board ,I solder them togther to minmize the size to be easy put in the toy but it's up to you, you can solder it on a board
after soldering put the relay circuit in the toy and connect the relay to the battery of the toy one at (COM) and the other at (NO) of the relay
After finishing the toy circuits you will have three wire (+5V-GND-Arduino output) connect those to the arduino
And you are ready to GO.....
Step 6: Ready to GO
Now you are ready just turn on the Arduino and open the app and scan for devices it will connect automatically ,Just put the your phone next the baby and GO WATCH A MOVIE YOU ARE SAFE :D