So I have my goal, now the means to get there, the fun part.......
Since I am heating with wood, fuel isnt the problem. The Problem is control and storage. I have already done the calculations for the storage, so really the control is the final puzzle piece
As I discussed earlier, the arduino MCU (micro-control unit) is the primary building block here. As I started with versions 1 and 2, it became necessary to make communication the underlying priority, but first the nuts and bolts.....
The system is pretty basic when you look at it. We have a wood furnace, a biomass heat exchanger, pumps and valves and a storage tank. Water is pumped from the tank, through the heat exchanger and back to the tank. I decided to have everything based on the temperature of the exchanger. After all, if you pump water through a cold exchanger, then we will be taking heat out of the storage tank and heating up a cold exchanger.....not good.
The system is designed using two loops. The LOOPA is the primary and the LOOPB the backup, and the augmenter, more on that later. So Lets look at just the software to run just LOOPA for now.
Here is the entire sketch: Its for a Arduino UnoR3, running with an ethernet connection. There is some MQTT stuff, Ill point out and talk about later, right now we will look at what its basically doing:
#include <SPI.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <Ethernet.h>
#include <PubSubClient.h>
LiquidCrystal_I2C lcd(0x27, 20,4);
byte mac[] = { 0xDE, 0xAD, 0x01, 0xA1, 0xBE, 0xEF };
byte server[] = { 192, 168, 30, 9 };
byte ip[] = { 192, 168, 30, 20 };
byte subnet[] = {255, 255, 255, 0};
byte gateway[] = { 192, 168, 30, 1};
void callback(char* topic, byte* payload, unsigned int length) {
// handle message arrived
}
EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);
int EXCH = A0;
int DigiPinFLOA = 7; //pin that reads FlowSW LOOP A
int VALVE2 = 2;
int VALVE1 = 8;
int PUMPA = 9;
int keepalive = 4;
int DigiPinFLOAState = 0;
int keepaliveState = 0;
void setup()
{
Ethernet.begin(mac, ip, subnet, gateway);
if (client.connect("arduinoClientLA")) {
client.publish("/mainTopic/Announce/LOOPA","ONLINE"); }
pinMode(keepalive, OUTPUT);
pinMode(PUMPA, OUTPUT);
pinMode(VALVE1, OUTPUT);
pinMode(VALVE2, OUTPUT);
pinMode(DigiPinFLOA, INPUT);
lcd.backlight();
Serial.begin(9600); //start the serial connection
//Title on first line of LCD
lcd.backlight();
lcd.begin();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("** LOOP-A STATUS **");
digitalWrite(PUMPA,HIGH); //// On Boot up shut everything off....
digitalWrite(VALVE1, HIGH);
digitalWrite(VALVE2,HIGH);
}
void loop()
{
digitalWrite(keepalive, HIGH); // <--- keepalive Hardware signal to monitor)
int reading = analogRead(EXCH);
float voltage = reading * 5.0;
voltage /= 1024.0;
float temperatureC = (voltage - 0.5) * 100;
float EXCH = (temperatureC * 9.0 / 5.0) + 32.0;
char charMsgA[10];
memset(charMsgA,'\0',10);
dtostrf(EXCH, 4, 2, charMsgA);
client.publish("/ENGTemps/EXCH/EXCH",charMsgA); // <-update EXCH temp to broker
if (EXCH <150.00 ) {
digitalWrite(PUMPA, HIGH); //RelayBrd requires a HIGH for OFF
delay(2000); //shut pump off wait 2 secs
digitalWrite(VALVE1, HIGH);
digitalWrite(VALVE2, HIGH);
delay(1000);
lcd.setCursor(0,1);
lcd.print(" ** SHUTDOWN ** ");
lcd.setCursor(0,3);
lcd.print("EXCH: F");
lcd.setCursor(6,3);
lcd.print(EXCH);
delay(750);
client.publish("/ENG/Status/LOOPA","SHUTDOWN"); // <--- Webpage update
delay(1000);
client.publish("/LOOPA/Messages/","12"); // <-- Codes to Loop B
}//<<--- end <150 Loop
if (EXCH >150.00 && EXCH < 200) {
digitalWrite(VALVE1,LOW); //LOW for ON, Open Valves, start pump
digitalWrite(VALVE2, LOW);
delay(3000);
digitalWrite(PUMPA, LOW);
delay(3000);
int (DigiPinFLOAState) = digitalRead(DigiPinFLOA);
if (DigiPinFLOAState == 0)
{
lcd.setCursor(0,1);
lcd.print(" ++ FAILURE ++ ");
lcd.setCursor(0,3);
lcd.print("EXCH: F");
lcd.setCursor(6,3);
lcd.print(EXCH);
delay(750);
client.publish("/ENG/Status/LOOPA","FAILED"); // <--- Webpage update
delay(1000);
client.publish("/LOOPA/Messages/","10"); // <-- Codes to Loop B
}
else
{
lcd.setCursor(0,1);
lcd.print(" -- ONLINE -- ");
lcd.setCursor(0,3);
lcd.print("EXCH: F");
lcd.setCursor(6,3);
lcd.print(EXCH);
delay(750);
client.publish("/ENG/Status/LOOPA","ONLINE"); // <--- Webpage update
delay(1000);
client.publish("/LOOPA/Messages/","11"); // <-- Codes to Loop B
delay(1000);
}
} //<<-- 150 endunderlaying
if (EXCH > 200)
{
lcd.setCursor(0,1);
lcd.print(" -- ONLINE -- ");
lcd.setCursor(0,3);
lcd.print("EXCH: F");
lcd.setCursor(6,3);
lcd.print(EXCH);
client.publish("/ENG/Status/LOOPA","ONLINE");
delay(500);
client.publish("/LOOPA/Messages/" , "15");// <-- Codes to Loop B
delay(1500);
}
// client.loop(); // listen to subscriptions for important messages
} //<<-- void loop end
So lets look at the first part............
int EXCH = A0;
int DigiPinFLOA = 7; //pin that reads FlowSW LOOP A
int VALVE2 = 2;
int VALVE1 = 8;
int PUMPA = 9;
int keepalive = 4;
int DigiPinFLOAState = 0;
int keepaliveState = 0;
So the first part of the sketch is the meat of the sketch. For now Im gona ignore the MQTT stuff, but if you can read the sketch and understand it then youll see what Im doing.
This part sets up out pump for LOOPA, and the valves. Each Valve is on either side of the pump. If the pump fails, or the loop shutdown, the pump can be removed because the valves isolate the pump from the loop when shut.
DigiPinFLOA is the digital signal that is coming from the FLOW Switch. A Flow Switch is just after the isolation valve. When the valves are open and the pump running, the FLOW Switch will gives us a digital +5Vdc, or a HIGH signal indicating water is in fact flowing in the loop. The Loop also has its own Exchange temperature sensor, which is connected to Analog A0. This is a TMP-36 but you can subsitiute what you like, youll just have to change the way the sketch interprets the voltage or resistance its sending back. In the case of a Maxim DS18B20, or similar, youll have to read the bytes coming back and the unique id for the sensor. All can be done, I chose the TMP-36, its easy to use, inexpensive, and does the job. This sensor is located in the biomass exchanger, and Ill show more of that later.
The keepaliveState, is a hardware heartbeat between this MCU and the Monitor. The Monitor is another MCU thats watching the operation of the system, for now its just telling the Monitor, Im "ALIVE"
The next section sets up all the pins for the arduino:
void setup()
{
Ethernet.begin(mac, ip, subnet, gateway);
if (client.connect("arduinoClientLA")) {
client.publish("/mainTopic/Announce/LOOPA","ONLINE"); }
pinMode(keepalive, OUTPUT);
pinMode(PUMPA, OUTPUT);
pinMode(VALVE1, OUTPUT);
pinMode(VALVE2, OUTPUT);
pinMode(DigiPinFLOA, INPUT);
lcd.backlight();
Serial.begin(9600); //start the serial connection
//Title on first line of LCD
lcd.backlight();
lcd.begin();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("** LOOP-A STATUS **");
digitalWrite(PUMPA,HIGH); //// On Boot up shut everything off....
digitalWrite(VALVE1, HIGH);
digitalWrite(VALVE2,HIGH);
The first part of the SETUP we will address later, thats the network stuff and the MQTT login. The next part is the pinModes, these setup the pins on the arduino and tell it what signals to read or send out signals on. You can also see there is a LCD attached, this sets up the LCD screen so you can visually see what is going on. Finally before the sketch goes into operation, we send the pump and valves a HIGH signal. The relay board running the pumps and valves, require a HIGH to turn them off. On boot, I selected everything to be off, as a starting point.
In part 2 of this start up, Ill explain the operation of the LOOP......
Tuesday, December 31, 2013
Monday, December 30, 2013
Just buy a stupid wood stove.............
So you have a house.......just reach for the thermostat............
Most of us know that in the modern era, heating and cooling is a no brainer. You build a house, or buy one, and everything you need to control the climate in your house is there. If its cold, turn up the thermostat, if hot turn it down.
I was in the US Navy for 8 years and for part of that time I was in the nuclear field. I was actually qualified to run a nuclear reactor and did many times. The principle of generating heat are nothing new but I was always fascinated but thermodynamics and the study of heat transfer. Most think that heat is removed, put an ice cube in a cup of coffee and it cools off, so where did the heat go. The premise is heat is transferred between objects not cold. Sit on a cold floor, and when you get up that spot is warm, why?, Your body transferred heat to the floor.
Thermodynamics are everywhere, even in your home heating and cooling system. The ability to control the climate depends on how you transfer the heat, in the winter we ad heat, summer we remove heat. Thus ends my Thermodynamics lesson. If you want to control the climate in your home control the heat.
I wanted to heat my home with natural fuels, and not rely "totally" on the electric grid. My choice was wood. With the work involved I even used wood when I live in a conventional home, and a outdoor furnace. It simply cant be beat, if you dont mind the work. In todays world not every one can go harvest a couple of trees, get 4 chords of wood and be set for the winter, time is precious. If you have the time though, this works. However, you can apply the same principles to an oil furnace, boiler system or even electric. It comes down to the need to control, the basic platform of home automation.
In a nuclear system, fission supplies the heat, heat is transferred to water, water heats more water to steam, and steam does the work. My system is the same basic principle. A wood furnace, coupled with a biomass exchanger, will transfer heat to water. The water then will be the body, or vessel to store the heat until its needed, whether its used to heat air for climate control, or preheat DHW, its vital that the 1000s of kilocalories transferred in the exchanger, be stored....some place.
I have done the calculations, and for me, with the system Im designing, it will be feasible to have a holding tank of 500 gallons of water, thoroughly and completely insulated. With a steady or at least a minimal amount of additional heat inputted to offset any loss, its still feasible way to store the heat. Other systems are out there, some use tanks with water and rock to store the heat. I have seen systems where a succession of insulated barrels are used, again your ideas, your methods.
Now the method to control all of this.........that in the next blog
Most of us know that in the modern era, heating and cooling is a no brainer. You build a house, or buy one, and everything you need to control the climate in your house is there. If its cold, turn up the thermostat, if hot turn it down.
I was in the US Navy for 8 years and for part of that time I was in the nuclear field. I was actually qualified to run a nuclear reactor and did many times. The principle of generating heat are nothing new but I was always fascinated but thermodynamics and the study of heat transfer. Most think that heat is removed, put an ice cube in a cup of coffee and it cools off, so where did the heat go. The premise is heat is transferred between objects not cold. Sit on a cold floor, and when you get up that spot is warm, why?, Your body transferred heat to the floor.
Thermodynamics are everywhere, even in your home heating and cooling system. The ability to control the climate depends on how you transfer the heat, in the winter we ad heat, summer we remove heat. Thus ends my Thermodynamics lesson. If you want to control the climate in your home control the heat.
I wanted to heat my home with natural fuels, and not rely "totally" on the electric grid. My choice was wood. With the work involved I even used wood when I live in a conventional home, and a outdoor furnace. It simply cant be beat, if you dont mind the work. In todays world not every one can go harvest a couple of trees, get 4 chords of wood and be set for the winter, time is precious. If you have the time though, this works. However, you can apply the same principles to an oil furnace, boiler system or even electric. It comes down to the need to control, the basic platform of home automation.
In a nuclear system, fission supplies the heat, heat is transferred to water, water heats more water to steam, and steam does the work. My system is the same basic principle. A wood furnace, coupled with a biomass exchanger, will transfer heat to water. The water then will be the body, or vessel to store the heat until its needed, whether its used to heat air for climate control, or preheat DHW, its vital that the 1000s of kilocalories transferred in the exchanger, be stored....some place.
I have done the calculations, and for me, with the system Im designing, it will be feasible to have a holding tank of 500 gallons of water, thoroughly and completely insulated. With a steady or at least a minimal amount of additional heat inputted to offset any loss, its still feasible way to store the heat. Other systems are out there, some use tanks with water and rock to store the heat. I have seen systems where a succession of insulated barrels are used, again your ideas, your methods.
Now the method to control all of this.........that in the next blog
The Beginning...........
Why in the world.............You wanna automate...that?
So why reinvent the wheel........well in reality the wheel has been invented, and as far as I am concerned the improvements have been great...but when it comes to home automation, and programming, and electronics, though invented, there is a world yet to discover.
Im a huge fan of +Jonathan Oxer , the author of many great books, the first I read was Ubuntu Hacks. Several months ago I stumbled on his video series, Superhouse. Loved it! But as he stated in one of his popular "Walktime Blogs" there is no standardization for home automation, and he is right there is none. Oh sure there are software packages you can purchase, that operate lights and audio equipment, but I am a Open Source guy at heart, why buy when you can invent.........
Jonathan showed in his series for Superhouse, the basic principles he used to acquire the level of control that he has over nearly everything in his home. Got me to thinking......I have to tools, I can learn the code, there is no standard, really to follow, why not take on the challenge......if I succeed, great, if I fail I learned something....I fail often, but I take what I learned and turn that around....so why not.
Im approaching retirement in a few years. My goal is to have a hobby farm where I can grow my own food, enjoy the time building and working outside, but Im a tech guy at heart. It would be a lot of fun if I can take a low tech home, and bring it to the 21st century. I also thought that since I have the time, why not take the opportunity, now, while Im not doing anything building-wise, and spend the time and the research to write what I want, how I want, revising and upgrading as I wish.....I have a blank slate, why not try....

People call me nuts, I think its simplicity and practical. The cob home is not only ecologically sound, but fun to build. This is what I have decided to build. Materials are cheap, the labor rough and the rewards great. So I have the plans, and soon the land, but in the meantime I thought why not make this house, something more, hence my idea, born out of so many other ideas, all rolled up into one.
The Basic building block.......Meet the Arduino
Aww the arduino, the basic building block of everything fantastic, the brains to do what you want, the ability to do it, with the right code, that is. I purchased my first UnoR3 back in March of 2013, currently I have 8, several I built myself. I have added the MEGA and recently built one based on the 644 MCU, and plans to go full scale with a 1280 and a 1281MCU boards. I cant say enough that with the right libraries, these guys preform hands down, far better than anything I have used in the past, including the BASICStamp and PICs. I love these guys, and have yet to stumble across anything they cant be programmed to do. But can they run a house, I decided to find out.
The Direction:
As I mentioned before, Im a huge fan of Jonathan Oxer. I learned from his series what his direction was for automating his house. I decided that I would use his ideas, and tweak them for myself. After all the OPEN SOURCE community shares ideas just for that purpose,so I took notes.
Jonathan's working version used nodes around the house, and a central controlling point. You can watch his series on YOUTUBE, and if you are thinking about doing this I highly suggest you do so. He explains things in detail without over explaining them. His system was based on a webserver, and using HTML "POSTS" to send messages back to a central server to process. My problem with that, is while Im an engineer at heart, HTML and I dont get along real well, in fact I am doing well to cut and paste code, and then wade through the endless tags to figure out what someone is trying to do. If you watch his first video in the series, he mentions MQTT, a messaging protocol thats super light weight and really cool. While I knew absolutely NOTHING about MQTT, I figured I could try, after all HTML loomed on the horizon carrying a big stick, waiting to pounce on me.....I chose MQTT.
SO..........
Thats the basis of this blog. While I have worked now for 9 months, learning and studying the code and the techniques, If you want to follow, perhaps you have such a plan too, you will see where I went wrong, and how I corrected the mistakes, and trust me there were many mistakes. But I look at it as this.....if you dont find it fun ...why bother.....My goal is to walk up to my house, have it recognize Im here, unlock the door, announce my welcome, turn on the lights for me, and ask me if Id like to hear some music, and that just after a long day working outside......Sound kinda fun? It did to me....so off I go
Subscribe to:
Comments (Atom)
