Home Automation
Passive Air Conditioning to reduce Energy Consumption
Jul 26th

photo credit: dynamosquito
Technology to heat or cool buildings naturally and without expending huge quantities of energy has existed for thousands of years. In Iran this ‘badgir’ has a natural cooling system made with mud bricks and Adobe. It uses the air circulation between two towers passing through a dome refreshed by the flow of water into an underground channel named Qanat.
By contrast, typical American home construction affords few opportunities to use nature to help heat or cool the spaces we live in. Homes here are built with thin walls making them poor insulators and although modern homes are well insulated with fiberglass insulation in the walls and roof spaces that is done primarily to keep the heat in; it provides little thermal inertia and has the unintended consequence of trapping heat in the house during summer months when there is plenty of sunlight streaming through large windows but no way out. Worse still, in modern construction, windows and doors are kept tightly closed and the building itself is built so tight that it needs a fan to bring in outside air regularly to improve the air quality in the building. That fan uses energy and runs on a dumb timer, sucking in potentially cold air in winter and hot air in the summer.
Having already reduced my total electricity consumption by over 40% and made inroads in how much gas we use for heating I’ve recently begun to look at how we can reduce the amount of cooling needed to keep our house comfortable in the summer.
In a location where there is a significant variation between daytime and night time temperatures there ought to be an opportunity to heat or cool a house naturally using free energy from the environment. Here near Seattle for several months each year we have just such an environment as you can see on the graph to the right (click to enlarge). The nighttime lows are currently below 70°F and the daytime highs are well above 70°F.
Since we already have a fan connected up that’s forcing external air into the house why not connect that fan to the home automation system and dispense with the dumb timer that was driving it. Now the house has control of that fan it can change the time of day when fresh air is brought into the house to use warmer air in winter (around 3PM) and cooler air in summer (around 3AM). It can also use this fan in conjunction with the air conditioning system. For example, it knows you are upstairs and that it’s too warm up there tonight, the air conditioning has been running but it’s now past midnight and although it’s still 72 inside it’s dropped below 70 outside. In this situation it can simply open the external damper, turn on the fan and turn off the air conditioning. Cool air flows in and the compressor is idle.
All this seems like a good theory but because I’ve only had it installed for a few days it’s too early to say how well it will work.
But what about houses with no circulation fan? Could we simply use doors and windows to improve comfort and reduce costs by telling the occupants when to open and close them? Today for example I was up early and it was cool outside so I opened up all the doors to the deck. The graph below shows what happened: a much bigger temperature drop than the day before even though it’s a much warmer day today overall. What I failed to do today, however, was to close them at the right time so the early gains in ‘coolness’ were soon offset by the rapidly rising outdoor temperature and before lunch it was already warmer inside than the day before. But what if the house calculated what to do and told you so that you could do an optimum adjustment to doors and windows to achieve free cooling?
My home automation system tracks the temperature in each zone in the house using an Aprilaire communicating thermostat with RS485. It can display graphs for any variable or collection of variables using the ASP.NET charting control. These graphs and experiments like the one this morning are helping me understand the dynamics of our house and figure out the best ways to achieve passive cooling (or heating).
Weather Forecasting for Home Automation
Jul 25th
In the USA we are lucky to have the NOAA and their excellent web service that can provide a detailed weather forecast for any location (specified by latitude and longitude). Using this service my home automation system maintains a detailed, regularly updated local weather forecast object which can be queried easily by any other object in the home.
On the weather page you can view all of the forecast information it collects. Of interest the graph in the lower right compares the forecast from NOAA with the actual recorded temperature. In this case you can see just how accurate the forecast has been for the last 24 hours. Normally it runs almost this close but with occasionally there is a significant discrepancy caused by the bizarre ‘convergence zone’ we live in where Pacific weather patterns split around the Olympic mountains and then recombine over Seattle in somewhat unpredictable ways.
Unlike most home automation systems that have fairly limited if-the-else or table-driven approaches to defining the home logic (often limited to only the current value of any variable), my system has control structures that include statistical functions over temporal data allowing analysis of past data (e.g. average temperature in the last day), or in the case of the weather forecast, future values, e.g. expected temperature one hour from now found using interpolation.
var oneHourForNow = DateTime.Now.AddHours(1);
double outsideForecastOneHourFromNow = weatherService.ApparentTemperatureHourly.ValueAtTimeWithLinearInterpolation(oneHourForNow);
This forward looking view at the weather allows for features like garden sprinklers that don’t turn on when it’s going to rain or HVAC that skips heating cycles when the forecast predicts warm weather later today.
In addition the house is able to issue a detailed local forecast over the speakers when it wakes you up in the morning. Somewhat uniquely the forecast it generates is a relative weather forecast comparing yesterday with today, or today with tomorrow. It might for example say “Today will be much warmer that yesterday” which is a whole lot less words than a normal weather forecast!
The house also has Natural Language Generation (NLG) features which are able to summarize a group of temporal series into distinct ranges allowing it for instance to highlight which the best times of the day are to be outside:-
Monday : excellent from dawn at 5:34 AM until 11:36 AM; hot from 11:36 AM to 2:00 PM; too hot from 2:00 PM to 7:00 PM; hot until sunset at 8:53 PM.
ASP.NET Charts
Incidentally, all of the graphs are rendered using the .NET Charting Control. The graph object is instantiated on the server, all the lines and axes are added to it, then it is serialized and sent over TCP to the web server using WCF. On the web server it is rendered as a PNG file using an Action method that takes size parameters allowing any size graph to be shown on any page. Here’s the MVC code that takes the stream from WCF, loads the Chart and then delivers it as a PNG.
Chart chart = new Chart();
chart.Serializer.Load(ms);
MemoryStream ms2 = new MemoryStream();
chart.SaveImage(ms2);
return File(ms2.GetBuffer(), @"image/png");
Sequential Logic Blocks – compared to the Reactive Framework
Jul 19th
One of the features of my home automation system is extensions to the C# language that make it easy to define complex logical and temporal behaviors. These behave somewhat like the new Reactive Extensions in .NET but with some key differences which I will explain below. I developed these extensions before Reactive Framework was released and have recently been looking at Rx to see if I could combine my ideas with Rx but because of the differences explained below I haven’t been able to do that.
But, before explaining why, let’s first look at an example:-
FirstFloor.Kitchen.GoesOff.Provided((dt) => Entrance.VisitorCountThisEvening.Count < 2).TurnOff(Aquarium.Light);
This means that if the kitchen goes not occupied (off) provided we have less than two visitors this evening, then turn off the aquarium lights.
Here’s a more complex example where we create an intermediate logic element called ‘activityInKitchen’ using the .Or method, and then based on that activity we decide whether to announce that the fish have not been fed. The decision uses a combination of pulse stretching, repeats (Every) and Then which fires only if a particular sequence is followed within a given time window. Finally it uses the Do method which fires off an Action.
SensorDevice activityInKitchen =
Kitchen.KitchenFloor.Or(Kitchen.MotionSensor, Kitchen.BackDoorToGarage, Kitchen.BreakfastBarFloor, Kitchen.Phone);
activityInKitchen
.ProvidedNot(Home.DinnerGuests)
.PulseStretch(16 * 60) // Make it continuous
.Every(60 * 60) // Once every 1 hour
.Then(activityInKitchen, 15*60)
.Do("Announce fish are hungry", (sender) =>
{
Kitchen.Aquarium.AnnounceFishHungry(Kitchen.MediaZone);
});
As you can see the use of a fluent syntax allows for a very natural, almost english-like definition of complex temporal expressions. But that’s not all it allows…
The sequential logic blocks created when you call one of the many methods like .Then, .Or, .Every, … are actual objects created within the hierarchical structure of the house and the objects used to represent it. This means that they take part (automatically) in all of the features provided by a base house object including logging, browsing, and most importantly persistence.
Because these sequential logic blocks are persistent you can have very long running events like .EveryDays(2) and even if the entire system is shut down and restarted it will come back in the correct state and all the necessary delays and timers will still be working.
Another key benefit of these sequential logic blocks compared to, say, the .NET Reactive Framwork is that they form a chain that can be traversed in either direction: forward as an event propagates through, or in reverse to determine why a particular action was taken. This means that my home automation system is able to explain why it turned the lights on or off. Currently all of these decisions are logged on the per-object logging system which means you can inspect any room, appliance, light, etc. and see everything that happened to it and the reasons why.
Hallway became occupied, caused by Motion sensor
Set brightness on Aisle lights in Kitchen to 20% because Leaving office late at night
Compare this to other home automation systems from major vendors. They contain fairly simple logic, often expressed in a tabular or grid format with limited if-the-else type logic and when something happens there is often no record as to what happened and, worse, there is absolutely no record as to why it happened.
Any sufficiently complex system will have unexpected behavior, the difference here is that when it does something odd I can easily look at the logging and see the explanation as to why it happened.
Home Automation Heating and Cooling (HVAC) Features
Jul 7th
Now that summer is finally upon us in this part of the world I thought I might make a list of the many ways in which my home automation system monitors and controls the heating and cooling systems (HVAC) in our house. It does this to reduce energy consumption and to provide a more comfortable environment for the occupants.
1. Reduced heating/cooling when the house isn’t occupied
The house automatically drops back to a lower (or higher in the case of the air-conditioning set-point) setting whenever a zone in the house is unoccupied for a set period.
2. Further reduction in heating/cooling when the house isn’t occupied in the case of a vacation
If the house is totally unoccupied for the majority of the day (i.e. excluding brief visits from cleaners and pet sitters) it will automatically flip into an even lower power consumption mode using less heating and no cooling at all.
3. Heat-point / cool-point variation by time of day (for each zone)
Instead of aiming for a single fixed temperature for a 24 hour period the house has target temperatures for different times of day – at night for example it lowers the heat-point substantially, during the evening it lowers it subtly in preparation for nighttime (except if we have visitors (which it knows)). On hot summer evenings it will cool the bedrooms in advance of bedtime (as shown in the graph here) but during the night it will allow the temperature to creep up slightly. Each zone has it’s own target temperatures curve because what’s right for the bedrooms isn’t right for the kitchen.
4. Optimum start in the morning
A traditional thermostat with a timer typically simply slams the thermostat up to 68F at, say, 5AM every morning to get the house to the right temperature by the time we wake up. My smart house instead follows an ‘optimum start’ routine whereby it gradually increases the set-point every five minutes along a predefined curve that matches the house’s thermal characteristics for heating (which varies according to the outside temperature). This means it heats the house for the absolute minimum duration necessary to arrive at the correct temperature by the desired time of day. A traditional thermostat by contrast may have been holding the house at 68 for an hour or more before it was really necessary.
5. No heating of cooling at all if the weather forecast says it’s not needed
If the house is going to get warm all on its own today because it’s forecast to be a hot sunny day then the house will automatically skip all heating in the morning even if it means the house will be a few degrees cooler than desired for an hour or so in the morning. When it’s sunny and the forecast is for a hot day there’s no point heating just to increase comfort for such a short period and besides when it’s sunny outside people don’t feel as cold anyway. This also means that the house will not need as much cooling later should it be a really hot day.
Another example of this can be seen in the graph above where the house decided to stop cooling the upper floor because the forecast indicated that it would soon be cool enough outside to not require any A/C and it would be cheaper and more effective to just suck in air from outside.
6. Manual override and the subtle shift back to computer control
There are unfortunately many people in the world who don’t understand thermostats let alone thermodynamics. For some there is a perception that the higher you set it, the faster it will get warm. Rather than try to reason with such people, or offend them with rude alerts or announcements over the speakers to explain how thermostats work, my home takes a more subtle approach: you can set the thermostat to whatever value you like but within an hour it will have taken back control and the set point will be back to where it should be.
7. Thermostats are part of the occupancy sensing network in the house
If you adjust a thermostat that counts as an occupancy trigger in the room in which the thermostat is located. In order to have the densest possible network of occupancy sensors any device that receives input is treated as an occupancy sensor, so thermostats, light switches, TV remotes all act as occupancy sensors just like the more traditional door sensors, motion sensors, floor sensors etc.
8. The house refuses to attempt to cool the entire world – Close the doors!
If the house is in cooling mode and external doors are left open it will wait for 5 minutes, then issue a verbal warning over the speakers, and then if the doors are still left open it will simply stop trying to cool that zone until the doors are closed.
9. The house logs what happened in each zone and can explain why it made changes
Any complex system will have unexpected behaviors, but unlike other home automation systems this one keeps a detailed individual log for each zone and in that log you can see what happened and equally importantly why it happened because the house leaves a trail including explanations as to what it was doing and why.
| yesterday at 12:00 AM | 14.04% on today |
| last Monday at 9:16 PM | Temperature 67°F [64°F < |65.3°F| < 68°F] |
| last Monday at 7:05 PM | Heatpoint changed to 55 because warm outside (Outside ave=57.2°F now=65.0°F |
| last Monday at 6:38 PM | Temperature 68°F [64°F < |65.0°F| < 68°F] |
| last Monday at 3:01 PM | Heatpoint changed at thermostat to 66°F |
| last Monday at 3:01 PM | Heating (Off) |

10. The house makes graphs for each zone
These graphs show how the temperature varied and what changes it was making to the set points during the course of the day
These cooling and heating features together with all of the other home automation features directed at energy saving mean that our total electricity consumption is down 40% from where it was five years ago and comfort has if anything improved along with convenience – it’s very rare now that we ever need to adjust a thermostat.
11. Future improvements
Although the house can tell if we are home or away, or if we have visitors for the evening or visitors stopping over all without being told, it still can’t figure out when we will get home. But that’s about to change, the house now knows where we are when we aren’t at home (more about that later) and it will soon be able to predict a return time. Armed with that I hope to improve it so it can have the house ready for our return after we’ve been away without having to explicitly tell it anything!
12. A more detailed example
Click the image on the right to enlarge it. You’ll see a detailed example of how the house manages the cool point to achieve optimum comfort with minimal energy consumption.
Is a 24hr energy consumption graph really useful?
May 28th
I’m somewhat surprised to see how much effort and excitement Google and Microsoft are putting into the ability to show graphs of home energy consumption minute-by-minute from a smart meter. I’ve had that ability in my house for several years now (not directly measured but a close enough proxy based on knowing which devices are currently on or off). My conclusion after staring at the graph on and off for several years now is that it’s really not that interesting!
Here’s one of my 24 hour graphs showing the peak, minimum and average electricity consumption in five minute intervals during the day. Fascinating huh? So what are you going to do with it?
The fact of the matter is that you still need to take a shower and the fridge still needs to stay cool – those peaks really aren’t interesting. If you do want to see how much energy any device is using you can get one of the many Wattage Monitoring Products. They can come in handy in deciding whether to replace your television with a modern LED TV but they probably aren’t going to change the way you behave.
It turns out that the real problem here is the base-load rather than the occasional short-lived peak. Some of that base load is unavoidable but one of the top controllable loads is lights that stay on for hours at a time, so, in your quest to reduce energy consumption, start with them. Replacing them with compact fluorescents or LED lights is an obvious step, but not without drawbacks (lack of dimming, harsher white light, flickering, …). A better solution is to have a smart home; one that can turn lights off when people aren’t in a room, or can lower the brightness according to the time of day. That’s what my home automation system does and it has produced some fairly dramatic energy savings as a result: over the past 5 years it now uses 40% less electricity than it used to! Unfortunately most home automation systems aren’t smart enough to do this – they will happily plunge you into darkness because you sat still for too long in one room. After years of refinement (both software and hardware) my own system can now accurately assess which rooms are occupied and very rarely does it make a mistake that results in darkness when there should be light. As I mentioned earlier it also prolongs bulb life by running them at less than 100% saving more energy and dramatically reducing how often you need to go up a ladder to change those high-up lights.
This then is really the graph you want to pay attention to and it’s something you can make yourself using the utility bills you get every month. I also think that the energy companies could do more to promote green-envy: simply show people how much less energy their neighbors are using! Shame them into action. Rank them … “you are #1 in your street for energy conservation”. I know some places have started to do something like this but it needs to be widespread.
Applying the Semantic Web to Home Automation
Apr 26th
Recently I’ve been considering how the Semantic Web will impact home automation.
Technologies like the Web Ontology Language (OWL) and RDF allow for the construction of complex ontologies that define what things are, and how they relate. Using these ontologies automated reasoning can be applied to generate new facts or to prove or disprove assertions.
This sounds like the ideal companion to the Natural Language Processing (NLP) Engine that I have already created for the my home automation system. With reasoning powers added to the natural language engine and the ability to augment the knowledge base by adding new assertions the whole system will be much more powerful. One day it might even be possible to create the entire home definition using a natural language text file and to query the system using rich natural language queries.
So, the first step is to find an existing ontology store and reasoning engine. A quick web search reveals that most are built in Java. There were a couple of links I came across later for .NET: http://razor.occams.info/code/semweb/ and http://www.intellidimension.com/products/semantics-server/. There’s also an interesting Q&A site at http://semanticoverflow.com which has lots of useful information on it.
But rather than starting with some existing library I really wanted to understand more deeply how an ontology store works and how a reasoning engine functions, so over the course of a couple of evenings I created my own. I now have a triple store and a simple reasoning engine. Here’s an actual conversation so you can see what it’s capable of so far and can perhaps get a glimpse at how powerful this concept could be:-
house is a class
contains is a property
contain is a property
contains is the same as contain
contain is the same as contains
contains is transitive
contain is transitive
first floor is a class
room is a class
kitchen is a room
first floor contains kitchen
house contains first floor
does house contain kitchenHouse: Yes, house contain kitchen because [house contains first floor] -> [first floor contains kitchen]
As you can see my semantic store can already represent classes, relationships between classes, new relationships (‘contains’), relationships between relationships (‘same as’). For such a small amount of code it’s quite surprising what this system can now handle in terms of knowledge representation and simple reasoning.
Next time I get some spare time I’ll hook it up to the actual home model so you can start to query that in much more powerful ways than before.
Stay tuned!
How to save energy through lighting control with home automation
Apr 9th
Over the years as I’ve advanced my home automation system I’ve gained a good picture as to how power is used within a home and number one on the list of energy hogs is home lighting. Maybe in a small house this would be different but in America houses tend to be large and they have lots of lights and those lights are left on for long periods of time.
In addition to replacing some light bulbs with compact fluorescents and some with LED lights (Cree LED’s only since I don’t like flickery-blue light) the house also strives to shut down the lights in any area of the home that’s not occupied. It aggressively shuts down lights in rooms that have had no motion in them for a while and if it detects someone leaving it looks for more opportunities to shut off lights sooner.
Another unexpected saving that you can make with home automation is to run your incandescent lights at less than 100% brightness. Since most home automation controlled light switches are dimmable it’s easy to set them to come on at 90% or less. Based on the time of day my house will use different lighting levels – just 20% if you head to the bathroom late at night, 60% early evening while there’s still natural light and 90% for ‘full-on’. Not only does this save energy but it prolongs the life of the light bulbs themselves dramatically. Couple with running at less than 100%, the soft-start that most smart light switches offer provides less thermal shock on the filament and it runs cooler. And since it takes energy to make light bulbs, and it’s tiresome to go around changing them all the time, this is one saving that pays multiple dividends.
Using Home Automation to Monitor Cable Modem
Apr 8th
Some time ago I was having an issue with my cable modem connection. The connection was intermittent at certain times of day but fine otherwise. Calling the cable company with an intermittent problem is pointless: you get the standard answer “But it’s working fine now”.
So, since I have the world’s smartest home automation system running in my closet it was trivial to add a quick HTML scraper to read the cable modem statistics every few minutes, persist them to storage and then add some graphs showing how they vary over time.
The .NET Chart Control is what I’m using now to render these charts. I’ve tried Google charts, Open Flash Charts and even my own pure-CSS chart generator. The .NET Chart control has the best options at the moment and it’s a plain JPG file so it will work on any browser.
After a few days I had a better picture as to how the signal strength and signal to noise ratio was varying over time and was quickly able to realize that it was in fact weather related. Waterproofing the cable connections cured the problem.
The NOAA feed is great for generating custom weather forecasts
Apr 7th
Although my home automation system is mostly an invisible assistant, carrying out its duties in unseen and silent fashion there is a web interface to it too and here’s one of the screens from that web interface. It shows the weather forecast for the area around my house. This information comes from a NOAA feed that is specific to the geographic location (lat/long) that you give it.
Uses for Weather Information by Home Automation
1. In the morning the house will announce the weather for the day. In addition to the usual ‘showers with a high of blah and a low of blah’ type of forecast you can get on any radio or TV station my home automation system gives you a comparative, e.g. ‘it will be much warmer today than yesterday’. Since you know exactly what the weather was like yesterday this simple summary is in many ways more useful than the full forecast and can be more concise.
2. The algorithm that runs the thermostats in the house performs an optimum start in the morning which means it continually calculates what temperature the house needs to be at on 5 minute intervals in order to achieve the target temperature at the target time of day – i.e. 69 degrees when you get up. But some mornings it will see that the weather forecast for the day is such that the heating would be on for a short period of time and after that the sun will provide all the heating you need. On such days it will skip heating the house completely and rely on the sun coming up and the fact that you won’t notice if it’s 67 degrees for an hour in the morning.









How can I tell if my house is smart?
May 27th
Posted by Ian in Commentary
No comments
So, you’ve been sold on the idea of a smart home and are looking at your options. There’s one that has gorgeous LCD keypads that you could put in every room for just a few hundred dollars a pop, and look! it says in the brochure that it’s “smart”. Well, guess, what, if that LCD keypad has options on it like “Home”, “Away”, or “Entertaining” you are about to purchase what I call a “dumb” or “stupid” home.
If you have to repeatedly tell your house to do an action that would be obvious to a human being then it’s not smart.
So how is a real smart home different from a dumb home?
Well for starters it has no flashy LCD keypads – they simply aren’t necessary – it figures out what to do and does it without being told. Lights come on ahead of you and go off behind you. When you have visitors if knows that and adjusts its behavior accordingly, keeping the house slightly warmer, leaving lights on in areas frequented by visitors, suppressing audible warnings it would normally give, …
Secondly, it has a much more dense sensor network than a dumb house. To reliably detect occupants and distinguish between homeowners, dinner guests, relatives stopping over, and a full-blown party it needs motion sensors in every room, contacts on every door, a sensor on the driveway to detect cars approaching, … and more. With this dense sensor network and algorithms that can track each sensor over long periods of time and perform statistical calculations your home can become a whole lot smarter.
Thirdly, it has a whole new programming paradigm. The traditional if-then-else or the even more lame table driven approach to home automation is not going to be sufficient to make your home smart. It needs a whole new language with the expressive power of what I call ‘sequential logic blocks’ that allow for events to be wired up easily using a fluent, almost natural language approach that hides the complex statistical and timing code that is required by the scenes to make your home smart.
Fourthly, it can remember what it did last night, and the night before than and the month before that and the same time last year! A smart house tracks all of these hundreds of sensors over long periods of time so it can detect trends and can determine what is normal and what is not normal.
Fifthly, it can explain why it did it! Any complex system is going to have unpredictable behavior, that’s almost guaranteed in a Goedel-esque kind of way. But when your smart home does something crazy it’s no good calling the author and saying ‘it went wrong last night, why?’ unless the author has what I have in my house which is a log of what happened and an explanation by the house as to why it happened. My house can, for example, explain that it turned the driveway lights off because it was 9PM and there were no visitors at the house and all of the people who lived there appear to be home.
So give your house the test, figure out how smart it is, and if it’s anywhere above “really dumb”, leave me a note in the comments below.