# My New Control System



## twofer (Oct 21, 2009)

Just wanted to show you guys the new control system that I finished up over last weekend. She's a bit rough around the edges but fully functional. My apologies in advance for the lack of pictures as all I have right now is the one below.







The system is driven by an Arduino USB board. The LCD you see displaying the temperature readings is one of SparkFun's serial enabled LCD's (very easy to hook up and use). The temperature sensors the board gets its readings from are the Dallas 1-Wire devices. Right now I have nine temperature sensors that the Arduino gets its readings from. Eight of the temperature sensors are located on the storage tank with three of them being on top, two in the middle, and three on the bottom. The last temperature sensor is mounted on the supply line off the boiler. 

Right now the logic that the board uses is pretty simple and rudimentary.  When the board senses that the temperature at the top of the storage tank is above the usable water temperature  it will activate a solid state relay for the load circulator. If the water temperature is below the usable temperature it will activate a solid state relay for the propane furnace that I have for backup and open the circuit for the load circulator. This way the next time the house calls for heat it will use whichever system the board has decided is best, with the boiler system obviously being the priority. The board also controls the loading the storage tank based on the temperature sensor on the supply and the temperature sensors in the middle of the storage tank. If the temperature sensor on the supply is more than 5 degrees warmer than the middle of the storage tank or is above 175 degrees the board will activate the solid state relay for the boiler circulator. I'm still not sure if this is the best way to handle the differential loading of the storage tank but it is better than what I had, which was nothing, and I can always fine tune it in the future.


----------



## Medman (Oct 21, 2009)

Let me be the first to say DROOL...

Keep up the good work!


----------



## sgschwend (Oct 21, 2009)

Does that mean you assembled this controller with off the self parts?

The logic is software code?  Downloaded via USB?

Looks like fun


----------



## twofer (Oct 21, 2009)

sgschwend said:
			
		

> Does that mean you assembled this controller with off the self parts?
> 
> The logic is software code?  Downloaded via USB?
> 
> Looks like fun



Yep, it was assembled with all readily available off-the-internet parts.  

Here are links to the main components:

Arduino USB Board

Serial Enabled LCD

1-Wire Temperature Sensor

Solid State Relay Board (Thanks woodnotoil!)

I should have specified a little bit clearer but yes the "logic" is software code uploaded to the controller board. The programming of the board wasn't really all that hard as there is plenty of documentation on the Arduino Playground and the Arduino forums to help you out.


----------



## stee6043 (Oct 21, 2009)

I think I paid more for my (4) temp sensors than you did your whole assembly.  Very cool!


----------



## kabbott (Oct 21, 2009)

Very nice Job. Now comes the fun part, sorting out the logic. If you have not been to Nofossils forum you may want to 
check it out, I have a feeling I will be posting a few questions about the logic for charging storage there myself in a few days.
I am waiting on some relays now.

Have fun.

Kris


----------



## twitch (Oct 21, 2009)

twofer, I've built one pretty using pretty much the same components you have, including the SSR4 board.  I have it installed and some sensors connected, but the relay board is not being used to switch anything yet.  I want to monitor the temps and figure out limits for the relays.  I'm planning on using one relay for the pump (120V) and replacing 3 aquastats (24V) with the other three.  Do you have any 24V circuits going through the relay board?  In the documentation one place said any AC circuit up to 240V, and another said 50V to 240.  I haven't tried it yet, just thought I'd ask.  Once I have it all set up and running I'll set up a page with all the info, and yes, thanks to WoodNotOil and Phantom for the initial idea.

With so many people homebrewing controllers, maybe we should have a 'Control Geek' forum..lol


----------



## twofer (Oct 21, 2009)

twitch said:
			
		

> twofer, I've built one pretty using pretty much the same components you have, including the SSR4 board.  I have it installed and some sensors connected, but the relay board is not being used to switch anything yet.  I want to monitor the temps and figure out limits for the relays.  I'm planning on using one relay for the pump (120V) and replacing 3 aquastats (24V) with the other three.  Do you have any 24V circuits going through the relay board?  In the documentation one place said any AC circuit up to 240V, and another said 50V to 240.  I haven't tried it yet, just thought I'd ask.  Once I have it all set up and running I'll set up a page with all the info, and yes, thanks to WoodNotOil and Phantom for the initial idea.
> 
> With so many people homebrewing controllers, maybe we should have a 'Control Geek' forum..lol



Yeah, actually the circuit for the load circulator and the propane furnace are both 24vac. I was a bit worried about that too but it works with the 24v.

Control Geek forum eh? I like the sound of it.


----------



## rkusek (Oct 21, 2009)

Looks great twofer!
The Dallas 1 wire temp sensors seem like the way to go, all using the same wires.  I am hoping to build or buy  something linked to the internet (like NoFossil's) since my wife and I just got Blackberrys this summer and being able to check from my phone would be the ultimate!  Here are some links below to a guy who built his own version (like NoFossil) but it appears he is only monitoring not controlling.  He is also using the Dallas sensors.  The coolest thing I like is the SCADA type one shot displays that place all the temp readings, pump status, and other info on a neat diagram of your entire system.  He also monitors power consumption on the heat pump which would not be that important burning wood.  Mega Drool!

Ourcoolhouse.com
Sample CO
Sample MA
Sample IL
Sample CO
Sample TX


----------



## Gooserider (Oct 23, 2009)

huskers said:
			
		

> Looks great twofer!
> The Dallas 1 wire temp sensors seem like the way to go, all using the same wires.  I am hoping to build or buy  something linked to the internet (like NoFossil's) since my wife and I just got Blackberrys this summer and being able to check from my phone would be the ultimate!  Here are some links below to a guy who built his own version (like NoFossil) but it appears he is only monitoring not controlling.  He is also using the Dallas sensors.  The coolest thing I like is the SCADA type one shot displays that place all the temp readings, pump status, and other info on a neat diagram of your entire system.  He also monitors power consumption on the heat pump which would not be that important burning wood.  Mega Drool!
> 
> Ourcoolhouse.com
> ...



Interesting concept, and I agree that the DOW sensors look like a really nice way to go, but I would wish the unit went further - it seems like all he does is monitor things, but doesn't have any control capability like NoFo's unit does.  The other BIG problem that I saw with it, is that it seems like the product is very dependent on Microsoft products for setup and configuration - why would I want to install something that is defective by design?  (If the system offers support to non-MS systems he certainly doesn't mention it...

Gooserider


----------



## chuck172 (Dec 15, 2009)

I really hope I don't get interested in this!


----------



## twofer (Dec 15, 2009)

Awww come on, you know you want to.

Everybody is doing it.

People will like you more for it.

Just pouring on the peer pressure. 

On a serious note it is highly addicting. When I was building this controller I kept thinking that once I finished I would be done tinkering with the system. Then the thought of being able to log data entered my mind. Now I'm on to getting the system setup with network access and piping the data into a database. Not really sure where the end is for the tinkering but it is fun.


----------



## twitch (Dec 15, 2009)

twofer, keep us informed of how you are doing your networking / datalogging.  I found an SD card datalogger on SparkFun I was thinking of getting, but your plan sounds cool.


----------



## twofer (Dec 15, 2009)

I will definitely post my setup when I get it finished, hopefully next month. It's the least I can do for a forum that has given me so much information and help when I needed it.


----------



## ewdudley (Dec 15, 2009)

A nice addition to any 1-Wire monitoring setup is to tape a DS1820 to the discharge lines of your freezer and refrigerator compressors.  A simple area-under-the-curve or RMS calculation can help to reassure that they're operating normally.

--ewd


----------



## sorethumbs (Dec 15, 2009)

Wow,  very neat controller. The ability to eliminate aquastats alone is a great motivator to learn this type of system. One question though, what happens when a brief power outage occurs? Does the system/controlls automatically start working again or is there some manual resetting that needs to be done?


----------



## twofer (Dec 15, 2009)

The code itself is stored in non-volatile memory so if the power fails briefly, or even for an extended period of time, the system will resume running the code that it was running before.


----------



## twitch (Dec 15, 2009)

I have several parameters that are programmable using buttons on my display.  I have these parameters stored in the EEPROM of the Arduino so if the power goes out, I don't have to reprogram them.


----------



## sorethumbs (Dec 15, 2009)

Is it possible for someone who has ever written code before to take on a project like this? How difficult is it to learn the code?


----------



## twofer (Dec 15, 2009)

sorethumbs said:
			
		

> Is it possible for someone who has ever written code before to take on a project like this? How difficult is it to learn the code?



There's a bit of a learning curve to it and it is going to be a bit steeper for someone who hasn't programmed before but I wouldn't say it is out of reach. If you need help there are plenty of examples on the internet (including WoodNotOil's Google Page) and those of us here in the forum who have worked with the Arduino.


----------



## Medman (Oct 7, 2010)

Twofer, do you have a writeup of this system anywhere, and is it possible to find your code?  I have all the hardware now and want to data-log temps only, no control.  I was looking for code examples.


----------



## twofer (Oct 7, 2010)

I do not have a write up for it but I will be more than glad to share my code, as well as, how everything is wired up. 

Also, how are you planning to log data?


----------



## Medman (Oct 7, 2010)

Datalogging for the Arduino - I am looking at the SD card shields for the board, or running the PC to datalog.  I am interested in displaying the real-time status of the system as well as tracking the system performance over a burn cycle.

I have a PLC for control so I don't need the outputs, just a way to log the temps and adjust the system accordingly.


----------



## twofer (Oct 7, 2010)

If you end up going with a local PC I am also willing to share my amateur PHP scripts that will take data from the Arduino, dump it into a MySQL database, and allow you to view a graph of past performance. You can see it here: http://204.232.202.254/pastPerformanceOld.php

Please excuse the faulty flue temps as the decoupling capacitor for the ADC is toast.


----------



## Tarmsolo60 (Oct 7, 2010)

I'm very new to arduino, My sketch is all written thanks to a mechanical engineer friend, I need to take some time and assemble it all. My plan is to control all but the functions of the boiler with the arduino. No data logging at this point yet.


----------



## mwk1000 (Oct 7, 2010)

> I was looking for code examples.




I posted a complete working arduino sketch in a thread called data logger ( page 2 ). That should give you a good feel for what they look like. It reads 4 sensors and controls a pump relay, as well as logs the data to USB. 

https://www.hearth.com/econtent/index.php/forums/viewthread/48079/P15/

It is also included in a download file on the Hearthwiki I put some trending logic in it in preparation for a variable speed motor control. Trending hotter = increase speed by one, trending cooler decrease speed by one. Mostly tweaking the start/stop logic to get the most out of what I have.

Nice looking enclosure , this stuff is addicting.


----------



## Medman (Oct 8, 2010)

Thanks for all the info.  I am experimenting with the setup right now - having some trouble with the code.  I am using the DS18B20 variant, and the temps are coming in at -198. What?


----------



## Medman (Oct 8, 2010)

I am using code from the arduino wiki here and having problems with the DallasTemperature library when compiling.  Code is from mwk1000, listed in this thread:

https://www.hearth.com/econtent/index.php/forums/viewthread/48079/P15/

I think the DallasTemperature library I am using is not the same as yours - where can I find the right one?


----------



## mwk1000 (Oct 8, 2010)

I though I had it in the download. I checked and NO I did not. I'll have to go back check the version of the library when I get home.
http://milesburton.com/index.php?title=Dallas_Temperature_Control_Library#Code.2FLibrary

Will take you to the Library and possibly the older versions. I was working at 11/09-12/09 timeframe so use what was availible then if the current one does not work.

Run the sample from the library to ensure that you are functional before trying my sketch.

From the install guide:

Very little in the way of "installation" is required. [Unrar] the contents of the library to arduino-0017hardwarelibraries. If you already have "OneWire" library, only copy over the DallasTemperature folder to libraries. Make sure you delete any old versions before you continue (or if you're testing a PRE version, move it out of the libraries directory so it doesn't conflict). 

The IC itself has two modes, parasitism or powered mode. The latter can be found in the appropriate documentation. I commonly use the former as it reduces the number of wires I need to maintain. 

You may power the IC using a technique known as a "Pull-up". You will need a pull-up resistor of about 5 KOhm between the 1-Wire data line and your 5V power. If you are using the DS18B20, ground pins 1 and 3. The centre pin is the data line ('1-wire'). 

Try out the example when you've loaded up the Arduino IDE


----------



## Medman (Oct 8, 2010)

I have it working now.  I found the same pages linked from the arduino forums.  I just need to tweak the code a bit to get the display the way I want.

Am I right that the DS18B20's are polled from largest hex address to smallest?  This info will help when physically locating them, i think.  I will have to label them all with their individual hex addresses for now.


----------



## mwk1000 (Oct 8, 2010)

Ha, Good thought - I never paid attention. I put them on my breadboard and grabbed each one, when the temperature rose I wrote down the hex and labled it S1 .. S4. I made two more this morning ( I never connected pin 3, but I am not sure if I have the same version ).
Look at the log output on the wiki , I dump the startup to see if you are right. 

D12302009_T204208 Device Address: 28 54 D6 5E 2 0 0 AC
D12302009_T204208 Device Address: 28 7C 2 5F 2 0 0 75
D12302009_T204208 Device Address: 28 C9 D6 5E 2 0 0 57
D12302009_T204208 Device Address: 28 F9 CB 5E 2 0 0 2A

It looks like you might be on to it that is right from the logfile produced by the sketch ( Well smallest to largest anyway )


----------



## Medman (Oct 8, 2010)

No, they are not polled in order - not sure how they are polled.

I will have to label them as you have, but I will keep plugging along with them here.


----------

