Category Archives: Home automation

How to monitor broadband uptime

After moving to a house a few years back we ended up in a situation where ADSL was the only option (aside of mobile broadband, which is not really a realistic option if you plan to do a fair amount of computer work from home) available to us. However, the nearest phone station turned out to be close to 4 kilometers away, which according to the broadband provider is a lot, maybe even approaching the distance where ADSL is usable.

Except that they failed to mention this when we informed them about the move from hyper-connected downtown to the suburb we now live in…

After well over a year of poor broadband speeds I got them (the ISP in question is Glocalnet, subsidiary of Telenor, btw) to acknowledge the problem, and even give us a refund for the months we’ve been paying for a 24 Mbit service, even though actual speed never gets above 5 Mbit.

Fast forwarding a couple of years, we’ve been paying less per month than before, but the quality of the ADSL connection is still poor, with the connection yoyo-ing several times per day. A couple of weeks back I finally had it and told them to fix the problem or stop charging us for a service they can’t deliver. A few days later an SMS arrived stating “your technical problem has been resolved” .

So, to the point of this blog post. How can I monitor they have actually fixed the problem and now provide a stable broadband service to us?

I ended up using a two-tiered approach:

1. External monitoring service
Using a free, third party server monitoring service to ensure there is connectivity from Internet to my home network. As the broadband outages we had experienced were typically quite short (on the order of a few minutes each), I needed a service that would ping a suitable computer in my home network at frequent intervals. Turns out there are many good free monitoring services ( etc), but they all (?) offer 20 or 30 minutes as shortest ping interval.

I finally found Pingdom, which offer you a free account from which you can monitor ONE server, with a shortest ping interval of 1 minute. Perfect. Their web site is slick and no-nonsense, they even have a very efficient and easy-to-use iPhone app. Great.

Only caveat is that you need an always-on computer at home, in order for Pingdom to have something to check connectivity to. Assuming that’s in place, you get stats like the following:

2. Ping from internal network to Internet
In order to minimize the number of false positives I decided to also check connectivity from the home network to a suitable site on the Internet. Once again, this assumes there is an always-turned-on computer in your home network. I use a Linux virtual machine that is always running anyway, looking after various other stuff.

A small script pings once every minute and outputs the result into a text file. If Pingdom indicate a broadband connectivity outage, I can then go into the text file to verify that this was really the case (ruling out problems with Pingdom’s servers/service). The script looks like the following, paths might need some editing in other environments.

echo —————————– >> /home/goran/pinglog_google.txt
date >> /home/goran/pinglog_google.txt
ping -D -c 2 >> /home/goran/pinglog_google.txt

Add to this a crontab (run crontab -e) entry for running the above once every minute:

# ping Google once every minute to make sure broadband connection is up
*/1 * * * * /home/goran/

…and that’s about it. Keeping fingers crossed I won’t have to use this data against the ISP – nonetheless good to have it, just in case.

Wiring the house, part 3: Planning the 1-wire sensor network

When ordering the needed hardware new possibilities came to mind, as they so often do when you are browsing catalogs of companies selling cool gadgets…

The first version of the 1-wire network will look something like this, possibly with some of the sensors furthest away from the server installed at a later time. Some of these sensors are after all pretty expensive (just the humidity sensor, HIH-4000-001, got it from Digikey, that is attached to the DS2438 AD converter cost around €20). Getting the all the cables in place have also turned out to be a bit tricky, the tubing in the walls back in –65 just weren’t made with cat-6 networks, phone lines and 1-wire networks in mind…

SP53 1-wire network

The Linux server will run either temploggerd and owfs (if I can get it to work on the small Bubba Linux server that I am using, so far it compiles ok but doesn’t seem to respond properly to the sensors), or thermd.

I verified thermd runs (it does work as expected but it takes 15-20 seconds or so to update the graphs) on the Bubba server as long as you install the perl runtimes and quite a few Perl packages, but as owfs offers a better client-server approach it would be the preferred solution.

Wiring the house, part 2: Buying 1-wire sensors and accessories

So, having moved from a flat to a house a couple of months back it was time to do some actual work on a home monitoring system.

First task: to find a good source for the needed 1-wire sensors and other electronics and hardware.
Some digging around, comparing a lot of prices resulted in the matrix below.
I then ended up buying my 1-wire products and components from Homechip and Hobby-boards, with some additional components from Electrokit.

Please note that prices and other aspects of the stores are expected to change, the data below represent a snapshot as of August 2009. They should in any case provide some starting points for your own 1-wire online shopping adventures.

Vendor Country Comment
Homechip UK Good prices and fast, affordable delivery across Europe, they don’t have quite the selection of 1-wire products as for example Hobby-Boards or DigiKey (who are outstanding when it comes to components).
But with Homechip offering the core component I needed while also being European the first batch of 1-wire sensors were bought from them. Might try other providers later.A good thing about Homechip is that they carry the
T-sense (made by IButtonLink) at an affordable price. VERY convenient temperature sensor! Ok, a bit more expensive than buying the components, but oh so convenient..
Low shipping costs also to rest of Europe outside of UK.
Hobby-Boards US Nice store with some assembled and ready-to-go 1-wire sensor modules, such as the 8 channel relay board or the nice little DS2423-based dual counter(Note: Homechip carries a similar counter).A GREAT thing about Hobby-Boards is that they offer both schematics and PCB layout for free on their web! This gives some very good inspiration for those of us who like to build things from scratch but have spent the last fifteen years doing other things than designing electronic circuits.Reasonable prices but longer/more expensive shipping if you are in Europe. 
Embedded Data Systems US This company among other things makes the HA7Net, which is an Ethernet equipped 1-wire master controller with some real intelligence in it. It contains a web server, upgradable firmware, various tools for reading/writing/maintaining a 1-wire network. The HA7Net also has three 1-wire ports, making it dead simple to create a star-formed 1-wire network.The HA7Net acts as the 1-wire centre point in my network, it is then read by various other software on the internal TCP/IP network. Sweden contains both temperatures across Sweden updated by people’s personal computer connected weather stations, as well as an online shop and a good forum for Swedes interested in home and weather monitoring systems. Quite a few good 1-wire related threads in the forums.The store has a fair number of components as well as pre-assembled sensor modules. Prices are a bit high compared to for example Homechip but if you are in Sweden and need fast delivery it may be worth it.
The store also has various home automation products, such as radio controlled 220V switches.
IbuttonLink US Makers of some good 1-wire products, such as the LinkUSB 1-wire interface, which can be used instead of the standard DS9490R from Maxim. They also make the very convenient T-Sense temperature sensor, but as this is available from HomeChip at the same or even better price (given the current USD to EUR exchange rate), I’ve got my T-Sensors from Homechip.
1.wire shop Germany Expensive German online store
Fuchs Shop Germany Expensive German online store
SparkFun US GREAT company with a fantastic amount of cool gadgets and electronics kits in the store, usually with very affordable prices. If you like fiddling around with electronics and microcontrollers you’ll love SparkFun. SparkFun offer free schematics for many of their kits, they also have good tutorials and forums. Great site!
Digikey US
Giant retailer of electronics components. More than 1900 employees, more than 450.000 products in stock. If you need an electronics component, Digikey is likely to have it, and at a good price. Based in US means longer delivery and higher shipping costs though.
Edit: Turns out Digikey has a great international service as well! For their Swedish customers they even offer free shipping on orders of more than €65, which is pretty easy to reach when looking through their catalog…
Electrokit Sweden Probably Sweden’s best online store for electronics components and Arduino microcontrollers. Good prices, very affordable shipping costs.
Lawicel-shop Sweden Sells various embedded systems products, including Arduino boards. Seem to be more expensive than Electrokit.
Maplin UK Sells all sorts of electronics and components. Might be worth considering for UK people.
Energibutiken Sweden Online store with a small but fairly good selection of products relating to energy monitoring. They among other things have an interesting data logger for those who don’t want to be bothered by running a server for their 1-wire projects.

Wiring the house

Moving to a house from an apartment made me realize you have new things to consider.

– How much money is spent on heating?

– We have a 45-year old, huge waterboiler in the basement, how much does it cost to keep it running? Would we save money by replacing it with a modern one?

– It is said that return-on-investment on air-air heatpumps is quite short, around 18 months is often mentioned. But before installing such a pump to reduce the need for electrical heating it would be great to have a system in place measuring how much electricity is used for electrical heating before and after the pump is installed, and how much energy the pump itself uses.

– How do you measure the above, collect the data and present it in a good way?

– After installing radio controlled switches across the house, how do you control them in a good way? The included remote works ok, but a computer interface is really what is needed to create more advanced lightning setups.

In the coming posts I’ll sum up the experiences made in planning, building, configuring and running the above services. Having searched the net for information and experiences from others I have found some, but not a whole lot. Hopefully my findings will help others with similar plans and ideas.