Introduction: Smart Baby Monitor With Intel Edison and Ubidots

About: Pooja Baraskar is an Intel Software Innovator,author, speaker and a passionate Software Developer, who is always willing to learn and explore new technologies. Being a programmer, she always have a solution fo…

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.

Step 1: Our Smart Baby Monitor Will:

Monitor baby if he is sleeping or playing.

Will notify parents if he is crying.

Monitors baby’s temperature.

Immediately alerts if it notices abnormal temperature.

Visually representation of data.

Data can be monitored from anywhere.

Step 2: 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.

Step 3: Making Connections

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

Step 4: 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.

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

Step 5: Code for the Analog Microphone

function readSoundSensorValue() {

var buffer = new
upmMicrophone.uint16Array(128);

var len =
myMic.getSampledWindow(2, 128, buffer);

if (len)

{

var thresh =
myMic.findThreshold(threshContext, 30, buffer, len);

myMic.printGraph(threshContext);

if (thresh)

console.log("Threshold is " + thresh);

v.saveValue(thresh);

if(thresh>50
&& thresh<150)

showNormalLCD();

if(thresh>=150)

showLCD();

if(thresh<50)

showSleepLCD();

}

}

setInterval(readSoundSensorValue, 1000);

Step 6: Code for the Temperature Sensor

var temp = new groveSensor.GroveTemp(1);

console.log(temp.name());

var i = 0;

var waiting = setInterval(function() {

var celsius =temp.value();

var fahrenheit= celsius * 9.0/5.0 + 32.0;

console.log(celsius + " degrees Celsius, or " +Math.round(fahrenheit) + " degrees Fahrenheit");

i++;

if (i == 10)
clearInterval(waiting);

}, 1000);

Step 7: Sending Data to Cloud

var ubidots = require('ubidots');

var client = ubidots.createClient('YOUR-API-KEY');

client.auth(function () {

this.getDatasources(function (err, data) {

console.log(data.results);

});

var ds =
this.getDatasource('xxxxxxxx');

ds.getVariables(function (err, data) {

console.log(data.results);

 });

ds.getDetails(function (err, details) {

console.log(details)});

var v =
this.getVariable('xxxxxxx');

v.getDetails(function
(err, details) {

console.log(details);

});

v.getValues(function
(err, data) {

console.log(data.results);

});

Step 8: Setting Up Ubidots

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 numbers 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 http://ubidots.com/

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

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.

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

5) Select My Profile->API Keys. Get your API Key from here.

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.

Step 9: Running the App

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.

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

Intel® IoT Invitational

Participated in the
Intel® IoT Invitational