Arduino Setpoint Differential Pump Controller

One of the challenges of designing a control system for heat storage tanks is controlling when the charging pump for the tank runs to achieve the setpoint temperature the tank needs to be. As the boiler water cools at the end of a burn cycle it can actually draw down the temperature in the tank. To avoid this a commercial product like the Tekmar 156 could be used. I chose instead to make my own controller for this purpose and may choose in the future to expand its monitoring and control capability.

Parts list

Arduino USB board

Dallas 1-wire DS18S20+ sensors

Breadboard 

Solid State Relay (Something like this could be used instead)

4.7K Resistor

1K Resistor 

NPN Transistor (MPS3904 RadioShack)

50' 6-wire telephone cable

Testing Parts Phase

I wired the Arduino board in using the schematic and code here. I had to substitute two 2.2kohm resistors for the 4.7kohm that is called for because I was sent the wrong resistors when I ordered parts and had the others on hand. With the wiring and code done I was able to get the id numbers for each of the sensors I was going to use and update the code to read temperature. I immediately got solid temperature readings from both sensors. I am very impressed with the simplicity and accuracy of the Dallas 1-wire sensors.

Next I had to work out code that would allow me to have a setpoint temperature, a defined differential, and determine whether the pump should be on/off based on comparing the two temperatures. You can see the final code I came up with below or at this link here. (second post down)



Code:

Note: on line 1 change to <OneWire.h> after copying code.

 

Here is the schematic of how I have all of the components setup.  In a short run the 9v power and transistor to the relay would not be required.  In my situation the 50' run of wire was too long for the Arduino pin to activate the relay, so the transistor and added DC power was necessary.