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:

Screenshot_2013-07-03-22-31-10

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 seeedstudio.com)
  • 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 OpenEnergyMonitor.org 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.

 

 

Update

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.

 

nest

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.

fig8

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.

Dinner last night – Slow Carb – 20lbs in 4 weeks?

Chris Brooker
November 24, 2009

Hey,

Recently, I’ve started on a slow-carb, high protein, fat reduction experiment. During the summer it seems that I managed to put on a few pounds. With the eating out, drinking often and generally not really taking care of myself like I have in the past.

I’ve decided to do a little experiment to see if I can more rapidly drop that bit of fluff to bring back a more defined physic.

This experiment is not for the faint of heart and definitely not for someone who cares how food tastes. In this experiment food is not really to be enjoyed, it’s just something you need to do.

If anyone is interested in the meals or the results (pending) let me know and I’ll post the meals I’ve been eating.

So far it’s been 1.5 weeks and I can tell you, lentils suck and beans grow on you.

Here’s last night’s dinner (at 10pm) to get the idea. This is probably the tastiest meal so far.

Baby Spinach, with Black beans, Pinto beans and a Round Eye Steak.
photo

I’m also taking 500gm of Niacin (the flushing is insane) and 200mcg of Chromium.

Let’s see how it goes.

Been a while, thoughts on life.

Chris Brooker
November 3, 2009

Cog in the machine

Hey All,

Yes, It’s been a long time since I’ve posted anything. It’s not because I’ve been sitting in the house and not doing anything. In fact, I’m busy most nights.

The truth is, I just didn’t feel like it.

I’ve been spending a lot of time thinking about what I want from life. What things I want to accomplish, what goals I want to complete. What adventures I want to have. Not an easy task.

Here are some things I started to help get my mind in a more receptive mode to hear itself.

– Stopped entirely reading the news. (I used to spend hours everyday reading hundreds of RSS feeds, which added no real value to my life.)(Also no Daily Show or the Colbert Report)

Stopped Blogging/Producing content with no vision. (Hence the lack of updates and videos)

Decided to sell my condo. (When I think about it, the place I’d like to most live right now (in this city) is right downtown. Will be moving as soon as my condo sells.)

Signed up for Aikido at the Japanese Canadian Culture Centre (JCCC) (Something I’ve always wanted to do.)

Stopped checking email (with the exception of checking work email at 11am and 4pm) Stopped receiving email on my phone entirely.)

Bought a notebook (paper) – If anyone knows me they know I rail against the use of paper. Getting back to basics has helped me focus. There are no unproductive distractions when it’s just you and paper.

– Try to only watch 1 hour of TV a day (my typical method of procrastination, with Hulu and a Media Centre PC there is never nothing to watch.)

– Everyday write down a list of Accomplishments and a List of Things to Accomplish the next day. (I do this for work too)

– Attend a Zen Buddhist Retreat (I’m not a religious person, but I feel it would be a great new experience to spent a few days in silence in a foreign environment, perhaps the change of perspective will be illuminating. If anything it will be a chance to try something new.)

That’s about it for now. Let me know what you do to keep life interesting and moving forward. Do you have a grand vision? Are you working towards it?

Blogging – Secrets to Success (Uncensored observations)

Chris Brooker
September 22, 2009

Blogging is all about posting something, anything everyday. Try to make it interesting every few days to keep people checking back.

1)  The best way to do this, IMO; is to be a young attractive girl who frequently posts images of themselves. Often innocent pictures of you from everyday, like you current outfit. But slip in a few of you at the beach or a few of you in your underwear. This will keep people checking just to see if there is a new hot photo. It also helps to have a twitter and Facebook account to promote your blog posts. But you can’t just promote your blog, you need to engage the community. That means telling everyone that you’re just lying around your place naked playing video games, people really like this.

When you’re not lying around naked it’s often fun to go out and party, drink too much and be promiscuous. Then you have more great content to write about on your blog. People love reading stories about drinking, partying and sex. I know I do.

To be honest, this is actually what I want to do. and perhaps I’ll start posting more pics of my work outfits and tales of my shenanigans.

If you do this everyday, I guarantee that you will attract a large audience which can feed your posts going forward, you will get invited to more parties, get free passes, free drinks and be recognized.

2) If you’re not an attractive girl or you’re a geeky guy the road is much steeper. You will need to write, everyday, compelling, interesting, educational, expert content. It will take a long time for people to find, digest and appreciate your blog. There will only be few fancy and fun images amongst pages of text. Unless you write about tech and post images of new products, but then only other geeks will care and you will have a lot of competition.

3) Or you can go the comedy route, post silly videos of yourself, find humorous things around your everyday live, post a photo and write a caption of a funny thing you saw at the grocery store. Post it to Facebook with a cliff-hanger title so people click on it just to see what it is. This can be successful (FailBlog.org, CollegeHumor.com).

Therefore, to be a successful blogger there are 3 routes, one easy and 2 hard. You can all see the route I’ve gone down (Videos, tech, lazy), this is the hard road. It’s my recommendation that you become an attractive women, cuz even online, life is easier. 😉

Towels are a laptop’s best friend? (HP TX1220US)

Chris Brooker
August 7, 2009

You might have heard last week that my laptop died :(. I would turn it on, the lights would light up, but then nothing, no beep, no POST screen, nothing. It would just hang like that forever.

It was a very sad time and I didn’t know what to do. I checked and the warranty had run out and the extended warranty on from my credit card had also run out. I was completely on my own.

I hit the forums to see if anyone had had similar problems. Turns out it’s quite a common problem, damn!, but it usually manifests sooner and would be covered by the warranty. The problem is related to the nVidia chipset getting micro fractures in the solder preventing it from making a solid contact with the motherboard. There is a recall on this particular problem on many, many HP laptops, but they won’t admit it for my model.

As I had nothing left to lose, I decided to try the forum suggested xBox360 Red Ring of Death towel trick. For the 360 the trick goes, take the 360 wrap it up in towel blocking all vents, turn it on, and let it bake. This overheating  causes the solder to slightly melt and reestablish the connections broken by the micro fractures.

IMG_0171-1

(In this photo I have the screen turned 90 degrees for better towel coverage [it’s a tablet])

I grabbed my laptop, removed the HD, DVD drive, etc anything that could be damaged by the heat. Wrapped it up completly in the 2 towels and turned it on. I let it sit there for about 6 hours. The towels had gotten very hot. As soon as the sun through the window touched the “package” the extra heat caused it to shutdown from over heating. I took it out and let it cool.

I came back later and with little expectations, I turned it on. At first it looked the same, then, all of a sudden it POST’d! I couldn’t believe it!

It’s now been a week since I did this trick and have used my laptop for at least 20 hours total for scretches as long as 6 hours, with no problems what-so-ever.

I’m so very happy to have my friend back!

UPDATE (Nov 24, 2009): This trick has now resurrected this laptop twice! It’s still working to this day.

Windows 7 Community Event

Looks like I had a productive long weekend editing video :)

A few weeks ago I receive an email from the lovely Chantelle at High Road Communications asking if I would be apart of a Windows 7 community dinner event. I was honoured to be invited and accepted.

I wasn’t really sure what to expect when I was invited but after I arrived, I was very surprised at what an amazing event the ladies at High Road Communications put together. Thanks Chantelle, Cortney and Isabella (sorry if I missed anyone).

As you can see in the video, I got there late. The event was schedules to start at 5pm but with traffic and having to drive from uptown, I didn’t actually get there until 5:35pm, so I missed most of the presentations. But I did get a chance to run around and talk to almost everyone, even if I didn’t film it.

If there is anyone I missed, or more information that I can use, please drop me a line.

Hope to see you all at the next one.

Here is the video;

Microsoft Canada
High Road Communications
Absolute Software
bumptop

Thanks!!

Researchers Expand Clinical Study of Neural Interface Brain Implant: Scientific American

braingate-neural-interface_1This is actually some exciting news!

The researchers over at Brown University has been given the go-ahead from the FDA to run a pilot clinical trail to expand it’s work on Neural Interfaces. In 2000, Brown University began a program named BrainGate which includes a baby aspirin–size brain sensor containing 100 electrodes, each thinner than a human hair, that connects to the surface of the motor cortex (the part of the brain that enables voluntary movement), registers electrical signals from nearby neurons, and transmits them through gold wires to a set of computers, processors and monitors. The purpose of this trial was give direct control from the brain to artificial limbs.

BrainGate2 hopes improve on the original BrainGate by tapping both motor cortex’s as appose to one in the previous study, and better understand brain signals and improve our methods to decode them.

Let me know when I can expand to mental resources through a direct connection to the internet. :)

Full Story via Scientific American
Plug and Play: Researchers Expand Clinical Study of Neural Interface Brain Implant: Scientific American.

Make Web Not War – Microsoft Conference

Today is Make Web Not War an event hosted by Microsoft Canada at the Ted Rogers School of Management. First, I must say this is a beautiful building. Large, clean, bright with big atriums and tables outside. School was never like this when I attended.

I did get here a little late but I did make it in time for David Crow’s keynote presentation. W00t!

As a side-note, I’ve never heard MS say “WordPress” so many times. Very kewl.

I shot a great deal of video so far and it will better tell the rest of the story. Once I have a chance to review and edit the footage. I’m just going to post images I have taken.

img_0085One of the atriums with tables and a Tim Horton’s Express. Microsoft provided coffee and breakfast, so I didn’t have to visit it. Win!

img_0077Breakfast: coffee black and a blueberry scone. Yum. That device is for real time voting. Kewl. We used it a bit, but we also just raised our hands. Twitter was also in full force.

img_0078David Crow just starting his keynote. Very kewl stadium class room. I’ve only seen these things on TV. So awesome. One problem is there were very few plugs. Laptop #Fail. Yes, that’s a Mac in the lower left-hand corner. This is Make Web Not War we’re all welcome. Macs, Linux, Windows all co-mingling. The blue mat is for a boxing throw down later in the day.

img_0076

img_0082Yes, this is a nice buidling. More to come!

Third Tuesday Toronto – How to create online videos that people want to watch

Chris Brooker
May 27, 2009

Yesterday was Third Tuesday Toronto or #TTT for anyone that was following it on twitter. I was excited about this one, as I have really been getting into creating video lately, I was not disappointed.

As online video consumption continues to grow at an astronomical rate, now is the time to learn how to produce high quality videos on the web. Whether you’re in the market to shoot a video for your small business or start up a video podcast, Amber MacArthur and her colleagues from MGI Media, Chris Dick, and Jeff MacArthur – will discuss how to monetize video, how to shoot/edit video, and how to create community around your videos online. With journalism experience in mainstream media with Citytv, CP24, and CBC, as producers of an award-winning video podcast, and as consultants with clients such as Tony Robbins, Rogers, and IDEE, Amber Mac, Chris Dick, and Jeff MacArthur will provide video strategies for success.

And as always, thanks for our sponsors, CNW Group and the Berkeley Heritage Event Venue. Their support allow us to keep Third Tuesday a free event for the community.

I got there at exactly 6pm which is kinda surprising as Toronto traffic is far from predictable especially when you’re trying to get somewhere at a certain time. I managed to score free parking on Power St., bonus! I walked over and entered the Berkeley Heritage Event Venue and wow, what a great classic building. Almost looked like an old church with the pews removed and no stained glass windows.

TTT - StageTTT - BarAs you can see, it was a full house. With a bar at the back serving cold drinks and excellent h’our dourves at the front.

It’s a shame that the RefreshEvents this month just happened to be at the same time. As I know a number of those people would have enjoyed attending this very educational event.

For all of those people who missed it. Here is the entire presentation in HD. Enjoy.
(As mentioned in the presentation yes, video is large, takes forever to edit, encode, and upload to the internet. That’s why this wasn’t up last night.)

It’s in 6 parts. YouTube and it’s 10min video limit for us non-pros.

Part 1 – Introduction

Part 2 – Amber talks about commandN

Part 3

Part 4

Part 5

Part 6

As the remaining parts come online at YouTube I will post them.

Excellent presentation Amber, Chris and Jeff! Thank You.

Related Posts with Thumbnails