In this blog post, we’ll post a very simple tutorial about gathering some simple data from a Sense Hat on a Raspberry Pi, post this data to Azure IoT Hub, parse them though Azure Stream Analytics and insert them into a simple Azure SQL Database table. This blog post helps as a tutorial for Azure IoT Hackathon we organized in Athens, on 18/3/2016.
- On the hardware side, we’ll use a Raspberry Pi 2 and a Sense Hat
- Creating a new Universal Windows Platform application
- Write some code to get the temperature reading from the Sense Hat
- Post the temperature/pressure/humidity reading from Sense Hat to Azure IoT Hub
- A Stream Analytics job will store the temperatures on an Azure SQL Database
We’ll start by creating a new Azure IoT Hub, so we can connect our Raspberry to it.
Today, something somewhat weird occured to me. If you build a game in Unity engine, you can easily publish it for Windows Phone, even in old and very low-end devices like the Lumia 520. This phone has a Qualcomm Snapdragon S4 MSM8227 with ISA ARMv7 supported. The Raspberry Pi 2 Model B device also has an ARM v7 processor and can be loaded with Windows 10, that support the Universal Windows Plarform, which Unity supports. You can imagine the question, can a game built with Unity be published into a Raspberry Pi 2?
Read More »
Recently I became the happy owner of a brand new Raspberry Pi 2. In case you don’t know about it, Raspberry is a pretty powerful computing device in a form factor of a credit card. You can install Windows 10 IoT Core on the Raspberry and code against it using the Universal Windows Platform (UWP_, aka write programs for this small device using C# and XAML. So, I embarked on a new self-education journey and, after some reading, I had to pick a pre-made hands-on sample and replicate it. I picked this one, since the only extra hardware it requires is a shield (Sparkfun Weather Shield) and some cables to connect it with the Raspberry. The sample instructions on hackster.io are pretty straight forward and the source code provided for the Weather Shield + UWP integration is pretty self-explanatory. Only modification I made was to add a timer to pull humidity and temperature from the shield at a fixed time interval.
However, I wanted to take this project one step further. Connect the device to Azure IoT Hub, send data to it, pass the data via a simple Azure Stream Analytics job and store it to Azure Table Storage, expose it via a Web API web service and consume it from an ASP.NET MVC web application. Well, it’s not as difficult as it sounds! I’ll briefly describe the steps I used
Azure IoT Hub
The Azure IoT Hub (in preview, at the time of writing) is a service in which millions of devices can connect and exchange messages. The IoT Hub enables bidirectional communication to and from each device, can manage each device separately and provides a high level of security. To create a new IoT Hub, login into the new Azure management portal and create it. There is also a free tier to support app development, which you can use. If you do not have an active Azure subscription, you can easily create a trial account. Even though it requires a credit card, you will not be charged at all, provided you stay within your spending limits.
Read More »
I was really lucky lately to get my hands on a netduino. I’ve never programmed on such a small device before and I have to confess that it’s really fun and awesome!
First, take a look at the video to see what’s going on. Basically, we are instructing the netduino to play a specific set of noted via a web browser on our PC.
(Please visit the site to view this video)
We’re using a netduino device. For the unaware, it’s a small device that runs a small version of the “big” .NET Framework, called .NET Micro Framework, so one can easily use C# and Visual Studio to code for it. It’s connected to a Piezo, a small component that can create some noise.
We’ve connected the netduino to our PC via USB cable and via an Ethernet cable. The USB connection allows us to deploy and debug our stuff on the device whereas the Ethernet cable allows us to make a small LAN between netduino and our PC. Without any more hassle, let’s check the code!
Code was found on Getting Started with Netduino book. It basically adds octaves on a hashtable, sets frequency and period, connects to the speaker (via PWM which is accepting input on the Digital 5 Pin) and plays the respective input. Check the full code here
Read More »