First Steps in IoT
Solving a Frustration at Home with Sigfox
Over this past weekend I had an opportunity to develop my first IoT solution.
We have a prepaid electricity meter at home, and often we overshoot our consumption predictions. When the electricity went out one evening recently, plunging us all into darkness, I knew I’d found my first IoT project!
Necessity being the mother of invention …
My PoC definition was: Build an IoT solution that monitors the electricity meter and detects when the ‘electricity running low’ LED comes on. When it does send an email to my wife alerting her to buy more electricity (being married to an accountant means I can’t be trusted to pay the bills … but that’s a whole other article).
- u.fl to SMA cable (and a spare wifi antenna)
- USB A to micro-USB B cable
- Photosensitive Sensor Module
- Battery Pack (not needed yet)
- 3 x F-F Jumper Cables
I chose Sigfox as the Low Power WAN for this project because some friends mentioned Sigfox to me and I wanted to experiment with it. I could have used a WiFi-enabled board but I wanted to explore the LPWAN technology, and Sigfox specifically (there is also LoRa).
I went with the MKRFOX1200 board from Arduino because it had the shortest delivery lead time online. But any Sigfox-compatible board would work.
I also bought a Photosensitive Sensor Module to sense when the ‘low electricity warning’ LED came on. a simpler photoresistor would work, but my local electronics store only had the board in stock.
The pins in use are: GRND (Ground), VCC (Power) and A1 for the signal (orange jumper above)
Once you unwrap your device you need to register it at Sigfox as a development kit, and configure a Callback function to send an email when a message is received by the Sigfox backend.
There are a few tutorials out there for this bit so I’m not going to repeat those, and I want to publish asap (I might come back and edit this with the individual steps)
You’ll need to download the Arduino IDE and install the relevant libraries, again there are some resources out there already that explain this setup.
Here’s the code I used:
Minimum Viable Product
Once I uploaded the sketch to the board, and then shone a torch on the Photoresistor I got the following test results:
Looking at the Sigfox backend I saw the message come through:
And then checking my email inbox I found this:
I’m over the moon that it worked so easily!
Next I’m going to work on an enclosure so I can hang the ‘meter-magic-5000’ onto our electricity meter and then set it to watch for the ‘low electricity warning’ LED to come on, oh, and then chuckle when my wife gets an email from ‘the house’.
I’m also going to try to use Sleep mode to put the board to sleep between events, and then wake the board when the sensor trips.
… and I’m already thinking about how to read the digits from the LCD display on the electricity meter every hour and send the reading via email. But that’s going to need a camera module … actually I have one of those for my Raspberry PI, just need to figure out a light source for the camera …
I’ll update this post with my progress as I go.