tiistai 19. helmikuuta 2013

DYI Arduino based temperature system

The problem:

The heating system of the house is based on water circulation, which is heated up by burning renewable materials, mainly wood. The system has a water reservoir approximately 2000 liters. The main adjustment of the temperature is made by manually adjusting the main shunt. The issue in here is that the temperature in reservoir varies a lot (+40C - +95C) causing the constant need to make adjustment for the shunt in order to keep stable temperature inside of the house. The variation in reservoir is caused by warming up the heater every now and then, depending of the outside temperature.

The ideal situation would be that the water temperature after the shunt would be stabilized around the 60 C. Higher temperatures would lose the part of the energy to the structures of the house and too low temperature  wouldn't keep the house temperature comfortable.

Simplified block-diagram of the house.


The Solution

Stabilasing the shunt's temperature would be the solution. This could be done by using few temperature sensors, some sort of servo for adjusting the shunt and something, which would glue these all components together and bring logic to the actions.

Yes of course there are several commercial solutions for this purposes and the prices ain't too bad either. For example Ouman's EH-800 would be quite perfect for the price of 500€. But that ain't the spirit. Real DYI-man will go to shop and make the perfect solution for any need.

So I decided the dig in to the problem and start browsing the internet. Quite hastily I found a perfect prototyping board, Arduino uno, from Robomaa.com. It's extremely user-friendly and easy to use-platform, made by Italians. Also all other gadgets could be found from Robomaa, so we're nearly ready to begin.

Shopping list:

Component
Price
Arduino Uno25.00€
Screw Shield For Arduino13.00€
128x64 Graphic LCD, ST792022.20€
3x Onewire DS18B20 Digital Temperature Sensors7.00€/each
Jump wires & Wiressome euros
Heat sinking tubes3.00€
1x button2.00€/each
1x 10Kohm PotentiometerI had one in my storage
Bread board8.00€
ResistorsI had some at my storage
Small screw drivers, soldering iron and thin tinI had some
Digital multimeter20.00€
Strong servo Power HD 1501MG20.00€


I recommend in buying Arduino starter kit for 100€, since it has a good variety of different electronic components.


What's Arduino?

Arduino is a programmable board with multiple digital and analog IOs. It's designed to be user friendly and can be reprogrammed by using C++ and USB-cord. It can be powered by using USB or by using power source.
Arduino Uno R3
It's a fancy platform allowing you to make robots, sensors, human interfaces, camera triggers, autonomic flying devices, stabilization systems, distance sensors, heat cameras, etc..





The Goal

Arduino tries to maintain shunt's temperature in given value by using the servo.
Initial UI-design

The work

At first I tried all separate units separately so that I understood how they should be assembled. The biggest issues I had with the driver of the LCD-screen, which is REALLY lousy. Gladly after the time I found amazing library called u8glib which allows me to make graphs and print text on screen with decent framerate. 

The biggest issues with other libraries were that they didn't support LCD's serial connection, since it doesn't require so many data-pins. Serial-mode requires only 3 data pins and it loses 1:100 in performance compared to parallel-mode.

Digital vs. Analogical temperature sensors.

Digital sensors are great! They're not so dependent of the length of the wire than the analogical sensors are. With a long wire and analogical temperature sensor you need to calibrate the temperature reading separately. Also you need one IO-pin for each temperature sensor. By using digital sensors you may attach many sensors on one wire in parasite mode.

Prototype with 2 temp sensors. It logs the outside temperature in to histogram. Assembled in  to ice-cream box.

Schematics

Problematic, how to keep temperature kept as close as possible wished value?

It took few iterations before I finally figured out a possible approach for this problem. Ideal approach would be that servo would adjust the shunt such a way that it would slowly approach the user defined value and would somehow keep the temperature as close as possible that desired value.

The best approach for servo's control seems to be rather simple and dynamic, without a huge and complicated functions. I'm simply checking the temperature in near history and projecting the time difference in to future.

For example:
Temperature difference = Current temperature - Temperature 5 minutes ago.

Thus,

Temperature after 5 minutes = Current temperature + Temperature difference