Very Small Information Systems/SS2006/Group B SmrtHeat

From Wikiversity
Jump to navigation Jump to search

Group B - Intelligent Home Control: Activity-based Intelligent Heat Regulation

Members: Simon Andreassen, Thomas Lerche, Claus Egholm Nielsen and Morten Milbak.


Abstract: This project concerns the use of the JOP controller board in the effort of reducing the energy consumption used on heating in a regular residence. By means of a set of motion sensors, data is collected about activity in the residence. The intention is to predict periods during the day with inactivity in specific parts of the residence with the aim to reduce the power consumed within these periods. In order to accomplish this prediction, machine learning methods have been applied. To gain information of the activity level we have focused on the use of infrared motion sensors connected directly to the JOP controller board. Behavioral patterns are identified which is used to predict future events of activity. This prediction has enabled our system to successfully control the heating in a house without any manual user interaction.


Keywords: Intelligent home, motion sensors, heating control, machine learning, moving average, linear regression, context awareness, Java Optimized Processor


Project Article and Project Plan[edit | edit source]

Project Article (final: 2006.05.31)

Project Plan

Code for the projekt

Articles[edit | edit source]

A database of the articles we have read for research for the project. Database (Continuously updated)

Construction of relay unit[edit | edit source]

In case it could help other groups - here you can read how you can get the JOP to control high amp devices.

If you want the JOP-board to switch some high amp devices on and off, you need to connect them to a relay. A relay is what you can call an electric on/off switch. When you give it power it will make contact between to mechanic pads wich can led high amp power. A relay only needs low power (8-12 volt and very low amp) so the JOP can be the on/off switch of the relay power and in this way control high power devices. If you are able to find relays that operate as low as 5 volt you can even use the power from the JOP and in this way save a power supply. In this example we have to use a separate power supply for the relay power.

In this example we make a unit with three relays that is able to control three 8 amp devices. It is important to clarify, that soldering and connecting high amp devices has to be done with caution and you have to be aware, that this example is not safety approved in any way and the construction is at your own risk.

Despite to the security issue a relay unit is not hard to make – all you need is some soldering skills and some basic components:

- 1 soldering board (Individual soilingpads on either one or both sides. 
  (RS-components no. 206-5548) 
- 3 relays (RS-components no. 351-572) 
- 220v cord connectors (1 male and 3 female) 
- Print mounting connectors (RS-components no. 193-0592 pairs of tree) 
- Some meters of 220v cord. 
- Some meters of solid mounting cord. (RS-components no. 148-7054  100meters) 
- A mounting case. 
- One power supply for the relay power (8-12 volt and amp is not an issue) 

The relay unit is separated in two parts – one low power section and one high power section. The low power section is controlled by the JOP and is done by letting the plus of the power supply run through the JOP output-ports and back to the relays. The ground of the power supply you can connect directly to the relays. In this way the plus is only getting through the JOP when the particular output port is switch on.

The high power section is controlled by the relays. In same way of the low power section you connect one of the high power supplies to the relays and the other directly to the output ports on the relay unit. In this way the output devices only have power when the relay is switch on.

In order to make the right connections of low and high power to the relay we refer to the two enclosed pictures.

Calculating celcius from amp[edit | edit source]

There has been some problems calculating the correct degrees in Celsius from the data supplied by the JOP on the thermometer component available in the DIT lab (RS components 191-2235).

So to save the other groups the time we have spent on this endeavor – the below is an explanation and guide on how to have the component feed you with Celsius instead of just mili ampere and how to calculate from celcius back to mili ampere.


In the specs for the component (see below) there is no apparent guide to decipher the data listed – only three rows of numbers where one is clearly the degrees in Celsius but the other two are unclear what they represent. Since RS Component weren’t able to guide us in the right direction we had to use our heads and figure it out by ourselves ;)


This is the specs on the component as printed in the product guide:

As mentioned above there is neither an explanation on the numbers in the product guide nor given a way to calculate any of them. So we had to find the connection ourselves - since we figured that there had to be a connection… ;)

After doing some trial and error, we now know that row two is ohm. This gives us the possibility to calculate from amp to celcius with a little help from two friends called Georg Simon Ohm and his “Ohm’s law” and Bill Gates with his Excel. ;)

We have found three different ways to do the conversion: Singular linear regression, multiple linear regression and logarithmic conversion. The first is by far the fastest to implement (both code wise and execution wise). The later takes both more time to code and to execute - but in return you gain allot more accuracy. Below is a guide on how to implement the logarithmic conversion (in the buttom of this guide, there is a link to the java implementation of the single linear conversion).

What we did was to plot all the numbers into a spread sheet (in this case Excel – here is our spread sheet (please note that there are two sheets, and that sheet two continues down the page). Mark the two first rows (celcius and Rt/r25) and draw a graph based on all these numbers (curve graph). Then add an exponetial trend line to the graph and select to show the formula and R2 value (right click on the graph - choose add trend line - choose exponetial). This gives you a graphical and mathematical representation of the numbers. Since the trend line does not follow the line drawn by the numbers it is clear that there is no précis mathematical formula for the specified numbers by just using a exponential trend line. Greater precicion is given if you choose to add a six step poly. trend line - but this results in a more complex formula. We continue with using the exponential trend line. The R2 value tells you how well the formula is explaining the connection between the two rows of data. As you can see on the graphs - they are a looooong way apart in the range from -55 to -25 celcius – which means that calculations based on the formula will result in quite imprecise conversions between the two rows when calculation on numbers from -55 to -25 degrees celcius. So in order to get the highest amount of precision you should think about the usage domain of your system – since you will get higher degree of precision if you narrow your range and base your trend line calculation on a smaller and more useful segment/range. In our project we are dealing with indoor temperatures so we have narrowed it to the range from 0 to 40 degrees celcius which gives us a R2 value on 0,9988 – meaning that the formula can explain the connection between the two rows with 99,88% precision! Moving out of this range doesn’t produce extreme miscalculations – for instance we are only off by 0.3 degrees when calculating on 90 degrees celcius. So you are not limiting the usage of the formula just narrowing it in on the main usage to give you more precision. You could choose to use all the numbers as the basis for the formula and have all calculations be equally imprecise – it’s up to you.


So now we have a mathematical way to go from one row to another: Namely the formula for the trend line:

In our case from 0 to 40 degrees:


Above is from x to y. The reverse formula for y to x is:

Again in our case from 0 to 40 degrees:


If you are unfamiliar with the term e – then google it. But in short it is a "magical" number like Pi and Phi. It can be represented numerically as 2.7182818284590452353603... instead of a function (which is better for our usage on the JOP with limited resources).


To complete the process you need to convert the results to something useful on the JOP. Since we already know that the JOP can read the changes in amp flowing through the component, we should convert to or from that by means of Ohm’s law.

So, if you want to go from amp to celcius (if you want to print or store the degress in a way everyone can understand them) then you need convert the amp->ohm->celcius:


But if you want to go from celcius to amp (if you only want the JOP to act on the readings from the component there is no need to calculate from amp to celcius, just keep everything in amps) then you need to convert from celcius->ohm->amp:


That should be it…

As promised above - here is our second implementation with linear regression: TempConverter in java and Ohms law in java

Happy measuring…