Raspberry PI case, soldering irons and other such matters

Introduction

This post will be a round up of what has been happening on the intelligent heating project.

In my last post I detailed how we had encountered a problem printing an object on the MakerBot and how this had resulted in some slight damage to the build plate.

Thankfully the damage wasn’t critical. This week we were able to re-cover the build plate with the film (which is a real awkward task and takes a couple of attempts to get right) and start printing object again!

The picture below shows the MakerBot back in action:

MakerBot

MakerBot

Raspberry PI (RPI) case

Now that the printer is back in action I did some research online for Raspberry PI cases. The thingiverse website has a selection of RPI cases however I found one in particular that matched my requirements, as it came with a mounting bracket for screwing the case to the wall.

Since my RPI will be sitting inside a small closet where our electrical box is located, this seemed perfect.

You can see the case here:

http://www.thingiverse.com/thing:25363

I downloaded the STL files and then loaded them into ReplicatorG. First of all I built the Gcode for the base section of the case, and then exported to flash card format.

I now encountered a small problem, the case wasn’t visible on the flash card via the MakerBot menu. I’m not immediately sure what happened here, so I’ll be trying a fresh export on Monday and will try reloading it. Providing this works, then the first version of the case will be printed next week.

I’ll be photoing and uploading the results to the blog.

Soldering Iron

At the end of the month I plan on ordering some components for the Arduino from Adafruit, this will consist of a temperature sensor and a touch screen for the thermostat. I’ve not settled on which products I’m going with yet, but once this is decided I’ll be adding a post to the Thermostat thread details the specs and costs.

Of course in order to attach the components to the Arduino it helps to have a soldering iron. So today I picked one up from Home Depot. It cost around $15 and some extra electrical solder was around $9:

Soldering Iron

Soldering Iron

and

Solder

Solder

So I am now all set to start connecting up the components for my Arduino thermostat.

Raspberry PI and TV

In my earlier blog I had mentioned my plan to install HTSQL on the RPI. I have still not gotten around to doing this as a result of the equipment I am missing. I will need a cable to connect the video out up to a spare monitor  I have ready. My other option is of course to buy another monitor with a HDMI output on it. However I have had some problems with HDMI jack not working on the RPI so I will need to investigate this further.

Conclusion

So the above details where the project is currently at. Expect further updates over the week.

HTSQL – an HTTP based query language

An introduction to HTSQL

I’ll quickly give you an over-view of what HTSQL is, before I go into how I plan to use it for my thermostat/heating project.

HTSQL is a query language, developed by Clark Evans and Kirill Simonov of Prometheus Research, for relational databases that can be used over http. The language contains many of the features available in SQL but with the benefit that the user can plug queries directly into their browser, rather than having to embed code into server-side scripts, or connect to a database directly via a command line.

A variety of relational databases are supported by HTSQL including (but not limited to): MySQL, PostgreSQL, MsSQL and Oracle.

Once you have installed HTSQL you can point your instance at an existing database and begin to query the data contained within it. For example, if I wished to return a JSON object containing a list of temperatures from a temperature table, the query could look something like this:

http://myheatingserver:8080/temperature/:json

I could post the above URL into my web browser and it will query and return the data for me.  This of course opens up a lot of possibilities for a heating system dashboard, web-based monitoring and secure remote access of data.

There is a comprehensive list of examples of the HTSQL language here. The language is also complimented by a JavaScript based toolkit (HTRAF) that allows users to embed queries directly into widgets in their HTML page, and generate HTML elements dynamically.

Applications of HTSQL in my heating system

As I alluded to above, HTSQL provides some great opportunities for building dash boards and similar. I plan to use the technology in a number of ways, some of these are briefly outlined below:

1.) Install HTSQL on the Raspberry PI. Once installed on the RPI, I can point it at my local database server (more on this later). If I wish to switch the server out at any point in the future, I can update the settings on the RPI with little problem.

2.) Use my Arduino thermostats to post data to my DB server via HTSQL. The Arduino thermostats will be able to construct HTTP requests that will post temperature data to the RPI running the HTSQL instance. HTSQL will then take care of the rest.

3.) Modify heat setting in various rooms via the RPI. The algorithm that will guide changing the temperature in various rooms in my house will be located on the RPI. Via the HTSQL server it will be able to access past temperature history and use this for optimization.

4.) Build a dashboard to show temperature history and a host of other data. On a separate web-server I’ll be setting up (probably an Apache web-server on Ubuntu) I can build a graphical dashboard using HTRAF widgets to present the data I have collected in graphs, tables and other interesting HTML elements.

No-doubt other uses will arise as I start to build out my system and I’ll post these uses as I go. As I hope you can see from the above, the language provides some very interesting tools!

Conclusion

HTSQL provides a great method for interacting with and querying my heating system. My next step is going to be installing HTSQL on my RPI running Debian Squeeze. I’ll provide a guide to this as I go, as well as a guide to installing HTSQL on my MacBook for testing purposes.

Thermostats – Part 2 – Arduino setup

In my previous post I blogged how I had purchased an Arduino Uno, shown below, I’ll now give you a quick intro on the setup.

img_0216

First of all you will need a USB cable, this isn’t included with the Arduino Uno, unless you purchase a kit which includes the Uno and other components. The USB cable needs to be  a USB A-Male to a USB B-Male.  I’ve attached a screen shot of this below:

USB cable

USB cable

You can see the USB port (and power) on the Arduino below:

USB port

USB port

I plugged this in before downloading the development environment and it lit up straight away (the board runs on USB power, as well as a standard power cable which also isn’t included).

Arduino plugged in

Arduino plugged in

Next you will need to download the Arduino IDE (Integrated Development Environment). This can be found here. There is a version for Mac OS X, Windows, Linux and for those of you who wish to compile the IDE yourself, the source code.

Once you have followed the process to set up the Arduino IDE then you should be good to go. You can also find a quick guide to the IDE toolbar here.

I experimented with a few of the test applications that can be found in the IDE  to get the hang of things. A list of this examples can be found on the Arduino site here. Also the language reference guide can be found here. And yes the Arduino language even includes a goto statement which I am sure has caused no end of debates online!

So that’s it, an incredibly easy piece of hardware to get setup.

My next step is going to be exploring the Arduino programming language.

Thermostats – Part 1

Overview

Having decided to replace the existing thermostats with a set of home-brew ones that can communicate wirelessly, I now need to find out  which hardware is required and get a basic drawing together of how the components will interconnect.

I found the following two websites incredibly useful as they gave an overview of projects other bloggers had completed:

http://mcmicken.ca/tag/arduino-thermostat/

http://www.desert-home.com/p/super-thermostat.html

So it looks like the thermostat will contain the following basic hardware components:

  1.  Main board (micro-controller)
  2. Temperature sensor
  3. Wireless shield
  4. Power source
  5. LCD display
  6. Over-ride buttons
  7. Wall mount
  8. Casing

I am going to start with the micro-controller. This acts as the base where I can then start to work out which components will fit onto it easily and map out how they will interact.

Arduino – Microcontroller

The other day I received a $10 coupon for Radio Shack, so I stopped by and picked up a couple of Arduino boards there. Radio Shack is more expensive than ordering online, so in future I’ll be picking up components on the web.

The boards I picked up were the Arduino Uno:

Arduino Uno

Arduino Uno

and the Arduino Proto:

Arduino Proto

Arduino Proto

The Arduino Uno is an open-source micro-controller and part of the Arduino platform, an easy to programme open source hardware and software environment.

The Uno can have a number of sensors and other components hooked up to it, and then programmed using the Arduino programming language, which is based upon Wiring (an open-source programming framework)

This piece of hardware will act as a good micro-controller for the Thermostat. Newark Electronics (the folks from whom I ordered my Raspberry PI) are also selling the Uno for $25.50 a piece. This makes replacing the existing thermostats a fairly cheap process.

As you can see in the photos above, there is also the Proto. The Proto can be used for designing custom circuits. Having this will allow me to try out some custom circuit designs before I solder components to the Uno.

I’ll now need to hook up the Uno to my Mac and download the development environment so I can start playing around with it.

The book I purchased Programming your home, has some great starter projects that will give me some practice with the programming language and the development environment in general.

The next post will detail hooking up the Arduino and getting a hang of the interface and IDE.

MakerBot – 3D printer on the way

I’m very fortunate in that, the company I work for has a number of electronic enthusiasts, folks interested in 3D printers, and the plain adventurous. After several chats over coffee we came up with the idea of starting a 3D printing co-operative at our work place. The idea is each employee interested buys in, and with the funds we then purchase a 3D printer and material that the co-op members can use.

After doing some research we decided to go with the MakerBot Replicator™ and have it shipped built.  The Replicator™ is a 3D printer that allows you to print in two colors at once and clocks in at around $2000 with the dual extruder.

You can see a picture of it here from the MakerBot website:

 

Makerbot 3D printer

 

Around nine of us got together and raised the funds for the printer, and our company also chipped in extra $500 to help us out. They have also graciously lent us a room to set it up in so we have a place to use it.

There is around an 8 week lead time on delivery, so the printer should arrive around the same time as the Raspberry PI is delivered. With access to the MakerBot I’ll be able to print a case for the Raspberry PI as well as cases for the Arduino Thermostats.

One of my work colleagues is a dab hand at the 3D design on Blender, so we are going to have some training session for the co-op members which should be cool.

Once the printer arrives and I get the opportunity to design some cases on Blender, I’ll post the details on this blog – including links to the 3D OBJ files so those readers interested can re-use them for their own projects.

Programming Your Home – Mike Riley

Programming your home

I preordered “Programming Your Home” by Mike Riley and it just arrived. I’ll be posting a review of the book once I have the opportunity to read it.

The book has a selection of exercises and projects to introduce you to home automation, Arduino and related technologies.

You can check it out on Amazon here.

 

 

Welcome to Intelligent Heating – a journey through home-brew heating

Introduction

This blog will detail my journey through building an intelligent home heating system. Using free and open source software such as: FreeBSD, Python, PostgreSQL and HTSQL, open source hardware such as: Arduino and Raspberry Pi and  a host of other cool additions (including components printed on a MakerBot 3D printer) I am going to overhaul my heating system and blog the progress along the way.

Some background

We currently heat most of our house using a pellet stove. A pellet stove basically burns compressed wood or biomass pellets (in Italy sometimes olive pits) to create a source of heating for your home. A couple of tons of pellets will last us all winter and normally costs between $400 – $600 depending on type and supplier.

img_0202

In February 2012 our pellet stove stopped working. When we spotted a problem with it, we consulted the user manual, took the side off and cleaned the whole stove out including the fan, but this didn’t have any effect, so we called out the repair guy. Unfortunately it was going to take a couple of weeks until he could get to us so we had to fall back on the old baseboard heaters that came fitted when we bought the house.

Old base board heaters

Old base board heaters

Throughout the house we had the thermostats set on the baseboard heaters for around 60 degrees F which supplemented the heat from the pellet stove. After receiving our first winter electricity bill, we decided to cut down on the use of the heaters to keep costs low. However once the pellet stove broke we had little choice but to use the baseboard heaters to keep the house warm, and we soon found out this had costs us a small fortune.

These things are possibly one of the most inefficient means of heating a house. This we discovered after receiving a $600 electricity bill from the UI company for a single month… ouch.

For those of you not aware, Connecticut has some of the highest electricity rates in the country. The 2008 OLR report placed CT in the number 2 spot when it comes to electricity costs. Coupled with the tropical storm Irene last year and the freak October snow-storm CT residents were not only dealing with high kWh costs but also periods of blackouts running into the days due to the damage caused by falling trees.

The combined cost of electricity and lack of service at points led me to investigate, how could we power and monitor our heating systems at minimal cost whilst optimizing our electricity usage and room temperature?

I hope to answer the above questions with this blog, and if lucky be able to demonstrate a cheap and cool way of doing it.