Commit 0989e9667ce0ecb06738fb480c7ea15fbcfb116c
1 parent
49efc576
Add Test HVAC communication example, adapt example's README.md accordingly and correct a typo
Showing
3 changed files
with
86 additions
and
2 deletions
examples/README.md
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | Several examples are given, all fully functional, from very basic to advanced. The first thing you should always do is to run Test_Boiler_Communication.ino or Test_HVAC_Communication.ino, to make sure your [OpenTherm controller](https://www.tindie.com/products/jeroen88/opentherm-controller/) is correctly wired, the right GPIO pins are configured and the secondary boiler or HVAC is responding to the requests of the primary thermostat. |
| 4 | 4 | |
| 5 | 5 | ## Test_Boiler_Communication.ino and Test_HVAC_Communication.ino |
| 6 | -Basic test of your setup. | |
| 6 | +Basic test of your setup. The Test_HVAC_Communication.ino program is **not tested** because I do not own such a device. | |
| 7 | 7 | |
| 8 | 8 | ## OpenTherm_Show_DATA-IDs.ino |
| 9 | 9 | Sends all known DATA-IDs to the secondary and shows it's response. Can be used for both boilers and HVACs, although the boiler information is more extensive. Also the data types for the HVAC calls may not be correct. | ... | ... |
examples/Test_Boiler_Communication/Test_Boiler_Communication.ino
| ... | ... | @@ -58,7 +58,7 @@ void loop() { |
| 58 | 58 | Serial.println("Here is the meanining of each bit in these flags:"); |
| 59 | 59 | if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_DHW_PRESENT)) Serial.println("Domestic Hot Water (DHW) present"); else Serial.println("Domestic Hot Water (DHW) not present"); |
| 60 | 60 | if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_CONTROL_TYPE)) Serial.println("Control type on/off"); else Serial.println("Control type modulating"); |
| 61 | - if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_COOLING)) Serial.println("Cooling supprted"); else Serial.println("Cooling not supported"); | |
| 61 | + if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_COOLING)) Serial.println("Cooling supported"); else Serial.println("Cooling not supported"); | |
| 62 | 62 | if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_DHW)) Serial.println("Domestic Hot Water (DHW) storage tank"); else Serial.println("Domestic Hot Water (DHW) instantaneous or not-specified"); |
| 63 | 63 | if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_LOW_OFF_PUMP_CTRL)) Serial.println("Low off and pump control not allowed"); else Serial.println("Low off and pump control allowed"); |
| 64 | 64 | if(secondaryFlags & uint8_t(OpenTherm::CONFIGURATION_FLAGS::SECONDARY_CH2_PRESENT)) Serial.println("Second Central Heating system (CH2) present"); else Serial.println("Second Central Heating system (CH2) not present"); | ... | ... |
examples/Test_HVAC_Communication/Test_HVAC_Communication.ino
0 → 100644
| 1 | +/* | |
| 2 | + * https://github.com/Jeroen88/EasyOpenTherm | |
| 3 | + * https://www.tindie.com/products/Metriot/OpenTherm-adapter/ | |
| 4 | + * | |
| 5 | + * Test_Boiler_Communication is a program to test if your MCU can communicate with your OpenTherm compatible HVAC | |
| 6 | + * Copyright (C) 2022 Jeroen Döll <info@metriot.nl> | |
| 7 | + * | |
| 8 | + * This program is free software: you can redistribute it and/or modify | |
| 9 | + * it under the terms of the GNU General Public License as published by | |
| 10 | + * the Free Software Foundation, either version 3 of the License, or | |
| 11 | + * (at your option) any later version. | |
| 12 | + * | |
| 13 | + * This program is distributed in the hope that it will be useful, | |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | + * GNU General Public License for more details. | |
| 17 | + * | |
| 18 | + * You should have received a copy of the GNU General Public License | |
| 19 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
| 20 | + * | |
| 21 | + * You need an OpenTherm controller that you can buy at my Tindie store, see <https://www.tindie.com/products/jeroen88/opentherm-controller/> | |
| 22 | + * Connect the two HVAC wires to the OpenTherm controller pins marked OT. The order is not important. | |
| 23 | + * Connect the OpenTherm controller to your microcontroller's power (3v3) and ground (GND) pins. | |
| 24 | + * Connect the OpenTherm TXD pin to the microcontroller's pin defined by #define OT_RX_PIN. | |
| 25 | + * Connect the OpenTherm RXD pin to the microcontroller's pin defined by #define OT_TX_PIN. | |
| 26 | +*/ | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | +#include <Arduino.h> | |
| 31 | + | |
| 32 | +#include <EasyOpenTherm.h> | |
| 33 | + | |
| 34 | + | |
| 35 | +#define OT_RX_PIN (34) | |
| 36 | +#define OT_TX_PIN (17) | |
| 37 | + | |
| 38 | + | |
| 39 | +void setup() { | |
| 40 | + // put your setup code here, to run once: | |
| 41 | + Serial.begin(115200); | |
| 42 | + Serial.println("\n\nStarted"); | |
| 43 | + delay(5000); | |
| 44 | +} | |
| 45 | + | |
| 46 | + | |
| 47 | +void loop() { | |
| 48 | + // put your main code here, to run repeatedly: | |
| 49 | + static OpenTherm thermostat(OT_RX_PIN, OT_TX_PIN); // Create an OpenTherm thermostat (is primary device; HVAC is secondary device ) with OT_RX_PIN to receive data from HVAC and GPIO17 to send data to HVAC | |
| 50 | + | |
| 51 | + // First try to connect to the HVAC to read it's capabilities. The HVAC returns an 8 bit secondaryFlags and each bit has a meaning. The bits are defined in enum class OpenTherm::HVAC_CONFIGURATION_FLAGS | |
| 52 | + // The secondaryMemberIDCode identifies the manufacturer of the HVAC | |
| 53 | + uint8_t secondaryFlags; | |
| 54 | + uint8_t secondaryMemberIDCode; | |
| 55 | + if(thermostat.read(OpenTherm::READ_DATA_ID::HVAC_SECONDARY_CONFIGURATION, secondaryFlags, secondaryMemberIDCode)) { // Mandatory support | |
| 56 | + Serial.println("Your setup is working! A frame was send to the HVAC and the HVAC responded with a valid frame."); | |
| 57 | + Serial.printf("Secondary configuration flags is 0x%02x, HVAC manufacturer's ID is %d (0x%02x).\n", secondaryFlags, secondaryMemberIDCode, secondaryMemberIDCode); | |
| 58 | + Serial.println("Here is the meanining of each bit in these flags:"); | |
| 59 | + if(secondaryFlags & uint8_t(OpenTherm::HVAC_CONFIGURATION_FLAGS::SECONDARY_SYSTEM_TYPE)) Serial.println("HVAC system type set"); else Serial.println("HVAC system type cleared"); | |
| 60 | + if(secondaryFlags & uint8_t(OpenTherm::HVAC_CONFIGURATION_FLAGS::SECONDARY_BYPASS)) Serial.println("HVAC bypass enabled"); else Serial.println("HVAC bypass disabled"); | |
| 61 | + if(secondaryFlags & uint8_t(OpenTherm::HVAC_CONFIGURATION_FLAGS::SECONDARY_SPEED_CONTROL)) Serial.println("Speed control enabled"); else Serial.println("Speed control disabled"); | |
| 62 | + } else { | |
| 63 | + secondaryFlags = 0; | |
| 64 | + | |
| 65 | + if(thermostat.error() == OpenTherm::ERROR_CODES::UNKNOWN_DATA_ID) { | |
| 66 | + // Valid data is received but the for HVAC mandatory DATA-ID OpenTherm::READ_DATA_ID::HVAC_SECONDARY_CONFIGURATION is not recognised. This is not a HVAC but another device! | |
| 67 | + Serial.println("Your setup is working correctly but the remote device is not a HVAC."); | |
| 68 | + Serial.println("Look in EasyOpenTherm.h for the SECONDARY_CONFIGURATION or SOLAR_SECONDARY_CONFIGURATION\n DATA-ID and the corresponding primary and secondary flags."); | |
| 69 | + } else { | |
| 70 | + // No data or invalid data received | |
| 71 | + Serial.println("Your setup is not working yet. Please check:"); | |
| 72 | + Serial.println("Is the OpenTherm controller connected to the HVAC using two wires? The order of the wires is not important."); | |
| 73 | + Serial.println("Is the OpenTherm controller correctly powered? The GND pin should be connected to the GND pin of the\n microcontroller and the 3v3 pin to the 3v3 pin of the microcontroller."); | |
| 74 | + Serial.printf("Is the OpenTherm controller TxD pin connected to the microcontroller's Rx pin as specified by\n #define OT_RX_PIN? Currently this pin is defined as %d.\n", OT_RX_PIN); | |
| 75 | + Serial.printf("Is the OpenTherm controller RxD pin connected to the microcontroller's Tx pin as specified by\n #define OT_TX_PIN? Currently this pin is defined as %d.\n", OT_TX_PIN); | |
| 76 | + Serial.printf("Is the microcontroller's Tx pin (currently pin %d} not an 'input only' pin?\n", OT_TX_PIN); | |
| 77 | + Serial.printf("Is in your software the OpenTherm object defined as OpenTherm thermostat(OT_RX_PIN, OT_TX_PIN);\n Currently this expands to OpenTherm thermostat(%d, %d);\n", OT_RX_PIN, OT_TX_PIN); | |
| 78 | + Serial.println("\n"); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + // Wait 5 secs and try again | |
| 83 | + delay(5000); | |
| 84 | +} | ... | ... |