📜 ⬆️ ⬇️

Smart babysitter based on Intel Edison and Ubidots



There are a lot of wearable devices on the market now, so why not do something for newborns. Everyone worries about their children about their health, temperature, environment. Children should be monitored around the clock, which is not always possible. Often, both parents work, and they still need to do household chores and sleep. Therefore, my smart baby monitoring system “Smart Baby Monitoring System” would be very useful for them. She will be able to monitor her health and warn her; there is something special happening.

The Intel Edison module is small enough to create such a wearable device. There is a large selection of programming languages ​​and development environments. It also has built-in Wi-Fi and Bluetooth, which can also be useful.

Our Smart Baby Monitor device will be able to:
  1. Follow the child if he is sleeping or playing.
  2. Inform parents if he cries.
  3. Monitor the temperature.
  4. Immediately report if the temperature is abnormal.
  5. Show data visually.
  6. Giving view data remotely.

')

We will need:






An analog microphone is a simple audio pickup that detects the volume of a surround sound. In this project, I used Grove sensors from the Grove Base Shield kit. We will write the program in Intel XDK IoT Edition using Node.js.

We connect


  1. Connect the sound sensor to the A0 connector.
  2. Connect the temperature sensor to A1.
  3. Connect the LCD screen to one of the I2C ports.
  4. Connect Edison to the power supply and to your computer with a USB cable.
  5. After 30 seconds, the system should boot up.


Programming


  1. Open Intel XDK IoT edition. If it is not already installed on your computer, download it .
  2. If you were flashing the Intel Edison board with a new firmware, then Node.js should already be installed.
  3. Connect the IDE to the Edison board. You will be asked for the username and password that you had to set earlier when configuring the card.




Select a blank project template and create a new project.



Microphone code:

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




Code for 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); 


Sending data to the 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); }); 


I use Ubidots to work with IoT-cloud. With Ubidots, we can effectively visualize data. It supports a wide list of devices and can perform some actions, such as sending mail and SMS messages. It also offers an API that will allow us to speed development for our programming language. I chose the Node.js library to interact with Edison.

Configure Ubidots


  1. Log in to your Ubidots account or create a new one at ubidots.com .
  2. Select the “Source” tab and click “Add Data Source” to create a new data source. We will add "My Edison".






The data source is selected, now we need to add variables. In this project we are going to send data from the temperature sensor and the sound one, so we will create two variables.



Click on a variable and copy its identifier. Paste it into your code.



Select keys from My Profile -> Keys API:



On your control panel, select the view items, depending on how you want to visualize the data. I chose the arrow view for the sound sensor and the graph for the temperature. Looking at the gauge, you can easily determine the volume of the sound and, accordingly, the activity of your child, and with the help of the graph you can see the change in temperature.

Build, download and run your application on Edison. You will see the sensor values ​​in the debug console, and if everything works correctly, you will notice that the data is sent to the Ubidots cloud. Go to the control panel Ubidots, there you should see all the data that was sent. I also created alerts if the sound level exceeds a certain threshold (this means that the child is crying). A warning will be sent to your mobile phone via SMS.











Plans


When it comes to children, nothing can be too much. I plan to continue working on this system, for example, I will try to increase the sensitivity and improve the warnings.

Source: https://habr.com/ru/post/276393/


All Articles