Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file
Dependencies: net 1-wire lpc1768 crypto clock web fram log
/media/uploads/andrewboyson/heating.sch
/media/uploads/andrewboyson/heating.brd
/media/uploads/andrewboyson/eagle.epf
web-this/boiler/web-boiler-script.js@91:8b192efd0288, 2020-06-10 (annotated)
- Committer:
- andrewboyson
- Date:
- Wed Jun 10 10:08:06 2020 +0000
- Revision:
- 91:8b192efd0288
- Parent:
- 53:c1bf7d9db507
- Child:
- 92:2d1ca4dcbca7
Changed the run on residual to a fixed 4 bit fraction temperature to allow better than one degree precision.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 47:229338b3adcb | 1 | //Boiler script |
andrewboyson | 47:229338b3adcb | 2 | 'use strict'; |
andrewboyson | 47:229338b3adcb | 3 | |
andrewboyson | 91:8b192efd0288 | 4 | let dateTime = ''; |
andrewboyson | 91:8b192efd0288 | 5 | let tankTemperature = ''; |
andrewboyson | 91:8b192efd0288 | 6 | let blrOutTemperature = ''; |
andrewboyson | 91:8b192efd0288 | 7 | let blrRtnTemperature = ''; |
andrewboyson | 91:8b192efd0288 | 8 | let boilerCall = false; |
andrewboyson | 91:8b192efd0288 | 9 | let boilerPump = false; |
andrewboyson | 91:8b192efd0288 | 10 | let tankSetPoint = ''; |
andrewboyson | 91:8b192efd0288 | 11 | let tankHysteresis = ''; |
andrewboyson | 91:8b192efd0288 | 12 | let blrRunOnDeg = ''; |
andrewboyson | 91:8b192efd0288 | 13 | let blrRunOnTime = ''; |
andrewboyson | 47:229338b3adcb | 14 | |
andrewboyson | 47:229338b3adcb | 15 | function parse() |
andrewboyson | 47:229338b3adcb | 16 | { |
andrewboyson | 47:229338b3adcb | 17 | let lines = Ajax.response.split('\n'); |
andrewboyson | 91:8b192efd0288 | 18 | tankTemperature = OneWire.parseDS18B20 (lines[0]); |
andrewboyson | 91:8b192efd0288 | 19 | blrOutTemperature = OneWire.parseDS18B20 (lines[1]); |
andrewboyson | 91:8b192efd0288 | 20 | blrRtnTemperature = OneWire.parseDS18B20 (lines[2]); |
andrewboyson | 47:229338b3adcb | 21 | boilerCall = Ajax.hexToBit (lines[3], 0); |
andrewboyson | 47:229338b3adcb | 22 | boilerPump = Ajax.hexToBit (lines[3], 1); |
andrewboyson | 47:229338b3adcb | 23 | tankSetPoint = Ajax.hexToSignedInt16(lines[4]); |
andrewboyson | 47:229338b3adcb | 24 | tankHysteresis = Ajax.hexToSignedInt16(lines[5]); |
andrewboyson | 91:8b192efd0288 | 25 | blrRunOnDeg = OneWire.parseDS18B20 (lines[6]); |
andrewboyson | 47:229338b3adcb | 26 | blrRunOnTime = Ajax.hexToSignedInt16(lines[7]); |
andrewboyson | 47:229338b3adcb | 27 | } |
andrewboyson | 47:229338b3adcb | 28 | function display() |
andrewboyson | 47:229338b3adcb | 29 | { |
andrewboyson | 47:229338b3adcb | 30 | let elem; |
andrewboyson | 91:8b192efd0288 | 31 | elem = Ajax.getElementOrNull('ajax-tank-html' ); if (elem) elem.textContent = tankTemperature.toFixed(1); |
andrewboyson | 91:8b192efd0288 | 32 | elem = Ajax.getElementOrNull('ajax-blr-out-html' ); if (elem) elem.textContent = blrOutTemperature.toFixed(1); |
andrewboyson | 91:8b192efd0288 | 33 | elem = Ajax.getElementOrNull('ajax-blr-rtn-html' ); if (elem) elem.textContent = blrRtnTemperature.toFixed(1); |
andrewboyson | 91:8b192efd0288 | 34 | elem = Ajax.getElementOrNull('ajax-blr-rise-html' ); if (elem) elem.textContent = (blrOutTemperature - blrRtnTemperature).toFixed(1); |
andrewboyson | 91:8b192efd0288 | 35 | |
andrewboyson | 47:229338b3adcb | 36 | elem = Ajax.getElementOrNull('ajax-blr-call-toggle'); if (elem) elem.setAttribute('dir', boilerCall ? 'rtl' : 'ltr'); |
andrewboyson | 47:229338b3adcb | 37 | elem = Ajax.getElementOrNull('ajax-blr-pump-toggle'); if (elem) elem.setAttribute('dir', boilerPump ? 'rtl' : 'ltr'); |
andrewboyson | 47:229338b3adcb | 38 | elem = Ajax.getElementOrNull('ajax-tank-set-point' ); if (elem) elem.value = tankSetPoint; |
andrewboyson | 47:229338b3adcb | 39 | elem = Ajax.getElementOrNull('ajax-tank-hysteresis'); if (elem) elem.value = tankHysteresis; |
andrewboyson | 91:8b192efd0288 | 40 | elem = Ajax.getElementOrNull('ajax-blr-run-on-deg' ); if (elem) elem.value = blrRunOnDeg.toFixed(1); |
andrewboyson | 47:229338b3adcb | 41 | elem = Ajax.getElementOrNull('ajax-blr-run-on-time'); if (elem) elem.value = blrRunOnTime; |
andrewboyson | 47:229338b3adcb | 42 | |
andrewboyson | 47:229338b3adcb | 43 | } |
andrewboyson | 47:229338b3adcb | 44 | |
andrewboyson | 47:229338b3adcb | 45 | Ajax.server = '/boiler-ajax'; |
andrewboyson | 47:229338b3adcb | 46 | Ajax.onResponse = function() { parse(); display(); }; |
andrewboyson | 47:229338b3adcb | 47 | Ajax.init(); |