Skip to main content

Posts

[IoT Home Project] Part 5 - Send data to Azure IoT Hub, control time interval and refac the configuration information

In this post we will discover how we can: Send all device sensor data that are read from GrovePI to Azure IoT Hub Read sensor data at a specific time interval Extract all configuration data in a separate file Previous post:  http://vunvulearadu.blogspot.ro/2016/12/iot-home-project-part-4-sending.html GitHub source code: https://github.com/vunvulear/IoTHomeProject/tree/master/nodejs-grovepi-azureiot Send all device sensor data that are read from GrovePI to Azure IoT Hub This is a simple task. The function that reads sensor data from GrovePI already returns all the sensor data. The only thing that we need to do is to put this information in the message that is send to Azure IoT Hub. In the future it is pretty clear that we will have different type of messages that we send over IoT Hub. Because of this we shall add a property to the message that is send to IoT Hub that specifies the message type - in our case we'll call the message that contains sensor data 'senso...

[IoT Home Project] Part 4 - Sending temperature data from Raspberry PI to Azure IoT Hub

Previous post: http://vunvulearadu.blogspot.ro/2016/12/iot-home-project-part-3-nodejs-module.html GitHub source code: https://github.com/vunvulear/IoTHomeProject/tree/master/nodejs-grovepi-azureiot This post focus on the communication between Raspberry PI and Azure IoT Hub. Until now we developed the Raspberry PI application that is able to read sensors data from GrovePI using Node.JS libraries. Now is the moment to write the Node.JS module that sends temperature data from Raspberry PI to Azure IoT Hub. Creating Azure IoT Hub instance The first step is to create a new instance of Azure IoT Hub. Don't worry about Azure costs. There is a free tire of Azure IoT Hub that allows us to send 8.000 messages per day for free. For testing and home use scenarios, I think that this is more than enough. A nice tutorial on how you can create a new instance of Azure IoT Hub can be found here . Once you create the instace, you'll need the access tokens that can be taken from 'Shared...

[IoT Home Project] Part 3 - Node.JS Module that reads sensor data

Previous post:  http://vunvulearadu.blogspot.ro/2016/12/iot-home-project-part-2-visual-studio.html GitHub source code:  https://github.com/vunvulear/IoTHomeProject/tree/master/nodejs-grovepi-azureiot In this post we will continue developing the IoT Home Project, by creating a module for Node.JS that reads the sensor data. Why we create a Node.JS module? We want to group all the logic that reads sensor data under the same roof. We design the module in a such a way that it will allow us to initialize an instance of an object that can read all sensors data. GrovePiSensors Module The module was is called GrovePISensors and expose 5 functions: getSoundData - Gets Sounds data getTempAndHumData - Gets Temp and Humidity data getDistanceData - Get Distance data from Ultrasonic sensor getLightData - Get Light data getAllSensorsData -  Get all sensors data that can be read The getAllSensorsData returns an object, where all this information are available. The s...

[IoT Home Project] Part 2 - Visual Studio Code and the first node.js app

Previous post:  http://vunvulearadu.blogspot.ro/2016/12/iot-home-project-part-1-initial-setup.html In this post we will take a look on the initial setup of Raspberry PI, GrovePI and a sample code that helps us to check if node.js and GrovePI works as expected. Before we talk about the initial setup of the device. Useful tools for Raspberry PI I recommend to start with a fresh installation of OS. You can download the OS image from  https://www.raspberrypi.org/downloads/ . I am a big fun of NOOBS, but feel free to use other versions of OS. To write the image on the memory stick you can use Win32 Disk Imager . A basic tools that do his job. Once you wrote the image on a stick, don't forget to connect it to a monitor and activate SSH. By default SSH is disabled. You can do this from the console, but you can use raspi-config, a nice tools that allow you to do different configurations on your device sudo raspi-config The SSH options is under 'Advanced Options'. From ...

Azure Functions - Things that we need to consider

In the last posts we discussed about how we can write Azure Functions to process images from OneDrive , the support for CI that comes with them and the base functionalities . In this post we will take a look on things that we shall avoid to do in Azure Functions and what are the differences between Azure Functions and Azure Web Jobs. Things that we need to consider Avoid HTTP communication between Azure Functions In complex scenarios, we can end-up easily with Azure Functions that needs to communication between each other. In this kind of scenarios, the first things that we could do is to use web hooks or HTTP requests to communicate between them. This is not the recommended approach for cases like this. If you reach a high volume of data, you might have some problems. In serve-less systems the communication channel between components shall be messaging system over any kind of queue system. Not only communication over queues is more cheaper, but the reliability and scaling me...

[IoT Home Project] Part 1 - Initial Setup

I started some time ago to play with Raspberry PI and GrovePI sensors. After playing for a few weeks I said that I need to do something more interesting. Mission Why not combine Raspberry PI and GrovePI sensors with Azure IoT Suite and detect if somebody is at the desk, show STOP sign if the given person is busy and so on. I'll start with very basic use-cases, that will evolve in time. The scope of the projects is to learn different technologies that can be used together Raspberry PI configuration The code that will run on Raspberry PI will not be to complex, or this is what I expect now (smile). In this context it doesn't make sense to try to use Windows IoT. Also, the support for GrovePI is better for Node.JS in comparison with .NET. In the context of my past experience with Debian on Raspberry PI that was good I decided that I will use Debian on Raspberry PI. Development Environment First thing is to make the initial setup of development environment. For backed, th...

Azure Functions - Features Review

In the last two posts related to Azure Functions we talk about how we can write functions that can process images from OneDrive and the current integration with Visual Studio and Continuous Integration. In this post we will take a look over the main features, price model. Pay-per-use Personally, this is one of the strongest points of Azure Functions. You pay only what you use, when your code is not running or is not called by an external trigger, you don't need to pay. You cannot want more from the hosting perspective. When you have zero clients, you pay zero. When you have n clients, you pay for each of them. The pricing model will be described later on. Multiple-languages support The number of languages that are supported is not 1 or 2. In this moment we have support for C#, F#, JS (by Node.JS), PHP, Python, batch, bash. Another interesting feature is that you can come with any executable that can run as an Azure Function. In interesting concept, that I promise that I wi...