Smart Baby Monitor With Intel Edison And Ubidots

Intel Edison is small enough for wearables. It gives lot of flexibility to developers through the languages and programming environment it offers and it has integrated Wi-Fi and Bluetooth that makes it ideal for a wearable. Now a days there are many wearables in market for different purposes, so why not we make one for babies. With increase in nuclear families there is no one to guide the new parents about their new born baby. They are always worried about their baby regarding his/her health, temperature, environment etc. Babies need to be monitored 24*7 which is not always possible as in some families both the parents are working, sometimes they have to do lots of household chores and other issue is sleep also hence in these cases parents need a Smart Baby Monitoring System that can help them to keep track on baby’s health and alert them if any irregular activity happens.

Our Smart Baby Monitor will:

  1. Monitor baby if he is sleeping or playing.
  2. Will notify parents if he is crying.
  3. Monitors baby’s temperature.
  4. Immediately alerts if it notices abnormal temperature.
  5. Visually representation of data.
  6. Data can be monitored from anywhere.

Requirements:

Requirements
                                                                     Figure 1: Requirements

  • Intel Edison Module
  • Arduino expansion board for Edison
  • Analog Microphone
  • Temperature Sensor
  • 16*2 LCD Display
  • Power supply
  • USB cable
  • Jumper wires

Analog Microphone is a simple sound sensor that detects the sound strength of environment. Here in this project I am using Grove sensors with a Grove Base Shield. We are going to code in Node.js using Intel XDK IoT Edition.

Making Connections

  1. Connect your Edison to power supply and to your PC via USB cable.
  2. It will take 15-20 seconds to boot up, after that stack the Grove Base Shield.
  3. Connect the Sound Sensor to analog pin A0.
  4. Connect the temperature sensor to A1.
  5. Connect the LCD Display to one of the I2C port.

Programming

  1. Open Intel XDK IoT edition, if it is not already installed in your PC get it from here.

  2. If you have flashed you Edison with the Flash Lite Tool Node.Js will be already installed on your board.

  3. Connect IDE to your Edison board. It will ask you for username and password, default username is root with no password.

    Connect IDE to your Edison board
                                                       Figure 2: Connect IDE to your Edison board

  4. Select a blank Node.JS template and create a new project.

    Select a blank Node.JS Template
                                                          Figure 3: Select a blank Node.JS Template

Code for the Analog Microphone

  1. function readSoundSensorValue() {  
  2.     var buffer = new upmMicrophone.uint16Array(128);  
  3.     var len = myMic.getSampledWindow(2, 128, buffer);  
  4.     if (len)  
  5.     {  
  6.         var thresh = myMic.findThreshold(threshContext, 30, buffer, len);  
  7.         myMic.printGraph(threshContext);  
  8.         if (thresh)  
  9.             console.log("Threshold is " + thresh);  
  10.         v.saveValue(thresh);  
  11.         if(thresh>50 && thresh<150)  
  12.          showNormalLCD();  
  13.         if(thresh>=150)  
  14.         showLCD();  
  15.         if(thresh<50)  
  16.         showSleepLCD();  
  17.     }  
  18. }  
  19. setInterval(readSoundSensorValue, 1000);  
Code for the Analog Microphone
                                             Figure 4:
Code

Code for the Temperature Sensor
  1. var temp = new groveSensor.GroveTemp(1);  
  2. console.log(temp.name());  
  3. var i = 0;  
  4. var waiting = setInterval(function() {  
  5.     var celsius = temp.value();  
  6.     var fahrenheit = celsius * 9.0/5.0 + 32.0;  
  7.     console.log(celsius + " degrees Celsius, or " +  
  8.         Math.round(fahrenheit) + " degrees Fahrenheit");  
  9.     i++;  
  10.     if (i == 10) clearInterval(waiting);  
  11. }, 1000);  
Sending data to Cloud

 

  1. var ubidots = require('ubidots');  
  2.   
  3. var client = ubidots.createClient('YOUR-API-KEY');  
  4.   
  5. client.auth(function() {  
  6.     this.getDatasources(function(err, data) {  
  7.          console.log(data.results);  
  8.     });  
  9.     var ds = this.getDatasource('xxxxxxxx');  
  10.  
  11.     ds.getVariables(function(err, data) {  
  12.         console.log(data.results);  
  13.     });  
  14.     ds.getDetails(function(err, details) {  
  15.         console.log(details);  
  16.     });  
  17.   
  18.     var v = this.getVariable('xxxxxxx');  
  19.   
  20.     v.getDetails(function(err, details) {  
  21.         console.log(details);  
  22.     });  
  23.     v.getValues(function(err, data) {  
  24.         console.log(data.results);  
  25.     });  
  26. }  
Here I am using Ubidots for IoT cloud, with Ubidots we can visualizing the data in an effective way. It supports a wide range of devices and can also trigger some actions like sending mails and messages. It also offers number of API to speed our development with the language of our choice. Hence I have chosen its Node.Js library to interact with my Edison.

Setting up Ubidots 
  1. Log in to your Ubidots account or you can create one here.

  2. Select the “Sources” tab and then click on “Add Data Source” to create a new data source. Here I have added My Edison.

    Add Data Source
                                                                      Figure 5: Adding Data Source

    Select the Source
                                                                      Figure 6: Detail of data Source

  3. Once the data source is created we have to add variables to it. Here in this project we are going to send the Sensor and Temperature data, hence we will create two variables.

    Add Variable
                                                                            Figure 7: Add Variables

  4. Click on the variable and copy the variable ID. Paste this in your code.

    Variable ID
                                                                               Figure 8: Variable ID

  5. Select My Profile, then API Keys. Get your API Key from here.

    Create API Keys
                                                                            Figure 9: Copy API Key

  6. On your Dashboard add a widget of your choice, depends on how you want to visualize the data.

  7. I have chosen Gauge for the sound sensor and a Graph for temperature. By looking at the Gauge you can easily determine at intensity of sound and hence your baby’s activity and with Graph you can evaluate a sudden variation in temperature.

Build, Upload and Run your app on Edison. You will see the sensor values in debug console, if everything works fine you will notice data being send to Ubidots cloud. Navigate to Ubidots dashboard, you will see all the data sent from the sensor in our widgets. Here I have also created some alerts, if the sound level exceeds up to a certain level (means baby is crying) an alert will send to our mobile phone through SMS.

Sound Sensor
                                                                  Figure 10: Visualized data on cloud

Altar for Baby needs You
                                                      Figure 11: Alert if baby is crying

Alert For Baby is Playing
                                                         Figure 12: Message when baby is playing

Alert message For Baby is Sleeping
                                                Figure 13: Message when baby is sleeping

Type a text message
                        Figure 14: SMS alert on mobile phone

Notifications
                                   Figure 15: Email Notification

When it is about babies this much is not sufficient, I will be working on some advanced stuff with more accurate sensing and better alerts that I will share in the next part.

Up Next
    Ebook Download
    View all
    Learn
    View all