The Photon as a weather station, connected to Azure IoT Platform

A few weeks ago, Jon Gallant asked for beta tester for the Azure IoT Platform integration with the Partical platform (Beta Testers Needed for Particle to Azure IoT Integration).

This was great news to me. I have a Photon Azure Starter Kit laying around and I tried once to connect it to the Partical platform.


The kit has potential: it comes with a SparkFun Photon Weather Shield:


And on the shield are already attached:

  • Humidity/Temperature Sensor – HTU21D
  • Barometric Pressure – MPL3115A2

And it has two RJ-11 connectors for Weather Meters like this one:


But that initial (EventHub?) integration was not quite intuitive and I had more projects to work on. So I moved on.

Now, I had a second chance to make the Photon work!

The first steps are to register your unique Photon device and attach it to the internet (it has a Wifi chip onboard).

If you go to the online IDE, you can write code for your Photon and flash (deploy) it ‘over the air’. This is fun, as long as your Photon is online (wherever it is running), you can contact it using a browser.

The integration tutorial, the blog of Jon Gallant, is very straight forward regarding making an Azure IoT Hub integration. You only need an Azure IoT Hub and a specific access policy.  This will help you in sending a string from the Photon to the hub.

Update: Another useful tutorial comes from the Particle site and it shows how to send some integers.

But sending a JSON message is less intuitive.

Continue reading “The Photon as a weather station, connected to Azure IoT Platform”

Building a door switch using Domoticz, X10RF and Arduino

Today, I built a door switch for Domoticz which checks if a certain door in my house is opened or closed.

I already have a combination of a Raspberry Pi running Domoticz and an RFLink Gateway which is listening using a 433Mhz transmitter. So I was suggested to look at the X10 protocol. This protocol is already supported by Domoticz and just sending the state of a switch is simple with this protocol.

I also already had a handful of 433MHz transmitters and receivers, bought in the past. So first I had to check which ones were the transmitters 🙂


And I have these nice micro switches with a roller at the tip of the lever, perfect for the job!

Continue reading “Building a door switch using Domoticz, X10RF and Arduino”

Internet button, Domoticz and Microsoft Flow in Unison

For a few weeks now, I have my personal Domotics solution. I could have bought a complete solution but rather I was intrigued by Domoticz. It’s an open source Home Automation System and what’s really great, it interacts with all kinds of communication protocols.

Basically, you need a device which can run a web server and you need a local gateway for the transmission of the various signal.

This is how my rig looks like:


Continue reading “Internet button, Domoticz and Microsoft Flow in Unison”

The output sink format of a Stream Analytics job matters!

When you look at examples of Stream Analytics queries usage, most examples are pretty straightforward. These work with simple queries which return single line output.

For example, a query like:

  hubinput timestamp by EventProcessedUtcTime

… will return a line like:

{"cycle":4, "errorcode"=1, "deviceid":"MachineCyclesDemo"}

In an Azure Function, this will arrive as:

2016-12-19T15:15:07.045 Function started (Id=e58ea9ec-fd8d-469e-bd9c-ea027ce2dbb4)
2016-12-19T15:15:07.690 Messages arrived: {"cycle":4, "errorcode"=1, "deviceid":"MachineCyclesDemo"}
2016-12-19T15:15:07.690 Function completed (Success, Id=e58ea9ec-fd8d-469e-bd9c-ea027ce2dbb4)

But when the query is a bit more complicated, like grouping with a time interval:

  IoTHub.ConnectionDeviceId as deviceId
  hubinput timestamp by EventProcessedUtcTime
  errorCode <> 0
GROUP BY IoTHub.ConnectionDeviceId, TumblingWindow(Duration(minute, 1))
HAVING Count(errorCode) > 1 

Then the format of the messages returned can be unexpected.

Continue reading “The output sink format of a Stream Analytics job matters!”