Using Arduino, Raspberry Pi and Android to monitor your home

Chris Brooker
July 4, 2013

Hey all,

Just thought I’d write an update to my post “Internet connected computer controlling a dumb fan. Inefficiencies of the modern gas forced-air furnace“. It’s been a while and I’ve been busy. In that post I made the comment “Ideally, there would be a wireless temp sensor in each room, and an independent, discrete, heat source in every room that could adjust to the constant needs of the household.”.

With that in mind I started down a long road of discovery, building and hacking that lead me to where we are now, this screen shot:


What you’re looking at is a shot of the home screen of my Android phone (Galaxy S4). I’d like to direct your attention to the small white text beside the weather widget. This is a little widget I wrote myself last night that displays the temperature from the 6 wireless temperature sensors I build and have around the house.

What I’ve built and put together is a network of internet connected wireless sensors. Let me go through each piece.

1) Wireless Sensor:

Here is what I’ve come up with so far for the final sensor.

_DSC0497 _DSC0499 _DSC0501

I owe pretty much everything to Nathan Chantrell who created what is called the TinyTX. An open source set of PCB diagrams, Arduino code and tons of know-how. You can find all the information about the TinyTX on his post here.

The sensor is pretty simple, it’s:

  • a custom PCB I had created in china (with the plans from Nathan Chantrell) (built by
  • an ATtiny84 MCU
  • the RFM12B wireless transceiver
  • the DS18B20 temperature sensor
  • a resistor and a battery pack

The best thing about this V3 board design is that it exposes all of the ATtiny84’s IO pins. In this configuration only 2 are being used but it makes it so easy to use the platform to attach pretty much any sensing probe. Temp, humidity, air quality, pretty much anything.

So far I’ve only seen people using this platform to send sensor data back to a base station. I’ve been doing some playing around and have found ways to also have this receive a signal. For instance you could have this setup to read and transmit the temp but also have it connected via the free pins to wirelessly turn on and off an exhaust fan or operate lights. You just need to build a switching circuit that’s triggered by 3.3v. I breadboarded a test of this and had a transistor switching a set of 12v PC fans.

The base code for the ATtiny84 can be found on github.


2) The Base Station (Receiving the sensor data)

_DSC0503 _DSC0507

The next piece in the puzzle is a way to receive the sensor data, as there is insufficient power and resources for each sensor to be connected to the internet directly.

The base station consists of:

The hardware is pretty straight forward. I ordered the RFM12Pi module as a kit and got it up and running pretty quickly. Installed Linux and the RFM12Pi modules.


3) The software

emoncmsMulti emoncmsFeed emoncmsDash

There is a fantastic open source project that built a system called emoncms. It’s an MVC patterned PHP, MySQL system to log and visualize all the data that comes in through the sensors. As it’s open source, it’s extremely hacker friendly with all its code and modules on Git. I have this running on the Raspberry Pi.

emoncms is extremely flexible and a great way to capture and log all sorts of sensor data. It shows you the raw inputs from the sensors that you then map to a Feed. Allowing you to do any adjustments to the raw data as needed before being logged. In the case of temperature, I’m sending the float temp data as Int through the wireless transceiver, I then multiply the input by 0.01 to arrive back a the original float then log it to a feed.

You can also build dashboard as I did with the screen shot above. It’s very flexible and has been working very well, I did however, start playing with using it to send data back to the sensors. Nothing final yet, but when I have it working I’ll post some code to a forked repo.


4) The Android Widget (pictured above)

The last piece of the puzzle is the quickly hacked together Android Widget I wrote so I could see the temps on my phone all the time. emoncms exposes each feed through a REST API, using that API the app queries for the last feed value and displays it in the widget.

The code is in this Git Repo. It’s very rough but as there are no Apps or widgets for emoncms I’ll probably be building it out a little more over the next little while.


There you have it a full end to end system for monitoring pretty much anything you want wirelessly. It’s awesome and amazing. If anyone has any questions or comments I’m happy to chat. My next steps from here are to expand upon the simple node to base data flow and make the sensors wireless nodes that control things through emoncms. Stay tuned.




The range is about 120 metres (~400 ft) line of sight. I’m running at 433Mhz which is nice and low and penetrates walls well. I have no signals problems anywhere in and around my house. 2 AA batteries will last upwards of 6 months (estimated) as none of my nodes have died yet. In the screen shot for emoncms there is a shot of the dashboard. Under each temp there is a dial is showing the millivolts left in each battery pack.

Internet connected computer controlling a dumb fan. Inefficiencies of the modern gas forced-air furnace

Chris Brooker
March 14, 2013

I recently moved into a new house. Yay! I know. We needed more space for our son to play and grow up. We found a place, signed the lease and 2 weeks ago moved in. This house however, is the first time that we’ve had to pay our own utilities. Electricity, Gas and Water. Now our consumption directly affects our wallets.



One of the first things I did when we moved in is replace the old, busted and (to me) much hated mercury switch thermostat. Heating and cooler costs typically account for 50% of your utility bills and using a programmable thermostat improves the efficiency greatly. I replaced it with something I’ve wanted for a while but had no use for, the Nest Learning thermostat. If you haven’t heard of it or seen it, it’s an internet connected thermostat that learns your behaviour and automatically adjusts the temperature based on your patterns instead of you having to program it. It also allows you to control it remotely on the web or from you iPhone, iPad, Android phone, etc. It’s amazing and awesome, but that’s not the point of this post. You can check it out here.

Now I basically have this internet connected (awesome), computer controlling my heating and cooling. It’s super smart and knows when I’m home and when I’m not but it’s attached to one of the simplest, dumbest pieces of hardware in the house the gas forced-air furnace. I’m not too sure how many of you know how the furnace works or how many of you have opened up the panels and tinkered inside so let me briefly explain it. I’m only talking about your typical residential Gas Forced-air furnace.

When the furnace is instructed to go on it goes through a 4 step cycle. 1) A small inducer motor spins up and makes sure there is negative pressure venting the combustion byproducts to the outside. 2) The gas is turned on and ignited, heating up the heat exchanger. 3) The main blower fan starts up and blows the hot air through the ducts. 4) The gas stops, the inducer motor stops, when the heat exchanger cools down, the blower stops. The repeats every time the thermostat requests heat. This is a little simplified as there are a number of safety checkes that get done. But essentially that’s it, a fan blows air through a hot box and then through some tubes and into your house.


The biggest inefficiency is with the furnace itself. I’m new to this home and more than likely have things arranged differently than the previous tenants  plus lots of work has been done and things have changed. Now the vents aren’t balanced, some rooms are hot, some are cold. The super smart thermostat only reads the temperature in 1 room, so that room is the right temp but all the others aren’t. I go down to the furnace room and manually adjust louvres on the vent trunks to adjust where the warm air goes, in hopes of balancing the heat a little. This is ludicrous! Most of the time 80% of the rooms are empty.

The problem is the blower speed is constant, on or off. If I adjust the louvres, that pressure doesn’t just go away, it get redirected somewhere else. If the room is empty, it doesn’t need to be heated to the same temp as rooms that people are in. A truly smart system would adjust everything, based on where people are, how many, etc automatically.

Ideally, there would be a wireless temp sensor in each room, and an independent, discrete, heat source in every room that could adjust to the constant needs of the household. Lower the temp in empty rooms and raise the temp in rooms with people. There are sort of system that exist like this today with zoned heating, but they’re mostly in commercial spaces or very large homes. I hope in the more energy efficient future, these types of super smart HVAC systems find their way into more residential home.

You could even just have more but smaller heat exchanges, 1 on each main vent trunk line and a blower for each. At least then you could have a little more control and use way less gas.

Closing vents and otherwise redirecting the air does not improve the efficiency of the system, it in fact makes it less efficient.

And don’t get me started on how gas meters get read and estimated, that’s a whole other rant.

HP TouchPad – In my hands!

Chris Brooker
July 7, 2011

A week or so ago I get an email asking if I want to come to an exclusive blogger event with not a lot of details, I checked my calendar and had nothing so I said sure. A few days after that I got an email that said it was for the the HP TouchPad and I got excited! I’ve been dying to play with a WebOS tablet for a long time. I was thinking kewl, I get to play with it, see how it feels, and see how WebOS behaves on a much larger screen.

The event was at the always wonderful Marben Restaurant on Wellington in Toronto. I got there and headed downstairs.


Get downstairs and am greeted by the lovely ladies from Hill and Knowlton; Courtney and Rachel. Get my name tag and chat for a bit (cuz they’re wonderful ladies), then head on in.


The food at Marben is just fantastic. These little burger quarters are so unbelievable that I had to ask about them, they’re braised beer ribs wrapped in ground beef. All the food was amazing but these really stood out.


After a grabbed a quick bite and a beer, I found someone showing off the TouchPad, as I really wanted to see it in action pulled him over and finally got some hands on time.


I had to end my demo short as the event was getting started and I needed to take my seat.

Then they dropped the bomb, everyone gets a TouchPad!!! I was seriously shocked and super excited.


I tweeted “#TouchpadTO pulls an Oprah, everyone gets a touchpad!” and my phone blew up with replies. This is a hot commodity in Toronto.


We unboxed them and started booting them up, we were told we needed them setup and activated for some of the events later in the evening. Here’s mine turning on.


Created a WebOS account and it’s setting itself up and rebooting. Time for a few more mini burgers and some beer.


Sorry about this photo Erin, I’ll just assume you were thinking about kissing the TouchPad.DSCN2101

After we all got the TouchPads unboxed setup and running they did a quick demo so we all had an idea on how to use it. Which is good cuz boy did we need it for the next part of the night.


Up came Marty and Kirk from Brass Facts who run a super kewl trivia night at Brass Facts at The Ossington. This was by far the best and most brilliant way to get people to engage with the new device of any event I’ve ever been to. Kirk and Marty had a series of very difficult trivia questions and we had to use the TouchPad to do research to come up with the answer. First prize was a $100 gift certificate to Marben Restaurant. This was so much fun and I used the TouchPad constantly during the entire contest.

One of the awesome things I discovered about the TouchPad during this quiz was it runs flash!! Yes, flash! The questions was “On the website for the company who’s slogan is ‘Impossible Is Nothing’ there is a pop star, name her husband”.

The company was Adidas and of their website is in flash. (So it doesn’t drive you crazy, it’s Katy Perry and the answer is Russell Brand, you’re welcome).


You can see the answer sheets on the table. I came in 3rd, argh so close.



I’d been pawing at it, it’s now all finger printy. You can see my quiz sheet open on the table.




Some rocking top Toronto people, Casie Stewart, Wes Bos (or WebOS 😉 ), Raymi the Minx, in the back OakleyInc. I also see a nice Louis bag.

Wow, what an incredible night. Thanks to everyone at HP, Hill and Knowlton and Brass Facts you guys really blew my socks off.

I used the TouchPad for most of the night when I got home and a bunch today. I’ll do another post about the device and my impressions a bit later when I really have it as part of my life. Looking forward to trying the WordPress App!

Toshiba Primer Party and YYZ Lifestyle Mag party

Chris Brooker
June 17, 2011

It seems every time I write a blog post I start it with “It’s been a long time”, well not this time or ever again. (Cuz I just won’t say it).

Last night I had the privilege of attending both the Toshiba Primer party and the YYZ Lifestyle Magazine party. Both were at the Ultra Supper Club on Queen W, one inside and one on the rooftop patio. Both were wonderful and I’m glad I had the opportunity to attend.

This post is going to be very light on pictures as I didn’t bring a good camera and I didn’t take a picture of myself, big fail. There were tons of photogs there BUT as usual, today those photos are nowhere to be found.

As an aside, I’m not a photographer, but wouldn’t it be in their best interests to get those photos posted somewhere online as quickly as possible? It is, but none do, often waiting a full week before publishing anything, at which point it’s totally out of everyone’s mind. Big business fail. There have been times when I’ve brought my point and shoot camera to events, taken a ton of pictures and posted them that night or the next morning. Those photos get hit hundreds of times and get reused in all sorts of blogs posts. So do yourself and business a favour and post the damn pics asap. People will remember you for it and invite you to more things. Timeliness is better then prettiness, people just want to see themselves.


The focus of Toshiba evening was to introduce us to their new glasses-less 3d laptop. It uses the camera on the laptop to track you face and adjust the 3d based on your head position. Playing with it quickly I found it to be fast and pretty impressive. By far the coolest thing is that 1 window can be in 3d and the others in regular 2d. You can see that in the image above, the ocean scene is in 3d and windows and everything else is in 2d. Personally I would never get a laptop with 3d or one that’s this big but the tech is impressive.





Toshiba was also showing off some new Android tablets. I didn’t get the exact specs but from what I hear they were nothing special, prices starting at $419 I wouldn’t expect premium materials or blazing speed. Wouldn’t give up my iPad 2 for it.


From there we left the dark inside and headed to the roof where YYZ LifeStyle was launching the second issue of the their new magazine. The party was great and there were tons of well dress ladies and gentleman.


I had a great time mingling and chatting with people until it started to get crazy busy and you couldn’t move. I grab a copy of the mag and took my leave. I haven’t had a chance yet to read it, but I most certainly will in the next few days.

FYI Ultra Supper Club was serving extremely good hors d’oeuvres at both events. Some of the best I’ve had.

The Hex colour clock

Chris Brooker
February 23, 2011

As  a guy that spend most of my time building web things. Hex code colours are an everyday thing. This amazing web app, that can also be the screen saver on OSX, converts the current time into Hex and display the background as the colour. Which is count through the hours!

I sewed! (Laptop Sleeve for an ultra-portable computer)

Chris Brooker
December 5, 2010

First I have to start by saying that I’m totally disapointed by all the different computer cases out there. I’ve had this problem for a while, but this is the first time I’m writting it down. I’ve typically had small computers, Ultra-portables they’re typically called. Small, light, which is exactly what I want. Something that  I can bring with me without a second thought and don’t need a bag with wheels on it to carry.

I also want to protect these expensive machines but the cases out there are HUGE! Even the ones made for 13″ laptops or for netbooks are just huge, with tons of extra fabric (or neoprene) hanging over the sizes of the computer. Not the tailored case an ultra-portable machine deserves.

Then there is how I’d like to use the case. I have a Ben Sherman vertical messenger bag, which isn’t a laptop bag (they’re also huge), so it has no padded pocket for a computer but it’s the perfect size for me and it perfectly fits a 13″ computer. With my old computer, I would just put it in the bag and after a while I noticed it got scratches from the day to day wear. It needs a case before going in the bag.

With the new MacBook Air I wanted to correct that problem. So I went looking for cases again. Nothing, huge, massive, ugly things. I did however find the perfect case but it was for an iPad and wouldn’t fit the MBA. It was like a big sock that you could slip the device in and it would protect it from minor abuse. That’s what I wanted! There is nothing like this for computers, at least not that I find in stores.

So I stopped at Fabricland and set out to make one!

I managed to find this amazing fabric. It was knit on one side (like a sock) but was soft and fleecy on the other. I picked up a meter (which is lots).

I also picked up a small and cheap little sewing machine. I don’t have one, but have used them before. I was hoping it would do the job.

I cut a piece of the fabric larger 20% larger than the computer.

You can see it’s nice and big.

Here’s the little sewing machine I picked up for $30 at Zellers. I had just tested a piece of the fabric to see how it would sew. Worked great.

I cut a second piece of fabric the same size as the first and folder one end over to make a seam, tacked with pins.

With the “pocket” inside out, I started sewing it up.

With one side sewed up, I put the computer in to set a line for where to sew the other side. I want this sleeve to be tailored. Drew the red line.

After sewing the second side and the bottom of the pocket, I cut away the excess fabric.

Flipped it right-side-out. Looking good.

The moment of the truth. Oh ya!

Snug and cozy! Perfect and on my first try. (Yes, I do know this is a super simple project for anyone who knows what they’re doing with fabric. I’m still proud of the results.)

Back! and thoughts about blogging workflow and technology

Chris Brooker
November 25, 2010

Hey all,

If anyone even reads this anymore ;). I’ll be posting again! I was having some major server problems after the move. The server was unresponsive, the site would barely load, the images wouldn’t come in, etc. It was a mess. After a long time of screwing the with the config the problem was all down to the shitty DSL modem/router Bell gave me when I sign up for Fibe 25 at my new place. I have since disabled everything on that POS and now do all my routing through a much better piece of kit and things finally seem to be running smoothly.

Photo to the left (Tip: Apparently this look……Is major cougar bait. No lie, ask @MichaelNus)

I also need to figure out a better workflow for blogging. Currently I’m all over the place. I have hundreds of images sitting on my camera, sitting on my phone, videos on my video camera, files on my work computer, files on my laptop, on my server, on my desktop, and on my cloud storage. Things are everywhere and the biggest problem I find is that the internet is too damn SLOW! I have an Amazon S3 account (Amazon Simple Storage Solution), think of it like DropBox but with no size restriction. This is where I keep everything import, documents, images, backups, everything. Which is great because no matter where I am, I can get access to all my important files. But there comes a point where uploading things there take FOREVER, especially when I come home from an event and have gigs of pictures. I can’t upload them. So they end up living on the camera or whichever computer I’m sitting at.

I need to figure out a workflow so things can more a little more quickly. I also find the WordPress image resizing ability to very limited and have to shrink all images before I post them, which eats up more time and then I have another set of the same images only smaller sitting on whichever PC I’m on.

I guess I just need to sit down and plan the whole process out. Does anyone who blogs regularly have a good workflow that works for them? I’d love to talk.

So keep and eye here every once and a while, I’ll actually be posting, cuz man, a lot has been going on.

The Sony Xeperia X10 Mini really is small

Chris Brooker
July 28, 2010

Last night I was super surprised to run in to this little guy; the Sony Xperia X10 Mini. It’s almost shockingly small compared to our usually cell phone fare like the iPhone and way smaller than all the new beasts coming out like the Dell Streak and Droid X.

Side by side with an iphone 3GS

Gladstone Hotel’s first tweetup – Tweetgasm v1.0

Chris Brooker
July 27, 2010

Last night was the Gladstone Hotel’s first tweet up and it was a really good one. I do have to give credit where credit is due and thank Jeremy at the Gladstone for hosting the event (@TweetgasmTO) and the awesome crew that put it together Casie Stewart (@cassiestewart), Michael Nus (@MichaelNus), Mark Pavlidis (@mhp), and Rannie Turingan (@photojunkie). Each and everyone of them are amazing and if you don’t already, you should get to know them.

Waiting for the Queen Street car to take us out West. Thinking about how long the damn street car is taking to come. Also, thinking about Ardene and how great I make it look by being in front of it.

The always great Casie Stewart and Loren (I think, msg me and I can fix it 🙂 )

@PhotoJunkie working on netbook that was streaming his live photos.

The beautiful Carly-Ann Fairlie and the equally lovely Sheldon Levine

Casie Stewart, Jeremy Vandermeij and Michael Nus

I’ll update the names of people in the other photos when I get a chance.

Thanks everyone for a great night with great (and beautiful) people.

Intelligent life is NOT artificial

Chris Brooker
April 30, 2010

I’ve been thinking a lot about Artificial Intelligence (AI) lately. Not really if it’s feasible (it soon will be) or how precisely it could be accomplished but more about the ethics involved. I feel very strongly that one day very soon a sentient being will be create and I fear our human nature will ultimately destroy it or force our own extinction.

Let me elaborate. First, the term Artificial Intelligent is very derogatory. Artificial, fake, imitation, counterfeit, not real, right off the bat it devalues the life of this new sentient being. AI describes a sentients created by man but the creator has little relevance to the life that has been created. Every woman has the ability to create life but these aren’t Artificial Intelligences. An ovum is fertilized in a petri dish then re implanted into a women to mature until birth. Is this life artificial? Are birthed lives more valuable because they are the “natural” way? Who are we to say life only has value if it was created in a particular way.

We keep talking about creating all sorts of rules that these beings will have to follow. Most famous the 3 laws of robotics offered by Isaac Asimov that state;

1) A robot may not injure a human being or, through inaction, allow a human being to come to harm.
2) A robot must obey any orders given to it by human beings, except where such orders would conflict with the First Law.
3) A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

Which he himself explored and concluded could not account for every possible situation. If a being disobeys these laws I presume the punishment would be death. However, now what we’re doing is creating an entire class system essentially for what is another race (I’m going to call this new race “Race 0”). Us humans also have rules, we call them laws. The laws allow us to have order and things generally work. However, we are allowed to make mistakes. Making a mistake does not sentence us to death. To err is human after all. In fact most or our laws are based on a person’s intent rather than an outcome. Humans are allowed to make mistakes but Race 0 is not? Possibly; To err is to be alive?

Let’s try this from another direction up until now we’ve been talking about Race 0 as if they are a computer program or robot that’s been created by man and proven to be sentient. What if the first Non-human intelligence is created though biological engineering? Someone in a lab is able to create a mass of neurons that come together and create an intelligent, sentient being. Would this change how you’d look at it? Now it’s not metal vs. meat. Now it’s another biological organism, would it be required to be created with rules from birth? Or like us would it be expected to learn our societal rules and values? Why would this be different than creating life in a computer? Life is life no matter what package it comes in.

If we keep our current attitude and opinions based on fear, can you not see how this can and will lead to oppression of another race? In fact human history is filled with just such events. If we teach this new intelligence all of our bad traits, hate, fear, indifference to life, it’s almost a certainty that it will, like us, rise up and become the oppressors, commit unthinkable acts of genocide and possibly lead to the extermination and extinction of the human race. Race 0 could be stronger, faster and more intelligent than us. We wouldn’t stand a chance. (ie. The Matrix, Battlestar Galactica, I, robot, etc.)

Already we are treating a possible new intelligence as if it has no rights. We need to change this view before Race 0 is created and we start down the wrong path again. Respect and trust go a lot further than oppression and imprisonment. Have we not learned anything?

Related Posts with Thumbnails