Jump to content

Raspberry Pi Based Temperature/Humidity Monitoring

Recommended Posts

In the absence of a modding project, I've been finally tinkering with my Raspberry Pi stuff, and using it as an excuse to learn some some new technologies, and hone some existing skills...


I've always liked data, and analyzing information, and just generally satisfying my curiosities when it comes to things like data correlations and things like that.  I decided to make myself a set up to monitor temperature and humidity around the house, since I wanted to know.  Specifically in my "Mod Room", where I've got all my computer stuff, as that room has always seemed damp, and has had a mold issue in the past, with walls that weren't able to breathe.  Also being able to keep an eye on the temperature/humidity in the garage, and eventually workshop will be nice too.


Anyway, I've done almost all of the electronics tinkering to this point, including the software side of things.  I've got the temperature sensor units figured out as far as hardware and what code I've got running on them, as well as a central server for a web interface (Pi2), and a touch screen terminal to act as a little station to sit on a table and display info (Pi3 with a touch screen LCD I bought a couple years ago).  

All I've got ready to show at the moment (pictures), are some blocks I've made for holding the temperature sensor hardware.  These will eventually get attached to the wall, or set on a table, etc wherever they're to be used.


First cut some blocks out, and drill some holes to put standoffs for mounting the Pi Zero's to





Then drill some holes on the edge for stand offs to mount the temperature/humidity sensor to.  This may change in the future though.




Then apply some finish (Shellac)



Let dry



And then assemble the temperature sensor.  



The plan then is to use adhesive backed Velcro with one piece on the wall and one on the block to just stick it to the wall.  The parts are the USB OTG adapter with WiFi adapter held on by elastic, the Pi Zero screwed to stand offs, and the Temp/Humidity sensor on standoffs on the other side.

The thing that may change, is I might add an aluminum flat bar to put the sensor on to get it further away from the wood.  I think the wood is absorbing some of the heat from the WiFi and the Pi, and interfering slightly with the temperature readings. First thing I'm going to try, though, is a little aluminum foil tape on the edge of the block, to see if I can get rid of some of the radiant heat that way.  We'll see.


That's all I've got for now, so I'll be messing around with the sensor isolation to try to get it more accurate.  I'd rather not adjust it mathematically in the code, as that would require a lot of experimenting to make sure I get the curve right...


I'll try to get some pictures of the touch screen hardware later, and then maybe some software screenshots of what I've written for it

Share this post

Link to post
Share on other sites

Neat idea. A friend had a house that water could run under the foundation, and there was a crack in the middle of the house that moisture would creep up. 

...Your hands appear to be aging faster than you are.

Share this post

Link to post
Share on other sites

Yeah, we haven't had any water issues specifically, but where stuff is put right against the wall (like the end of a shelf in the closet that I removed) mold eventually likes to grow.  Not fun... 

Share this post

Link to post
Share on other sites

So this is what the final version of the sensors look like.  I added an aluminum bar to hold the sensor, and the temperatures are now in line with other thermometers.  




So I made 5 more aluminum pieces, and painted them with "Aged Bronze" on top of "Light Gray" etching primer



I also painted the standoffs and screws for the aluminum bar and temperature/humidity sensor flat black 



I have a few more to finish sleeving, but these are the final sensors




Share this post

Link to post
Share on other sites

Alright alright, I'll get a little software update for what I wrote for it.  


This was all written using AngularJS and Bootstrap for the UI, and running on Node.js for the individual sensors, the server, and the station that has the touch screen.  I built everything except the charts and graphs.  Those use highcharts (a js library) that I just configured to suite my needs.  I also use socket.io to emit to the UI in the browser when an item is updated, so it will automatically refresh as new data is pushed in.


The whole structure is that each sensor has a server script that runs on startup and will just pull a reading from the sensors and then push the data (through REST POST call) to the server.  The server then does its thing (pushes that data to the log file, stores it in memory, updates the data) and then notifies the UI it needs to update.  


I've got 4 different interfaces for it at the moment.  3 to hit with a web browser and one that runs locally on a Pi3 with an LCD (don't have images of that just yet).  


Below is the full desktop interface.  It shows you numerical temperature and humidity values, when it was last updated, and gauges that correspond to the values displayed numerically above.  Below that is a graph that shows the 3-day historical temperatures and humidity levels.  I've got it set up to update about every minute or so.  



Next is the view that I called "Portal", which is the same as the desktop interface, except it hides the line graph.  That line graph takes a fair bit of CPU power when you have 5 of them on the page and they have a combined 21,600 data points... 



And if you think the line graphs for 3-day historical take a bit of CPU power... Clicking on the "View all logged data >" button on any of the sensor cards above will switch it to this view, which is a line graph that shows all of the logged values (as well as the current temp/humidity values, and last updated).  In this particular screenshot it's about 2.5 months of data.  On this line graph as well as the one on the desktop sensor cards you can also zoom in by highlighting it with the mouse.  This graph can take a LONG time to load, especially on tablets or heaven forbid a smart phone... Just for reference, below is showing 98,920 data points.  Which comes out to about an 8MB text log file lol



Last interface is "mobile", which gets rid of the gauges and line graph, and rearranges the cards to be smaller.  All of these views change as you resize the window, to keep things looking better.  For example, Mobile goes from 4 wide to 3 wide to 2 wide and eventually down to just 1 wide based on the screen width.  



I'll have to see if I can get a video of the the station once I get that put together again.  That's probably the part I'm most proud of.  It's animated and automatically cycles through the various sensor cards that it displays on the screen.  There are a few issues with it; mainly a common issue with using a rotated display with Raspbian apparently.  At least I haven't figured out a way to fix it yet, and I've tried a lot of things.  There is a screen tearing issue when anything is being animated or scrolled.

Anyway, that's it for now until I can get the station reassembled.  I also need to build a permanent case for all of that too... 


Share this post

Link to post
Share on other sites

haha @Cheapskate you'd have a very expensive heating bill up here then lol  We typically set the thermostat for 70 when we're home, 64 when we're not, and 68 at night during the winter.  I'd set it lower but my wife is not very keen on that idea... 

Share this post

Link to post
Share on other sites

Cheaps, you're not my supervisor!!!!!!!!!!

Very cool Chris!  Now all you need to do is implement this on a home mirror a la Visible Contrast and you'll be set!:) Many moons ago I did low-voltage wiring, and we did the Parade of Homes, where one builder had a dual-TV behind a mirror set up, a his side and a her side, so each could watch the news while getting ready.  Seems pretty archaic now, but hell, that was 2003 for ya.

I've merely booted up my Pi3 and configured basic settings.  It's all I've had time for since I got it this weekend.  I'll be learning more about Linux before I delve into making something with it, but I'm thinking a full-fledged home surveillance system.  Would probably consume as much/less wattage than any off-the shelf system and I won't have to pay for cloud services.  Intruder alerts sent straight to my phone!

I'm also thinking about moving over to Ubuntu Mate since it's not as limited as Raspberian.

Share this post

Link to post
Share on other sites

I hadn't planned on publishing the code, as I don't want to get into a situation where a bunch of people I don't know start asking for support on it lol I also need to circle back to this, as it's gone dormant since work started being a pain in the butt (lots of overtime).  I've got the software side of things done, and the sensors, but still need to make some sort of housing for the touch screen and Pi that runs it, etc.  

Share this post

Link to post
Share on other sites
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...