1. Welcome Hearth.com Guests and Visitors - Please enjoy our forums!
    Hearth.com GOLD Sponsors who help bring the site content to you:
    Hearthstone Soapstone and Cast-Iron stoves( Wood, Gas or Pellet Stoves and Inserts)
    Caluwe - Passion for Fire and Water ( Pellet and Wood Hydronic and Space Heating)

TankControl Information- Arduino

Apr 22, 2013
TankControl Information- Arduino
  • The purpose was to create a control program for the water storage tank to start and stop the circulator pump based on the temperatures of the heat exchanger. The secondary goal is to log and insert into a database the temperature readings.
    Updated version in use on Ubuntu 9.10 with updated Sketch "TankControl_v5p"

    Updated to include MYSQL database loading and nice charted web pages. Give the JQuery and OpenflashChart developers some credit the work is all theirs !

    http://hearth.com/images/uploads/arduino_to_web.tgz

    Just the sketch
    http://hearth.com/images/uploads/TankControl_v5p.txt

    The pieces:
    A 1500 Gallon DIY Non-Pressurized tank , a 5x12 70 plate heat exchanger with sensors mounted on each port, an Orlan EKO 60 boiler 75' away in an outside shop.

    The control piece:

    Hardware:
    1 Linux host using Ubuntu 9.10
    (with an updated kernel to fix the broken USBSERIAL kernel module:
    https://bugs.launchpad.net/ubuntu/ source/linux/ bug/460857 )
    1 Arduino board identical to the picture. 30$
    4 Dallas Semi one-wire sensors 20-30$
    1 powerswitchtail relay. 15$
    1 PC case switch set wires scavenged to attach to Arduino board. 5$
    1 USB cable 5$
    About 85$ without including the PC

    Software:
    Ubuntu 9.10 - (Free)
    Perl - (In Ubuntu ) (Free)
    Arduino IDE and required components ( Free )
    ttymon - perl script to read and save and timestamp the serial port data into log files. ( Free )
    TankControl - Arduino Sketch to control relay, read sensors and print the data to the USB/Serial port. ( Free )
    The Library:
    http://milesburton.com/index.php?title=Dallas_Temperature_Control_Library



    TankControl Log files:

    Startup - There is built in logic to prevent switching the relay more than once every 5 min , a 5 min timer is set every time the relay is changed ( as it is at startup). The sketch tracks the trend UP/DOWN of the boiler and tank temperatures to help make the right choice in starting or stopping and eliminate needless start/stops. 3 consecutive temperature increases/decreases will set the trend state.

    D12302009_T204203 Gassification Bioler Temperature IC Control Version 2.00
    D12302009_T204203 Locating devices...Found 4 devices.
    D12302009_T204208 Parasite power is: ON
    D12302009_T204208 Unable to find address for Device 4
    D12302009_T204208 Unable to find address for Device 5
    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
    D12302009_T204219 Device Resolution : 28 54 D6 5E 2 0 0 AC 9
    D12302009_T204219 Device Resolution : 28 7C 2 5F 2 0 0 75 9
    D12302009_T204219 Device Resolution : 28 C9 D6 5E 2 0 0 57 9
    D12302009_T204219 Device Resolution : 28 F9 CB 5E 2 0 0 2A 9
    D12302009_T204219 Requesting temperatures... DONE
    D12302009_T204219 Not setting relay - cycle interval not cleared: 0/300
    D12302009_T204219 log:SourceFeed:F:166.20
    D12302009_T204219 log:SourceReturn:F:156.30
    D12302009_T204219 log:LoadFeed:F:118.60
    D12302009_T204219 log:LoadReturn:F:145.60
    D12302009_T204319 Requesting temperatures... DONE
    D12302009_T204319 Not setting relay - cycle interval not cleared: 61/300
    D12302009_T204319 log:SourceFeed:F:166.20
    D12302009_T204319 log:SourceReturn:F:163.50
    D12302009_T204319 log:LoadFeed:F:118.60
    D12302009_T204319 log:LoadReturn:F:149.20
    D12302009_T204419 Requesting temperatures... DONE
    D12302009_T204419 Not setting relay - cycle interval not cleared: 121/300
    D12302009_T204419 log:SourceFeed:F:165.30
    D12302009_T204419 log:SourceReturn:F:164.40
    D12302009_T204419 log:LoadFeed:F:119.50
    D12302009_T204419 log:LoadReturn:F:150.10
    D12302009_T204519 Requesting temperatures... DONE
    D12302009_T204519 LoadFeed trending - set to HIGH
    D12302009_T204519 Not setting relay - cycle interval not cleared: 181/300
    D12302009_T204519 log:SourceFeed:F:167.10
    D12302009_T204519 log:SourceReturn:F:166.20
    D12302009_T204519 log:LoadFeed:F:120.40
    D12302009_T204519 log:LoadReturn:F:151.00
    D12302009_T204619 Requesting temperatures... DONE
    D12302009_T204619 Not setting relay - cycle interval not cleared: 241/300
    D12302009_T204619 log:SourceFeed:F:169.80
    D12302009_T204619 log:SourceReturn:F:168.90
    D12302009_T204619 log:LoadFeed:F:120.40
    D12302009_T204619 log:LoadReturn:F:152.80
    D12302009_T204719 Requesting temperatures... DONE
    D12302009_T204719 SourceFeed trending - set to HIGH
    D12302009_T204719 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 171/125
    D12302009_T204719 Setting Relay pin HIGH Run Sec: 301
    D12302009_T204719 log:SourceFeed:F:171.60
    D12302009_T204719 log:SourceReturn:F:170.70
    D12302009_T204719 log:LoadFeed:F:120.40
    D12302009_T204719 log:LoadReturn:F:155.50


    Charging Tank:

    D12302009_T234955 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 183/133
    D12302009_T234955 log:SourceFeed:F:183.30
    D12302009_T234955 log:SourceReturn:F:157.20
    D12302009_T234955 log:LoadFeed:F:128.50
    D12302009_T234955 log:LoadReturn:F:162.70
    D12302009_T235055 Requesting temperatures... DONE
    D12302009_T235055 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 184/133
    D12302009_T235055 log:SourceFeed:F:184.20
    D12302009_T235055 log:SourceReturn:F:157.20
    D12302009_T235055 log:LoadFeed:F:128.50
    D12302009_T235055 log:LoadReturn:F:162.70
    D12302009_T235155 Requesting temperatures... DONE
    D12302009_T235155 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 184/133
    D12302009_T235155 log:SourceFeed:F:184.20
    D12302009_T235155 log:SourceReturn:F:157.20
    D12302009_T235155 log:LoadFeed:F:128.50
    D12302009_T235155 log:LoadReturn:F:162.70


    Boiler wood supply gone and starting to cool off, critical time to stop the tank circulator
    and save the heat in storage. Still needs some tweaks but MUCH better than before.
    Note that you are always seeing the tank temperature at the bottom of the tank the coldest part.

    The peak of heating occurred at
    D12312009_T020420 Requesting temperatures... DONE
    D12312009_T020420 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 172/162
    D12312009_T020420 log:SourceFeed:F:172.50
    D12312009_T020420 log:SourceReturn:F:168.90
    D12312009_T020420 log:LoadFeed:F:157.30
    D12312009_T020420 log:LoadReturn:F:159.10
    D12312009_T020520 Requesting temperatures... DONE
    D12312009_T020520 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 172/162
    D12312009_T020520 log:SourceFeed:F:172.50
    D12312009_T020520 log:SourceReturn:F:168.90
    D12312009_T020520 log:LoadFeed:F:157.30
    D12312009_T020520 log:LoadReturn:F:159.10

    The controller still waited for another 1 hour and 45 min before stopping, only dropping by 2 degrees not bad, better than stopping at the peak since the house would drop the tank 6 degrees in that time frame. Note that the load return is showing COLDER than the feed.

    D12312009_T035040 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 165/160
    D12312009_T035040 log:SourceFeed:F:165.30
    D12312009_T035040 log:SourceReturn:F:164.40
    D12312009_T035040 log:LoadFeed:F:155.50
    D12312009_T035040 log:LoadReturn:F:152.80
    D12312009_T035140 Requesting temperatures... DONE
    D12312009_T035140 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 165/160
    D12312009_T035140 log:SourceFeed:F:165.30
    D12312009_T035140 log:SourceReturn:F:164.40
    D12312009_T035140 log:LoadFeed:F:155.50
    D12312009_T035140 log:LoadReturn:F:152.80
    D12312009_T035240 Requesting temperatures... DONE
    D12312009_T035240 LoadFeed trending - set to LOW
    D12312009_T035240 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 164/159
    D12312009_T035240 Load temp change lower than minimum - set relay flag to LOW/OFF -1/10
    D12312009_T035240 Setting Relay pin LOW Run Sec: 25521
    D12312009_T035240 log:SourceFeed:F:164.40
    D12312009_T035240 log:SourceReturn:F:164.40
    D12312009_T035240 log:LoadFeed:F:154.60
    D12312009_T035240 log:LoadReturn:F:152.80
    D12312009_T035340 Requesting temperatures... DONE
    D12312009_T035340 Not setting relay - cycle interval not cleared: 60/300
    D12312009_T035340 log:SourceFeed:F:164.40
    D12312009_T035340 log:SourceReturn:F:165.30
    D12312009_T035340 log:LoadFeed:F:154.60
    D12312009_T035340 log:LoadReturn:F:152.80
    D12312009_T035440 Requesting temperatures... DONE
    D12312009_T035440 Not setting relay - cycle interval not cleared: 120/300
    D12312009_T035440 log:SourceFeed:F:164.40
    D12312009_T035440 log:SourceReturn:F:165.30
    D12312009_T035440 log:LoadFeed:F:154.60
    D12312009_T035440 log:LoadReturn:F:152.80
    D12312009_T035540 Requesting temperatures... DONE
    D12312009_T035540 Not setting relay - cycle interval not cleared: 180/300
    D12312009_T035540 log:SourceFeed:F:164.40
    D12312009_T035540 log:SourceReturn:F:166.20
    D12312009_T035540 log:LoadFeed:F:152.80
    D12312009_T035540 log:LoadReturn:F:151.90
    D12312009_T035640 Requesting temperatures... DONE
    D12312009_T035640 Not setting relay - cycle interval not cleared: 240/300
    D12312009_T035640 log:SourceFeed:F:164.40
    D12312009_T035640 log:SourceReturn:F:166.20
    D12312009_T035640 log:LoadFeed:F:151.00
    D12312009_T035640 log:LoadReturn:F:150.10
    D12312009_T035740 Requesting temperatures... DONE
    D12312009_T035740 LoadFeed trending - set to LOW
    D12312009_T035740 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 164/154
    D12312009_T035740 Load temp change lower than minimum - set relay flag to LOW/OFF 0/10
    D12312009_T035740 log:SourceFeed:F:164.40
    D12312009_T035740 log:SourceReturn:F:166.20
    D12312009_T035740 log:LoadFeed:F:149.20
    D12312009_T035740 log:LoadReturn:F:150.10
    D12312009_T035840 Requesting temperatures... DONE
    D12312009_T035840 SourceFeed higher than LoadFeed - set relay flag to HIGH/ON 164/153
    D12312009_T035840 Load temp change lower than minimum - set relay flag to LOW/OFF 1/10
    D12312009_T035840 log:SourceFeed:F:164.40
    D12312009_T035840 log:SourceReturn:F:166.20
    D12312009_T035840 log:LoadFeed:F:148.30
    D12312009_T035840 log:LoadReturn:F:150.10;TankControl_Information