Smart Baby Monitor with the Intel Edison Board 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 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:
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 fromhttps://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.
1. Select a blank Node.Js template and create a new project.
Code for the Analog Microphone
01 function readSoundSensorValue() {
02
03 var buffer = new upmMicrophone.uint16Array(128);
04
05 var len = myMic.getSampledWindow(2, 128, buffer);
06
07 if (len)
08
09 {
10
11 var thresh = myMic.findThreshold(threshContext, 30, buffer, len);
12
13 myMic.printGraph(threshContext);
14
15 if (thresh)
16
17 console.log("Threshold is " + thresh);
18
19 v.saveValue(thresh);
20
21 if(thresh>50 && thresh<150)
22
23 showNormalLCD();
24
25 if(thresh>=150)
26
27 showLCD();
28
29 if(thresh<50)
30
31 showSleepLCD();
32 }
33 }
34 setInterval(readSoundSensorValue, 1000);
35
36
37 <a href="https://software.intel.com/sites/default/files/managed/74/61/code.png"><img he
Code for the Temperature Sensor
01 var temp = new groveSensor.GroveTemp(1);
02
03 console.log(temp.name());
04
05 var i = 0;
06
07 var waiting = setInterval(function() {
08
09 var celsius = temp.value();
10
11 var fahrenheit = celsius * 9.0/5.0 + 32.0;
12
13 console.log(celsius + " degrees Celsius, or " +
14
15 Math.round(fahrenheit) + " degrees Fahrenheit");
16
17 i++;
18
19 if (i == 10) clearInterval(waiting);
20
21 }, 1000);
Sending data to Cloud
01 var ubidots = require('ubidots');
02
03
04 var client = ubidots.createClient('YOUR-API-KEY');
05
06
07 client.auth(function () {
08
09 this.getDatasources(function (err, data) {
10
11 console.log(data.results);
12
13 });
14
15 var ds = this.getDatasource('xxxxxxxx');
16
17
18 ds.getVariables(function (err, data) {
19
20 console.log(data.results);
21
22 });
23
24 ds.getDetails(function (err, details) {
25
26 console.log(details);
27
28 });
29
30
31 var v = this.getVariable('xxxxxxx');
32
33
34 v.getDetails(function (err, details) {
35
36 console.log(details);
37
38 });
39
40 v.getValues(function (err, data) {
41
42 console.log(data.results);
43
44 });
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.
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.
1. Click on the variable and copy the variable ID. Paste this in your code.
1. Select My Profile->API Keys. Get your API Key from here.
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.
For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone
Source: https://software.intel.com/en-us/blogs/2015/09/27/smart-baby-monitor-with-intel-edison-and-ubidots