Author Topic: Arduino based PWM diversion control system  (Read 9822 times)

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #105 on: February 25, 2017, 06:28:17 PM »
Hi Westbranch,

My heating system kicks in at 155F. It runs until the tank, sensed at the middle of the tank, gets to 150F and then shuts down. I have a mixer on the domestic hot water set for 118F and a mixer on the floor set for 90F. The HWT tank cycles between 155F and 150F if there is enough energy to get there and leaves me with a supply of hot water that should last me a few days if there is not enough sun make hot water. So the PV solar energy transfers through the tank, into the 60 tonnes of radiant floor.

Will
24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 1331
Re: Arduino based PWM diversion control system
« Reply #106 on: February 25, 2017, 07:12:47 PM »
How many gallons is your hot water tank -  or do you also have another hot water storage tank that you also heat ?

That is some great work you have done . I have just started playing around with my arduino's and will have a look at your code later to see if I can figure it out.

What type of sensor are you using for hot water temperature ?

Larry
system one
Classic 150 , 20 Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #107 on: February 25, 2017, 08:29:09 PM »
My HWT is 120 USgal. It is made of 316L stainless by a company called Advance MetalPres. http://metalpres.ca/ I went with this tank because of the high temperatures I want run it at. I also bought the Corro-Protec non-sacrificial anode for it. The tank has two heat exchangers in it. The floor goes through the upper one, cooling the tank when the heating system runs. The lower one I do not use but if I get old and do not want to do wood any more I could heat the tank with a propane condensing boiler or something. The entire house would run fully automatically then. Our goal is to reduce our carbon footprint as much as possible however. 120 gal of water at 150F will go a long way when it is  mixed down to 118F.

The sensor is a conventional 10K thermistor. They originally came from Heliodyne and then I got some from AltE before they got out of thermal. The tank has 3 thermo wells located near the bottom, the middle and near the top. The middle sensor location controls the system very well. I installed another sensor at the middle position. I just shoved it under the foam insulation which holds it closely to the tank. It works just as well as the thermo wells. I've been working on an Arduino data logger for the heating system but that is slow going.

Will
24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 1331
Re: Arduino based PWM diversion control system
« Reply #108 on: February 25, 2017, 09:38:00 PM »
Thanks for the info Will
I have been playing around with one wire DS18B20 temperature sensors. I guess one advantage to those is you can run a bunch of them on one line and since they have individual addresses you can assign them to whatever you want.

The other new device I have been playing around with is the ESP8266 - specifically the Wemos Mini variation board of it. They only cost $5 or less and have wifi built in . For experimenting now I have three one wire sensors and a DHT 11 temp / humidity sensor on it . The thing is so simple - you just hook up the sensors and then you can connect  up to its built in webpage and see the data. I am still learning on that but it has a lot of potential since it can do some controlling too.

Your have engineered a very well thought out home heating system at  your house. Nice to hear you are now reaping the rewards of all your hard work at learning how to code all that .

Larry WT9M
system one
Classic 150 , 20 Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #109 on: February 25, 2017, 10:12:49 PM »
Hi Larry,

I had no luck with the DS18B20 sensors. I liked the idea of them. I could get meaningful readings from them but once in a while they would suddenly read high and then go back to a correct reading. Weird. They would work at short distances but I need to go from the power room to the HWT which is about 25'.  I tried various wires and resistors and code. Finally I just moved on. I have do have a lovely collection of them which I look at sometimes.

Will
24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

mike90045

  • Hero Member
  • *****
  • Posts: 538
    • The Ranch (via facebook re-direct)
Re: Arduino based PWM diversion control system
« Reply #110 on: February 25, 2017, 10:45:46 PM »
What happens if you don't consume enough hot water and the tank tops out at boiling ?    Say if you are gone for a couple days ???
http://tinyurl.com/LMR-Solar

Classic 200| 2Kw PV, 160Voc | Grundfos 10 SO5-9 with 3 wire Franklin Electric motor (1/2hp 240V 1ph )| Listeroid 6/1, st5 gen head | XW6048 inverter/chgr | midnight ePanel & 4 SPDs | 48V, 800A NiFe battery bank | MS-TS-MPPT60 w/3Kw PV

dgd

  • Hero Member
  • *****
  • Posts: 1685
    • Lorylink
Re: Arduino based PWM diversion control system
« Reply #111 on: February 26, 2017, 03:10:01 AM »
Will,
Thanks for your updates on your water heating project. I enjoyed reading your posts, technical stuff, makes a change from the general newbie questions that have been the majority of forum postings the last few months.
Those one wire temperature sensors, I found a high running rubbish reporting rate if the cables from computer to sensor was more than a half metre or so. I had four of these on or about my tank and tempering valve so I installed a remote $3 arduino mini cpu that reads temp data (and flow meter data) and rs232 serial connected 12 metres to the main web server Due.
dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #112 on: February 26, 2017, 07:49:06 AM »
Hi Mike,

The second Arduino (Classic11) has a thermostat function coded into it. You can see the HWT temperature on the top line of the lower right LCD. The setpoint of the thermostat is 157F. So if the heating system is not running (summer) or something goes wrong at 157F the thermostat function activates. It sends a signal to to the Classic10 Arduino. The Classic 10 Arduino turns the PID off and stops diversion into the tank. The Classics then function as normal, controlling their output to the battery and system load. The thermostat turns diversion on again at 152F. If all goes wrong each element has a conventional thermostat, located at the tank, that will turn them off at 180F.

Will
24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #113 on: February 26, 2017, 08:03:48 AM »
Hi Dgd,

I have two Grundfos VFS flowmeters in my system. These measure temperature as well. One for the floor and one for the HWT. The goal is whole house energy data logging. I want to be able to calculate how much energy the wood stove puts into the tank and how much the floor gets. Getting the Grundfos to work is giving me fits. I had them working with a breadboard but when I soldered it up they stopped working. I had made notes of the circuit but when I went back to a breadboard they did not work anymore. Auurrgghh.. I also went to a 16 bit adc for better resolution. It seemed to work well and was easy to configure. This is a long term project, not because I want it be but because it is. ::)

Will
24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

TomW

  • Administrator
  • Hero Member
  • *****
  • Posts: 1415
  • Nullius in Verba
Re: Arduino based PWM diversion control system
« Reply #114 on: February 26, 2017, 10:22:12 AM »
Hi Larry,

I had no luck with the DS18B20 sensors. I liked the idea of them. I could get meaningful readings from them but once in a while they would suddenly read high and then go back to a correct reading. Weird. They would work at short distances but I need to go from the power room to the HWT which is about 25'. 

Will

Yeah , I have to massage my logs to eliminate "flyers" in the data like 69,70,69, 180 degrees. Its annoying but I still use them for general monitoring but would not trust them for "mission critical" uses because of those occasional wide swings in accuracy. Of the dozen or so I have in use they have all been pretty solid as far as durability is concerned. I got a bunch of them for like 50 cents a piece on Feebay some years back quite a deal so I  am using them until I get annoyed enough to get replacements or they fail. Or we need something better.

For environmental use I have been playing with "La Crosse" remote wireless sensors and RTL-SDR dongles to sniff the RF the broadcast. Even cheap ones give good, reliable data once you dial in the data stream. this unit includes humidity.

Using rtl_433 to grab the stream from a LaCrosse TX141TH-Bv2 sensor using the rtl-sdr dongle on a Raspberry PI 3 B.

Code: [Select]

 2017-02-26 09:13:29
        Temperature in deg F:    34.34 F
        Humidity:        57 %
        Sensor ID:       9d
:       LaCrosse TX141TH-Bv2 sensor
        Battery:         OK
        Test?:   No
 2017-02-26 09:14:19
        Temperature in deg F:    34.34 F
        Humidity:        57 %
        Sensor ID:       9d
:       LaCrosse TX141TH-Bv2 sensor
        Battery:         OK
        Test?:   No


I like no cables as this solid masonry house is hard to run cable discretely from my "control center" in the dungeon. Err man cave.  ;)


Just some other ways to grab temperature.

All good fun!

Tom
« Last Edit: February 26, 2017, 11:55:05 AM by TomW »
Do NOT mistake me for any kind of "expert".

( ͡° ͜ʖ ͡°)


24 Trina 310 watt modules, SMA SunnyBoy 7.7 KW Grid Tie inverter.

I thought that they were angels, but much to my surprise, We climbed aboard their starship and headed for the skies

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 1331
Re: Arduino based PWM diversion control system
« Reply #115 on: February 26, 2017, 11:46:45 AM »
 Will
To calculate the amount of energy going into water you will need flow rate - if I remember the formula correctly BTUH = DeltaT x 500 x gpm. The temperature differential  are easy to get but that flow rate is the tough one . Hope you can get the data from those flow meters. 

Regarding one wire ds18b20 false temps - these guys seem to have solved the problem with a CRC check in their code
https://community.particle.io/t/ds18b20-dallas-temperature-readings-jumping-high-at-random-intervals/15555/33

 Tom - I was just at the La Crosse Technology Factory outlet store in La Crosse the other day. Didn't buy any sensors this time though. I have 3 or 4  of their wireless temp displays hanging up on the wall here - got them at garage sales for a dollar or two - ha ha . They are all usually within 2 degrees or so of each other. Also have the full fledged weather station that I got there last year for $50 - works great interfaced with linux weewx program running on raspberry pi . If I have all the ports open you can see the data here on pi weewx webpage.
http://207.190.123.229/weewx/

Larry

« Last Edit: February 26, 2017, 11:48:39 AM by ClassicCrazy »
system one
Classic 150 , 20 Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #116 on: February 27, 2017, 09:30:19 AM »
Hi Larry,

Thanks for the link for DS18B20 CRC code. It did not occur to me to try a code solution to the bad data problem.

One thing I am learning about coding is the concept of using code to reach a goal rather than hardware. When I was adding the amp diversion PID to the diversion control I initially thought of running another control wire to the another relay. This would then go to another element in the tank. Then I thought - Why not use the existing element and relay channel and with code change the output pin to the two control wires. From there I got to - Use all the existing hardware and just change which PID sends a signal to the Arduino relay output pin. It took a bit of trial and error with the PWM timer configuration but it works. No hardware or crawling around in my attic pulling wires or buying relays and elements. Much better and also less costly.  :)

Will
24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

TomW

  • Administrator
  • Hero Member
  • *****
  • Posts: 1415
  • Nullius in Verba
Re: Arduino based PWM diversion control system
« Reply #117 on: February 27, 2017, 10:51:17 AM »
Larry;

Thanks for the CRC info.

Might get to use it when I task one of the Pi3's with watching temps. Most of mine are currently in use on CAI Webcontrol boards and as far as I know there is no way to check CRC on them they just dump the data to their web interface. 

So many "minicomputers" here I can't keep track due to being afflicted with  CRS (Can't Remember Shtuff).

Anyway, nice to know its not just me with the issue.

Appreciate the share.

Tom
Do NOT mistake me for any kind of "expert".

( ͡° ͜ʖ ͡°)


24 Trina 310 watt modules, SMA SunnyBoy 7.7 KW Grid Tie inverter.

I thought that they were angels, but much to my surprise, We climbed aboard their starship and headed for the skies

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #118 on: July 09, 2017, 12:30:54 PM »
I am starting to code the changes needed to charge the Chevrolet Bolt that we brought home last week I bought an opensource Electric Vehicle Supply Equipment (EVSE) from OpenEVSE to charge the car with level 2 charging (240V). I have been charging the car with the level 1 charger (12A 120Vac) EVSE that comes with it. This is quite slow. The goal is to integrate the car into the existing diversion control.

The car has the charger built into it. In can take a maximum of 32A of 240Vac current. The EVSE writes the charge rate to the car and makes sure that all is safe. Minimum charge rate is 6A @ 240 V.

The OpenEVSE communicates by TTL and I should be able to read / write to it with the Arduino. It will turn on, turn off and can adjust the charge rate in 1 amp increments. Actually it will do more thatn this but this is what I need it to do. I think it is what is required for the system.

So somehow I have to determine when I have energy available for the car. #1 I need to take care of my house battery requirements. #2 I need to make hot water. #2 1/2 I need to charge the car and #3 I need to heat the house. Sometimes I may need to charge the car more than I need hot water. I can always burn wood to heat the house but that was really the idea. Hmmmmm....so I need a load priority system and maybe more panels.

Also my HWT diversion inverter is maxed out so I plan to charge the car using my house load inverters. I have 8.8 Kw of capacity there. So I need to configure loadshedding so that if the car is @ 6KW and the stove turns on and then the well pump I am way over my inverter capacity and would need to drop load quickly.

Fun.

Will

24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150

WillEert

  • Full Member
  • ***
  • Posts: 120
Re: Arduino based PWM diversion control system
« Reply #119 on: July 20, 2017, 09:41:25 AM »
My OpenEVSE charger has appeared. I bought the kit and have assembled it. I had to rewire part of the Power room to get it power but it is now plugged in to a 40A 240V circuit. The Bolt charger takes a maximum of 32A 240V. I have been able to write charge limits to it and also turn it off "sleep" and turn it on with the Arduino. This code has been integrated into the diversion control Classic 11 Mega. The car charger is physically located about 24' of wire from the diversion control and the 5Vdc TTL serial seems to reliably writing to the EVSE over this distance using Cat5. I have configured some preliminary logic to turn it on and off which will test today.


On
if (hot water tank >=140 && SOC >= 90% && Total incoming watts >= 2000) - turn on at 6A (1440W).

Off
if (charger is turned on && Total incoming watts <= 1500) - go to sleep.

When I get this working then I need to confgure a means of increasing and decreasing the charge rate while continuing to charge the batteries and make hot water. I configured a calculation that determines aproximately how much load the Magnum inverters have on them. This is working well and will be used for charger load limiting and load shedding if need be.

Last night when we turned our power off it turns out, even though the EVSE was sleeping, that the Bolt could detect the power loss. Although I have the charge interrupt "beeper" turned off in the Bolt the Bolt also has a power loss beeper. Quite a surprize. Chevy did not stint on the beeper decibals when they installed the noise making device.  How annoying. This one I found and turned off quite quickly using the Bolt Power options menu.

It also turns out that when the OpenEVSE is powered down in sleep mode when it powers back up it defaults to charger "ON'. This means if you leave the charger attached to your car (as I want to) that when you turn your power first thing in the morning the car charger now starts to drain your batteries with glee - not good.  I put a few lines of code in the Arduino SetUp to sleep the EVSE as the arduino reboots which looks like is working.
 
Fun. The new OpenEVSE level 2 charger is able to charge the car much more quickly than the Chev supplied Level 1 charger which is good. It also does both Level 1 and 2, each of which has adjustable amp settings. I am thinking I will get another one and a box of receptacle adapters and throw it in the trunk to take with me where I go. As my wife says - It is not like we can hitch hike to a generating plant and get can of electrons if we run out.

My gas bills are much less now for some reason????????

Will

24 ET 185 mono, Classic 150,8x Surrette 6CS25p, 3x Magnum 4448, homecooked diversion system
+ 15 Heliene 330 mono, Classic 150