Full article can be found at Attachments as Digital thermostat for burner andboiler with remote monitor.pdf
A popular way to produce hot water is “the sun”. In winter (lets say November through March), hot water is produced by the burning of diesel. The burner stops at 60 degrees. (After three starts the burner stops at 60 degrees but the temperature will reach about 70degrees.) The hot water pump starts at 40 degrees. The maximum temperature in the hot water tank is set to 60 degrees. (1500 liters of hot water is enough for 6 apartments). The pump starts to circulate the water between the burner and the hot water tank by bringing the hot water temperature from ambient temperature to 50. After reaching the desired temperature in the hot water tank, the pump continues to run. There is a difference of about 10degree that burner’s boiler temperature must drop down to start the burner again. Once the burner is switched off and starts to cool down amounts of heat is transferred from the hot water tank to the burner’s boiler. The pump, if the temperature is greater than 40 degrees, continues to run. Here the digital thermostat stops the pump to run when it detects that the temperature of the hot water tank is higher than the burner temperature If users use hot water and temperatures resist, the digital thermostat allows the pump to operate again.
Burner’s pump must be stopped when the temperature in the boiler is greater than the burner's. The main controller uses two PT1000 interfaced with max31865 interface to an Atmel328p in Arduino module. A Nokia 5110 like small screen reports the actual temperature values and the state of the controller and the pump. A relay acts as a switch for the pump or the magnetic valve. Atmel328p has a serial interface and Arduino platform have a well support of it. The WIZ750SR is a Serial to Ethernet module.This gives the advantage to MCU the advantage of modern Ethernet protocol in communication.. This device is installed in the basement near the burner -boiler. The value of hot water should be available to residents of the block of flats to know when there is hot water. For this purpose, an indicator of the hot water value has must be placed in share places. The communication of the indicator with the central controller is done via the Ethernet network. A Ethernet switch can expand the network over the two devices so each flat can have its own indicator.Indicators are powered at 12v over the Ethernet cable. That means that each device, the main controller in the basement and each monitor in the apartment must have his own WIZ750SR module. The controller has an embedded web page, setting the WIZ750SR module in server mode. Each monitor in the apartment in the apartment building has its WIZ750SR module in client mode. The client, periodically - every 0.5 sec- asks the controller for the hot water value. Bigred color, 7 segment displays are used to indicate the value. If the controller’s network be a part of the local network then the controller’s web page can be accessed from computers, tablets or smart phones.
WHY, Thisand That
This project consists of two devices. The main controller usually placed in basement and the indicators placed in shared places or in the apartment.
Readers must be able to replicate the entire project and customize the code according to their own needs, ie a reader may want to manipulate the code of the indicator to control a new module, e.g.to operate the general switch. The controller and the monitor are based on Arduino platform. This is a free IDE and development platoform. For this application an Arduino NANO [1] is used. This platform is an Atmel AtMega328P processor with C language. Libraries for used sensors are stored in “mydocuments/Arduino/libraries” folder for windows platform and they are in text format with the extension.cpp. Arduino platform and libraries used are free. Easily can be transfer to user’s platform if they like to use their platform. Communication between the controller and the monitor(s) are on Ethernet protocol. The module Wiz750SR is an excellent choice for this. The serial interface is embedded in AtMega328P but for Ethernet, we must include a library and special chip for this. Ethernet functionmust be called continually to serve the Ethernet service and do all about the protocol with respect in time to avoid timeouts with the clients. Such libraries occupies at least 700 bytes of RAM which are used as receive and transmit buffer for TCP reducing the Arduino free RAM below 400 bytes. During the upload process, malfunction warning messages are generated. Indeed, when the code is executed, the functions do not work properly. At the same time, the total size of all libraries (RTD-to-Digital Converter, Nokia, Ethernet, my functions) covers the entire RAM memory so that the available memory limits the design of the embedded webpage to some simple words On another hand, the WIZ750SR has its processor dedicated to the protocol. The developer has only to program the IP, mask, gateway addresses and set the module in Server or client mode. Then the WIZ750SR is responsible for all. It will respond to ping protocol, it will establish a TCP connection and it will pass only text to AtMega328P. Finally, it will close the connection with the client or the server and all this process will be transparent to AtMega328P. The absence of a dedicated TCP library releases an important part of ROM and RAM. These bytes can be used to optimize the embedded web page by adding additional features beyond just show the hot water temperature and the state of the controller. The WizNet has developed a program (free for download) that can discover WIZ750SR modules in the network and change their parameters. Changed parameters, IP, NETMASK, Gateway etc are storedin the module. This ability gives the advantage to use the rest of Rom for custom functions and not for web pages to alter the network characteristics. Of course, the WIZ750SR module has commands to do so if readers want to use custom pages to do so.
Also, WIZ750SR has it own Mac address that is very important for the commercial purpose that there is no need to spend extra money and time to buy the Mac addresses. WIZ750SR module is a DC 3.3V device. Controller and monitors use a 12V power supply. This gives the advantage to power all devices, including the Ethernet switch of the local network, from one 12V/2A power supply. All devices are powered over the Ethernet cable. WIZ750SR has not a POE capability so cat5e cable must be spread to two using the orange and the green pair for the Ethernet IEEE802.3 and blue, brown pairs for positive and negative for the power supply, respectively. Controller and monitors use the AMS1117-3.3 800mA a LOW DROPOUT VOLTAGE REGULATOR in SOT-223 with electric characteristics Iout <800mA, Vin must be between 4.75 to 15v Figure 3.In full operation it goes hot, so I solder a small metal tip on the tab. I future I will replace the AMS1117 with a step down DC-DC converter to avoid any damage form over heat.
Arduino NANO has its AMS1117-5.0 at 5v [2], so signals to WIZ750SR must be translated to 3.3v. A simple resistor divider is used. See figure 4. This is used for Rx and nReset signals of the WIZ7502SR. TheWIZ750SR’s Tx signal is connected to Arduino’s Rx through a 10hom resistor.
For schematics and PCB used the Cadsoft Eagle which is free for PCB under 100X100mm. So all PCBs are kept under the 100mm
HardwareA) The controllerThe property of the controller is: Arduino NANO module (Atmel atMega328P), 2 pieces of max31865, 2 pieces PT1000 sensor, a graphic LCD 84x48 (nokia 5110 compatible screen), WIZ750SR to expand Atmel’s atMega328P serial interface to Ethernet network.
The controller senses the temperatures of the boiler and the hot water tank through PT1000 sensors. These sensors are droved with max31865 chip. A chip from “Maxim Integrated” a RTD-to-Digital Converter. These chips use the SPI Interface to communicate with the Arduino. The max31865 uses a CS pin to be enabled. Hot water tank chip uses pin 9 (PB1[3])and Boiler uses pin 10 (PB2) of Arduino, see Piece code 1. The schematic for the max31865 is typical and described in the datasheet of the Max31865.
One sensor is stacked onto the output pipe of the boiler and one is stacked on the hot water tank (usually hot water tanks has multiply inlets for thermometers – one will be occupied by the PT1000).
The Atmel’s atMega328P hardwaretimer1 is initialized to tick every one second, it calls the EnhmLCD() function which refresh the screen with new values and the state of the controller.Values are stored in global variables. Variables maxHotWater, maxColdWater holds temperature of hot water tank and the burner-boiler respectively. Variable “char ControlerState=0;” and “Stringlogo="";” holds the state of the controller. See table 1 for the state of the controller
---------------------------------------------------------------------
Table 1. controller sate and explanation
1 H.W.T AtMax Hot water tank have reach the max programmed temperature. Hot water pump is off
2 Pump tmp low The burner-boiler temperature is lower then the programmed temperature to start the hot water pump. Hot water pump is off
3 reserved
4 H.W.T high The temperature of the H.W.T is higher then burner boiler. Hot water pump is off
5 Burner high The burner-boiler temperature is higher than the temperature of the programmed pump start temperature and the H.W.T temperature. The hot water pump is on.
-----------------------------------------------------------------------
The screen of the controller is a graphic LCD 84x48 (Nokia 5110 compatible screen) With 8x5 pixel characters in 84x48 pixel matrix there are 6 lines with 15 characters width for custom messages.
At screen line 1 H.W.T Temp shows the max programmed temperature of Hot water tank eg. 52 when HWT[4] reaches this value the controller shut off the hot water pump. The temperature in the tank must drop by 2OC to start the pump again. (The value of2OC is from experience and in this firmware is embedded) During this time the value of the maximum temperature is alternately displayed with a special character, indicating this state. (Static const byte glyph[] are declared in “ void InitLCD() “ function that initialize the LCD module.
Line 2 on the screen shows the temperature of the burner-boiler above it will start the hot water pump.This value can be changed through the embedded web page.
Line3 on the screen show “st/sp” the time interval to start or stop the pump to avoid the pump’s stress from immediate start/stops
Line 4 on screen show“BURNER H.W.T.” These are the labels for values in line 5
Line 5 on the screen show the actual values of temperatures of burner-boiler and H.W.T. A value of 848 means that no sensor is connected and a value of -231 means that the sensor is short circuit.
Line 6 on the screen shows a string indicating the state of the controller (see table 1) the last character in line 6 is a glyph flashing once a second indicating the controller is running properly.
Arduino IDE the “Void Setup()”procedure run once. The main purpose of this function is to initialize the modules. The serial speed is set to 115200bps. Function InitLCD() is called to initialize the graphic screen. In This function is defined an additional character, a glyph, used inline 6 to indicate that the controller is running properly.
The hardware Timer1initialized for 1 sec tick. Library for RTD initializes the max31865 chips using a 2 wire sensors.
Next step is to runthe program. Where is the initialization procedure for WIZ750SR? Allinitialization is done with the configuration utility by Wiznet and saved inthe module. That’s the big advantage of using this module. No code needs forconfiguration and the ROM for this ‘’configuration’’, now, is available forcustom functions.With this utility Iset the module to server mode (static IP 192.168.1.30 port 80) and I set 1secto Inactivity timer.
Loop function calls
a) “Get_Values();” the function poles the two max31865 to get the temperature from burner-boiler and Hot water tank and renew the maxHotWater and maxColdWater The burner-boiler temperature is set at 60oC with a diff of 10oC for restart. The maxTemperature of Hot water tank is set at 52oC, and this can be changed by the user through the embedded web page (or with the program jumper).
b) Start_OR_Stop(); the function gets the decisionaccording the rule: it compares the two temperaturesand if the temperature of hot water tank is greater than the temperature of theboiler it power on the relay to switch off the hot water pump. Variable “startStopSecs” holds the time inseconds must be passed before the controller starts or stops the hot water pumpto avoid immediate starts and stops that stress the pump. This time can bechanged through the embedded web setup page.
c) checkSerial(); the function listens the serial portfor WIZ750SR messages from the network and serves them.
Web pages are const char PROGMEM var_name[]. Normally goes to SRAM memory. The PROGMEM keyword isa variable modifier. It tells the compiler to "put this information intoflash memory", instead of into SRAM, where it would normally go. Plus it needs a special function (pgm_read_byte_near()) to fetch these bytes form Flash and transmit them immediately to the serial port. This needs only one RAM byte. see Code piece 2
d) It poles the pin 17 (SetupPin) This pin is defined as an input. On the PCB there is a jumper named “program” Users that don’t want to use the monitors or to set the values for a )HWT temperature, b)pump’s start temperature and c)delay time through the web page, can use the three potentiometers on the upper right corner. These potentiometers are connected to analog ports A0, A1, A2. The user can turn the potentiometers to set the corresponding values. Removing the jumper the values are stored in EEPROM
B)The indicator(s) - monitorsThe monitors are placed in shared areas so that tenants can be informed about the hot water temperature. An Ethernet switch can expand the local network and connect more than one indicator. Thus, the possibility each apartment can have an indicator in apartment blocks of a block of flats.
The hardware of an indicator is a) Arduino NANO, 4 seven segment red common cathode displays 30mm height, and a WIZ750SR module for communication with the main controller.
The display of the hot water value is an integer. There is no need for decimal places because people do not realize the deference of small changes on the temperature. Decimal places are for physiological reasons. In upcoming firmware releases, I will expand the displayed value with decimal places if users apply for this.
In Void Setup(); program initializes the serial port to 115200bps. Hardware timer1 initialized at 10msand at each tick it refreshes the display calling the ShowTemp() function that split the numbers to seven segment digit is, also, each minute flashes the dots on the display indicating the proper running of the hardware. As in the main controller, so here there is no initialize segment for the WIZ750SR. The module is configured to client mode with static IP (192.168.1.60 port 80) and Timeinterval to 1sec to close the connection using the configuration utility from WizNet.
The variable “intConnectionInterval=5000;” counts the time between poles to the main controller.The value is in milliseconds. This value combined with the mills() function will pole the controller at 5 sec to get the first value. Then the value of ConnectionInterval will be30000 that mean that it will pole the main controller twice the minute. If it can’t connect with the main controller for 10 times (5 minutes) the displays will show “-- --2” that means “I lost the connection with the main controller, I’m trying to recover”. This might be caused because two monitors are simultaneously tried to connect to the main controller. Then the ConnectionInterval is changed to 5000 to retry the connection with the main controller. If it fails the displays will show “– --1” that means failed to connect to the main controller. The monitor will continue to try to establish the connection with the main controller but temporally can't show a proper value.
As mentioned above all configuration parameters to wiz750sr are set with the configuration utility from the Wiznet. With this utility, the WIZ750SR is set to TCP client mode.Choosing the TCP client mode on the configuration window, it enables the"Remote/IP port" segment. Here are the Host's IP and the port. With simple words the IP and the port of"The main controller". <<The server who will be looking for to establish a connection>> when data are sent to the WIZ750SR’s serial port. I set the IP to Remote ip: 192.168.1.30 and the Remote port: 80 (the main controller must respond to browsers) The segment Network configuration concerns the monitor’s WIZ750SR parameters and are set to Local IP:192.168.1.60, Subnet Mask 255.255.255.0, Gateway:192.168.1.1 DNS server 8.8.8.8 At Local port segment I set 80
For best performance, I set the Timer Interval to 0 (disabled) Arduino’s serial Rx buffer is 64 bytes and overflows. That is the reason that the monitor sends out a "/s" to the main controller. The response is a simple text message with the Temperature value. A paradigm for the response message is "Burnerboiler:60.02|Hot water tank:49.80<". There is a need for a special about the Arduino's serial port if we have to interpreter the main web page to extract the temperature value of the HWT.
[1]Also, this project is developed with Microchip Dspic30F4013 and Mikroelectronika MikroC language. The size of the compiled code is over the 6KB, the limit of free MikroC. So readers will not be able to compile the code as their needs.
[2]The 3.3v operation is also available but it will be unstable in timing functions. Firmware and atmega328P fuses must be altered for this option.
[3]Atmel_328P port
[4]HWT=Hot water tank
Comments