{"id":29203,"date":"2022-06-13T14:50:48","date_gmt":"2022-06-13T21:50:48","guid":{"rendered":"https:\/\/digilent.com\/blog\/?p=29203"},"modified":"2024-01-23T14:49:43","modified_gmt":"2024-01-23T22:49:43","slug":"configuring-a-two-point-controller-for-temperature","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/configuring-a-two-point-controller-for-temperature\/","title":{"rendered":"Configuring A Two-Point Controller for Temperature"},"content":{"rendered":"<h2>Temperature Two-Point Controller<\/h2>\n<div>A control system manages and regulates the behavior of a device or a system. There are many types of control systems: open-loop, closed-loop, logic, two-point, linear, proportional, and PID. This article discusses the two-point controller, also known as a Bang-Bang controller or On-off controller because once a predetermined threshold or parameter&#8217;s value is met, it turns off (or turns on). Think of your home&#8217;s HVAC and A\/C units. When the home&#8217;s temperature drops below the value that you have set for it, it kicks on the heater. When it returns to that point, the heater turns off. Simple enough, right?<\/div>\n<div><\/div>\n<div><\/div>\n<h2>How Do You Operate a Two-Point Controller?<\/h2>\n<div>Operating a two-point temperature controller requires a data acquisition device capable of measuring temperature and one digital output bit.\u00a0 Digilent&#8217;s MCC DAQ line offers <a href=\"https:\/\/www.mccdaq.com\/temperature\/usb-daq\">plenty of devices<\/a> that do just that. Some devices such as the <a href=\"https:\/\/digilent.com\/shop\/mcc-e-tc-thermocouple-measurement-ethernet-daq-device\/\">E-TC <\/a>or <a href=\"https:\/\/digilent.com\/shop\/mcc-tc-32-high-precision-thermocouple-measurement-usb-ethernet-system\/\">TC-32<\/a> can run autonomously by using<a href=\"https:\/\/www.mccdaq.com\/daq-software\/instacal.aspx\"> InstaCal<\/a>. They can be configured to set the thermocouple type, temperature limits and alarms (to control the digital IO). \u00a0Once powered up without the computer, these devices measure temperature and make decisions regarding the digital logic state of a particular digital bit.<\/div>\n<div><\/div>\n<div>These and other devices, including the <span class=\"glossaryToolTip\">USB-2408<\/span>\u00a0series or\u00a0<span class=\"glossaryToolTip\">USB-2416<\/span> series, can be operated by a User created program created with C++, C# or VB.NET. Additionally, higher level programs can also be used such as DASYLab or NI&#8217;s LabVIEW.<\/div>\n<div><\/div>\n<div>Some devices also have an option for analog output as well as digital output, and can be used for more complex control systems such as proportional and PID, but we&#8217;ll cover those at a later date.<\/div>\n<div><\/div>\n<div><\/div>\n<h2>HVAC as a Two-Point Controller<\/h2>\n<div>Let&#8217;s return to the aforementioned example of your home&#8217;s heating system as a two-point controller. Depending upon the age of the thermostat or HVAC controller, there may or may not be a timing element. In older homes, the thermostat is controlled by bimetal strip with a glass bulb in which there is a small amount of mercury or a small copper ball. \u00a0The bimetal strip is calibrated to temperature. \u00a0When the temperature goes down, the bimetal strip flexes in a direction allowing the mercury\/ball to make contact with 2 electrodes, closing a circuit and turning on the boiler or furnace. \u00a0Modern thermostats and HVAC controllers use &#8220;higher tech&#8221; temperature sensors such as thermistors, semiconductors, or thermocouples which are safer than mercury and easier to use in analog or digital circuitry. They also use some sort of timer or time base so as to know how often to take readings.<\/div>\n<div><\/div>\n<div>Home heating systems usually run on 24 VAC. \u00a0This is because the control signal can be more than 10 feet from the heating system. \u00a0A DC signal can show signs of attenuation when running the signal through more than 10 feet of wire. \u00a0AC voltages can travel much further, but it doesn\u2019t have to be as dangerous as using 120 or 240 VAC. \u00a024 VAC is the standard. \u00a0FYI, most doorbells run on 24 VAC. \u00a0You can run the wire as far as you need, and there is no degradation to the signal.<\/div>\n<div><\/div>\n<h2>Creating Your Own Two-Point Controller<\/h2>\n<p>The following application is suitable for the E-TC, TC-32 (using InstaCal). You can configure them to work autonomously by setting up temperature thresholds (alarms) for digital IO on or off, and then position them to run remotely. \u00a0All you need is their respective power supplies. \u00a0 These device&#8217;s digital outputs operate 5V with various amperage specs.<\/p>\n<div>InstaCal refers to these settings as alarms, and that is one use. \u00a0Another is to use them to operate a closed loop system using any of these devices as a two point controller. \u00a0As stated many HVAC systems require a 24 VAC signal to be operated. \u00a0Here you see in most cases, the alarm (digital out) signal is a 5 V TTL logic signal, with low current. \u00a0In all cases, none of the above can output an AC voltage. \u00a0To remedy this, you can add a transistor driver and\/or relay or TRIAC to control an HVAC or any other required control signal.<\/div>\n<div><\/div>\n<div><\/div>\n<div>If you wanted to use channel 0 of an E-TC to monitor a room\u2019s temperature and control a heater to keep that room at 25 \u00b0C, you can configuration the Alarm dialog box like this:<\/div>\n<div><\/div>\n<div>\n<figure id=\"attachment_29205\" aria-describedby=\"caption-attachment-29205\" style=\"width: 412px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-29205\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/InstaCal_BoardConfig_AlarmSettings.png\" alt=\"\" width=\"412\" height=\"593\" data-wp-pid=\"29205\" \/><figcaption id=\"caption-attachment-29205\" class=\"wp-caption-text\">Figure 2 &#8211; InstaCal Board Settings<\/figcaption><\/figure>\n<\/div>\n<div>\n<div>Here we see Channel 0\u2019s alarm set to &#8216;Enabled&#8217;. \u00a0It is set to turn on when a threshold is exceeded, and the output will use active high logic.<\/div>\n<div>The threshold is set using the second option; to turn on the alarm when the measured temperature goes below 25 \u00b0C, and to turn off when the measured value goes above 26 \u00b0C.<\/div>\n<div>Once the unit is configured, click OK, and close InstaCal.<\/div>\n<div><\/div>\n<div>\n<p>Below is a schematic for how you might wire an E-TC to a type T thermocouple, solid state relay and heater. <span style=\"font-size: 1rem;\">For the purposes of discussion, let&#8217;s use a thermocouple input on an E-TC utilizing a T type thermocouple. For control we&#8217;ll use a digital output to control a fictional 120 VAC heater. \u00a0The application will be created first in DASYLab, then LabVIEW, and finally in VB.NET.<\/span><\/p>\n<div><\/div>\n<div>The E-TC and external wiring to the heater:<\/div>\n<div>\n<figure id=\"attachment_29206\" aria-describedby=\"caption-attachment-29206\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-29206\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/ETC_2pt_Ctrlr_schematic-600x311.png\" alt=\"\" width=\"600\" height=\"311\" data-wp-pid=\"29206\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/ETC_2pt_Ctrlr_schematic-600x311.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/ETC_2pt_Ctrlr_schematic.png 759w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-29206\" class=\"wp-caption-text\">Figure 3 &#8211; External Wiring to the Heater<\/figcaption><\/figure>\n<p>Next, the basics of implementing a two-point control in <a href=\"https:\/\/www.mccdaq.com\/dasylab-index\">DASYLab<\/a>. \u00a0There are some additional settings and options used here, but let&#8217;s keep focused on the process itself.<\/p>\n<figure id=\"attachment_29207\" aria-describedby=\"caption-attachment-29207\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-29207\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/DASYLab_2pt_Ctrl.png\" alt=\"\" width=\"600\" height=\"225\" data-wp-pid=\"29207\" \/><figcaption id=\"caption-attachment-29207\" class=\"wp-caption-text\">Figure 4 &#8211; DASYLab Two Point Control Worksheet<\/figcaption><\/figure>\n<figure id=\"attachment_29208\" aria-describedby=\"caption-attachment-29208\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-29208\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/DASYLab_2pt_Ctrl_layout-600x339.png\" alt=\"\" width=\"600\" height=\"339\" data-wp-pid=\"29208\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/DASYLab_2pt_Ctrl_layout-600x339.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/DASYLab_2pt_Ctrl_layout.png 892w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-29208\" class=\"wp-caption-text\">Figure 5 &#8211; DASYLab Two Point Control Layout<\/figcaption><\/figure>\n<p>If you are using LabVIEW, that&#8217;s no problem. It doesn&#8217;t have a specific two-point controller VI, but that can easily be resolved by using a Less Than\/Equal To VI as the decision maker (as seen below):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-29209\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/LabVIEW_2pt_Ctrl-600x211.png\" alt=\"\" width=\"600\" height=\"211\" data-wp-pid=\"29209\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/LabVIEW_2pt_Ctrl-600x211.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/LabVIEW_2pt_Ctrl.png 920w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<figure id=\"attachment_29210\" aria-describedby=\"caption-attachment-29210\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-29210\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/LabVIEW_2pt_Ctrl_FrontPanel-600x280.png\" alt=\"\" width=\"600\" height=\"280\" data-wp-pid=\"29210\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/LabVIEW_2pt_Ctrl_FrontPanel-600x280.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/LabVIEW_2pt_Ctrl_FrontPanel.png 792w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-29210\" class=\"wp-caption-text\">Figure 7 &#8211; And the Front Panel<\/figcaption><\/figure>\n<h2><\/h2>\n<h2>Using Universal Library<\/h2>\n<div>Writing a program in Visual Basic .NET using the Universal Library provides greater flexibility. \u00a0In DASYLab and LabVIEW, there are a few more things going on that you don\u2019t see, like what&#8217;s being handled by the DASYLab and LabVIEW environments (finding the device, handling of errors, etc.). \u00a0For device discovery, all the user needs do is pick the device from the list provided. \u00a0In syntax programming for a VB app, the programmer and user can be the same person, and so the programmer\/user has to generate all the code, or get it from another example app. \u00a0The programmer will usually write the code segment once, and use it in as many places as possible making slight changes along the way. \u00a0This is exactly what we have done below. \u00a0Although the device discovery and error handling routines have been written, we&#8217;re not going to show them here, but that code can be examined and freely used <a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/Two_Point_Controller.zip\">HERE<\/a>. \u00a0Another thing not being shown is the code behind the LED, thermometer, and strip chart.<\/div>\n<div><\/div>\n<div>Here is the routine in the Timer_tick event used to loop through reading the thermocouple, determine if the two-point controller should be on or off, and operate the digital bit controlling the relay and heater:<\/div>\n<div>\n<blockquote>\n<div>Dim\u00a0ETC_Temperature\u00a0As Double<\/div>\n<div><\/div>\n<div>ulstat = Daqboard.TIn(0, MccDaq.TempScale.Fahrenheit, ETC_Temperature, MccDaq.ThermocoupleOptions.WaitForNewData)<\/div>\n<div>If\u00a0ulstat.Value &lt;&gt; MccDaq.ErrorInfo.ErrorCode.NoErrors\u00a0Then<\/div>\n<div>\u00a0 \u00a0 errhandler(ulstat)<\/div>\n<div>\u00a0 \u00a0 Exit Sub<\/div>\n<div>End If<\/div>\n<div><\/div>\n<div>Thermometer1.TempValue = ETC_Temperature<\/div>\n<div>StripChart1.AddValue(ETC_Temperature)<\/div>\n<div>lblTemp.Text = ETC_Temperature.ToString(&#8220;#0.000&#8221;)<\/div>\n<div><\/div>\n<div>If\u00a0(ETC_Temperature &lt; (130 &#8211; vsSetPoint.Value))\u00a0Then<\/div>\n<div>\u00a0 \u00a0 ulstat = Daqboard.DBitOut(MccDaq.DigitalPortType.AuxPort, 0, MccDaq.DigitalLogicState.High)<\/div>\n<div>\u00a0 \u00a0 Led1.Value =\u00a0True<\/div>\n<div>Else<\/div>\n<div>\u00a0 \u00a0 ulstat = Daqboard.DBitOut(MccDaq.DigitalPortType.AuxPort, 0, MccDaq.DigitalLogicState.Low)<\/div>\n<div>\u00a0 \u00a0 Led1.Value =\u00a0False<\/div>\n<div>End If<\/div>\n<div><\/div>\n<div>If\u00a0ulstat.Value &lt;&gt; MccDaq.ErrorInfo.ErrorCode.NoErrors\u00a0Then<\/div>\n<div>\u00a0 \u00a0 errhandler(ulstat)<\/div>\n<div>\u00a0 \u00a0 Exit Sub<\/div>\n<div>End If<\/div>\n<\/blockquote>\n<div>And the form view, where you can adjust the set point and monitor the performance of your system:<\/div>\n<div><\/div>\n<\/div>\n<\/div>\n<div>\n<figure id=\"attachment_29211\" aria-describedby=\"caption-attachment-29211\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-29211\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/VBNET2010_2pt_Ctrl_Form-600x323.png\" alt=\"\" width=\"600\" height=\"323\" data-wp-pid=\"29211\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/VBNET2010_2pt_Ctrl_Form-600x323.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/VBNET2010_2pt_Ctrl_Form.png 732w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-29211\" class=\"wp-caption-text\">Figure 8 &#8211; Visual Basic .NET Form View<\/figcaption><\/figure>\n<h2><\/h2>\n<h2>Conclusion<\/h2>\n<p>As you can see, using Digilent&#8217;s MCC temperature measurement devices and software products provide many ways to resolve the need to implement a two-point temperature controller. \u00a0Pick the combination of hardware and software to meet your specific needs.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-29203 jlk' data-task='like' data-post_id='29203' data-nonce='4d1b41d1d7' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-29203 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-29203 jlk' data-task='unlike' data-post_id='29203' data-nonce='4d1b41d1d7' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-29203 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-29203 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Temperature Two-Point Controller A control system manages and regulates the behavior of a device or a system. There are many types of control systems: open-loop, closed-loop, logic, two-point, linear, proportional, &hellip; <\/p>\n","protected":false},"author":59,"featured_media":29206,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4325,4361,4327,1561],"tags":[4624,4359,4363,4358,4623,4347],"ppma_author":[4507],"class_list":["post-29203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debug-validation-test","category-data-acquisition","category-projects","category-applications","tag-controller","tag-daq","tag-dasylab","tag-mcc","tag-temperature","tag-zmod"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2022\/06\/ETC_2pt_Ctrlr_schematic.png","jetpack_sharing_enabled":true,"authors":[{"term_id":4507,"user_id":59,"is_guest":0,"slug":"jgreenberg","display_name":"Jeff Greenberg","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/4733b4dee4cf309719f59882b387a0c9fcd17b506ca0858a86a1ecd2c7ed324a?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/29203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/59"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=29203"}],"version-history":[{"count":7,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/29203\/revisions"}],"predecessor-version":[{"id":30443,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/29203\/revisions\/30443"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/29206"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=29203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=29203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=29203"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=29203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}