Sunday, September 29, 2019

IoT House Monitor


In the fall of 2018 I developed an initial prototype of an IoT House Monitor using Particle boards, the Particle platform and ThingSpeak.  The goal was to prototype a device that would monitor temperature and humidity and publish the data for remote monitoring.

See Adventures in IOT - Particle Photon for more information on the Particle Photon and Particle Platform.


Hardware

The prototype was built using a Particle Argon so that if the house to be monitored didn’t have Internet connectivity a Particle Boron could be swapped for the Argon and the setup would be able to communicate using cellular rather than wifi.

A BME280 sensor was used for temperature and humidity, information was locally displayed using a 0.96" I2C IIC SPI Serial 128X64 OLED LCD Display and for local input a 1 x 4 membrane keypad was added.  A lipo battery was added so that the device could operate for a time without external power.

Software

The Particle platform along with excellent libraries from Adafruit for the BME280 and the OLED display made it extremely easy to integrate the individual components into a working prototype.  In addition to the Adafruit libraries I included the clickButton library.

The code for the prototype is on Github.

Cloud Services

Once the data has been transmitted into the Particle Cloud I used a webhook to send the data over to Thingspeak.  Thingspeak has a nice clean simple to use interface and a free tier for small non-commercial projects that allows messages every 15 seconds which was more than enough for my prototype.

On the Particle end the webhook integration was configured as shown below:


Then on the Thingspeak end widgets were configured to create the following Then on the Thingspeak end widgets were configured to create the following:

ThingSpeak

After creating a ThingSpeak account you start by setting up a channel.  For this channel I used the following:


You then customize the resulting web page by editing the charts, removing charts or by adding visualizations.  Below are the settings for the Temperature chart.



At this point you should have a pretty nice dashboard to monitor the temperature and humidity.

Friday, April 12, 2019

What I Have Been Up To

Over the past several years I have not been good about posting about the projects I have been working on.  This post is a high level overview of what I have been up to.

Home Automation (September 2016)

In September 2016 I setup a Raspberry PI 3 B+ running Domoticz with a Aeon Labs Z-Stick Series 2 USB device to support Home Automation.  My setup is very simple. 

I have four Ecolink Z-Wave Motion Sensors, three Leviton Z-Wave Smart Plug-In Dimmers, one GE Z-Wave 3 Way Dimmer Switch, one GE Z-Wave In-Wall Smart Switch and an Everspring Siren.  The system is setup to turn lights on and off at certain times and act as an alarm system when we are not home.

Domoticz was easy to setup, simple to use and very reliable.  In the two and a half years I have been using it the system has no hung or crashed.

When I started Domoticz I used the built in timers for the lights and LUA scripting for the security system.  Since the original installation I have upgraded Domoticz which added Python scripting which I am using for some of the newer automation.

I would highly recommend Domoticz for anyone looking for reliable and easy to use home automation.

Home Server Upgrade (September 2017)

Back in March of 2015 I shared setting up a home server using a pcDuino3 Nano and OpenMediaVault.  In September 2017 after successfully running that home server for two and a half years I migrated to an ODROID-HC1 running OpenMediaVault.  This setup has performed admirably since then.  Based on my experience I would recommend both the ODROID-HC1 and OpenMediaVault for use as a home server.

Home Music Center Upgrade (December 2017)

In December 2015 I shared setting up a Raspberry PI Music Player.  In December 2017 I migrated from my Raspberry PI running the Rune Audio Player to a Raspberry PI running MPD controlled by MPD clients on our cell phones.  This setup allows everyone in the house to control the music and has worked quite well.  I had to build a web based interface using lirc to control power and volume on the stereo receiver that powers speakers throughout the house.  The new setup has worked quite well.

Internet Bandwidth Monitor (October 2018)

Many years ago when I migrated from Comcast to Verizon Fios one of the things that I lost was the ability to monitor Internet utilization at my home. 

My Comcast cable modem supported SNMP and I had setup a script that ran every five minutes that queried the appropriate MIBs and then graphed the data using MRTG.  The Fios router doesn’t support SNMP so the way I was monitoring the bandwidth couldn’t be setup the same way.  I eventually found that I could telnet into the Fios router and pull down utilization data.  However, some where along the way a router upgrade broke that feature.

Late in the summer of 2018 I started looking at browser automation and discovered the ability to script a headless instance of a browser to scrape data off web pages  I started out using PhantomJS which I found was easy to use but also found out that development had been suspended in March.  I ended up using Headless Chrome and Selenium with a Python script to scrape the utilization data off the Fios router.

I had started this project on a Raspberry PI 3 B+ but found that the process didn’t run well on that platform and I ultimately had to move it to my much more powerful Windows desktop.  Once the data is scraped off the web page I store it in an InfluxDB from which I drive dashboards using Grafana.

The InfluxDB and Grafana are running on my ODROID-HC1 / OpenMediaVault home server as Docker containers using the OpenMediaVault Docker Plugin.

The whole setup has been running quite well for the past six month and I am once again able to see how much bandwidth is being consumed on my Internet connection.

House Temperature Monitor Prototype (November 2018 - March 2019)

Back in May of 2016 I shared my initial experiences with the Particle Photon.  I was very impressed with the photon and Particles platform.  So when they announced in their Particle Mesh devices for pre-order in February 2018 I decided to an Argon and four Xenons. 

Flash forward to the fall of 2018 and the Paticle Mesh boards arrive and I decide to build a simple monitoring device that would upload the temperature to a service which would allow it to be monitored from a remote location.  The beauty of using the Particle devices was that the device could be prototyped using an Argon and connect over wifi but could be deployed using the Boron and connect over LTE.  This would allow it to support monitoring where there wasn’t wifi.

The resulting prototype consisted of an Argon, an I2C VME280 temperature sensor, an I2C 128x64 OLED display and a Lipo battery in a plastic case with four buttons.  Using the firmware on the Argon uploads the temperature every five minutes to the Particle Cloud which creates a webhook to ThingSpeak where the temperature and humidity are presented in both graph and gauge form.

The prototype device has been sitting on my desk uploading data ThingSpeak consistently for the past two months.

I have a number of ideas that I hope to incorporate in a subsequent prototype and hope to document in more detail some of the useful lessons I learned along the way.