Hi All
For my “hello world” app I decided to monitor the temperature using a thermistor, store the results in Azure and then graph the stored data. This ended up being more of a challenge than I expected, so I thought I’d share my leanings here.
For basic thermistor information you can check out this article on Wikipedia. I used the “B equation” for my temperature calculation as I didn’t have the constants required for the standard Steinhart–Hart equation.
When it comes to the electronics and Spark code I started by following and porting this guide from Adafruit. I didn’t really like their explanation of the electronics and maths though (and I couldn’t get it working - although I think that’s because my thermistor was broken).
It’s been a long time since I’ve used either maths or electroncis, so I wanted a proper explanation of everything. A friend pointed out this paper from a student at Portland State University. The first 4 pages give a really clear and easy to follow explanation of the electronics and how to interpret the value read from the analog pin. The rest of the paper uses the Steinhart–Hart equation so I didn’t follow that part.
Once I had the electronics and Spark code working correctly (I couldn’t get a 15K thermistor working, so switched to a 4K7) I created a website and database on Azure. The site would serve 2 purposes: recieve and store data sent by the Spark and provide a graph to view the data.
To receive the data I just created a basic webservice. My Spark would do a HTTP POST to this webservice using the HTTP library provided by Spark. The website stores all data summarized by hour (the Spark POSTs every minute) including: minimum, maximum, average, date, hour of day, day of week, week of year, month etc.
The 2nd part of the site uses the Highcharts JavaScript library (free for non-commercial uses) to render the past 7 days of data in a graph. The end result looks like this (I’m in Cape Town, so it’s Spring at the moment):
Note that this is measured indoors, not outdoors! You’ll notice the drop in temperature from around 12:00 on the 17th - this is when a cold front moved in (you’ll see things are improving today ).
My next priority is to add outdoor temperature and barometric pressure readings. Or home power monitoring. All depends on which sensor arrives first
I would share the live Azure link, but it’s running on a trial account and I don’t know how long my credits will last.
Any questions, comments, suggestions always welcome.
Cheers
Greg