Click here to Skip to main content
15,867,308 members
Articles / Internet of Things
Article

Smart Baby Monitor with Intel® Edison and Ubidots

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
8 Oct 2015CPOL4 min read 10.2K   4  
Smart Baby Monitor with Intel® Edison and Ubidots

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

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 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 represents data.
  6. Data can be monitored from anywhere.

Requirements

Image 1

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 https://software.intel.com/en-us/iot/downloads
  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.

Image 2

  1. Select a blank Node.Js template and create a new project.

Image 3

Code for the Analog Microphone

JavaScript
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);


<a href="https://software.intel.com/sites/default/files/managed/74/61/code.png"><img height="900" width="718" src="https://software.intel.com/sites/default/files/managed/74/61/code.png" alt="" /></a>

Code for the Temperature Sensor

JavaScript
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);

Sending data to Cloud

JavaScript
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);

  });

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.

Image 4

Image 5

  1. 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.

Image 6

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

Image 7

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

Image 8

  1. On your Dashboard add a widget of your choice, depends on how you want to visualize the data.
  2. 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.

Image 9

Image 10

Image 11

Image 12

Image 13 Image 14

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
This is a Organisation

42 members

Comments and Discussions

 
-- There are no messages in this forum --