Victor-Mo / IRT-ESP

Nefit / Buderus iRT protocol encoder / decoder for ESP8266
GNU Lesser General Public License v3.0
22 stars 6 forks source link

iRT bus interpretation problem #14

Open grunz-ux opened 3 years ago

grunz-ux commented 3 years ago

Hi,

Nice work on figuring out the iRT protocol! I want to monitor my EcomLine Classic HRC30 UBA4000 (1997 o_0) with Moduline 300 thermostat so I made a circuit that listens to the bus using a series-resistor instead of parallel with the thermostat, should be more robust. See here; Capture

Results are good, this is what I get on the scope; index inde2x

So I've connected it to a pi and used minicom to read out the following messages;

02 03 00 01 01 fe 73 73 52 52 25 25 43 43 78 78 01 01 ff ff ad ad 01 01 46 46 25 25 19 19 73 73 52 52 25 25 43 43 78 78 07 07 ff ff a1 a1 07 07 4d 4d 00 00 9d 9d 

02 03 00 01 01 fe a4 a4 52 52 25 25 94 94 1f e0 a6 a6 01 01 ff ff 73 73 16 e9 a8 a8 46 46 25 25 b0 b0 40 bf a3 a3 52 52 25 25 93 93 53 ac 

02 03 00 01 01 fe 82 82 52 52 25 25 b2 b2 84 7b 83 83 01 01 ff ff 56 56 02 fd 93 93 46 46 25 25 8b 8b 00 ff 90 90 52 52 25 25 a0 a0 a7 58 c9 c9 07 07 ff ff 10 10 01 fe 

02 03 00 01 01 fe 97 97 52 52 25 25 a7 a7 03 fc 84 84 01 01 ff ff 51 51 55 aa 8a 8a 46 46 25 25 92 92 fe 01 73 73 52 52 25 25 43 43 78 78 06 06 00 00 74 74 02 03 00 01 01 fe 81 81 52 52 25 25 b1 b1 46 b9 de de 01 01 ff ff 0b 0b f7 08 73 73 52 52 25 25 43 43 78 78 05 05 04 04 62 62 05 05 04 04 00 00 0d 0d 

02 03 00 01 01 fe 73 73 52 52 25 25 43 43 78 78 01 01 ff ff ad ad 01 01 46 46 25 25 19 19 73 73 52 52 25 25 43 43 78 78 07 07 ff ff a1 a1 07 07 4d 4d 00 00 9d 9d 

02 03 00 01 01 fe a4 a4 52 52 25 25 94 94 1f e0 a6 a6 01 01 ff ff 73 73 16 e9 a8 a8 46 46 25 25 b0 b0 40 bf a3 a3 52 52 25 25 93 93 53 ac 

02 03 00 01 01 fe 82 82 52 52 25 25 b2 b2 84 7b 83 83 01 01 ff ff 56 56 02 fd 93 93 46 46 25 25 8b 8b 00 ff 90 90 52 52 25 25 a0 a0 a7 58 c9 c9 07 07 ff ff 10 10 01 fe 02

I didn't look into the telegrams in detail but in general they match your description. I tried to get your python converter running but no luck so far. I built your code and uploaded to a NodeMcu Lolin esp8266 v3, set tx mode to 4 but it doesn't interpret the telegrams correctly. Can you tell why?

* IRT-ESP version 1.9.10.20110420
[FS] System config loaded (510 bytes)
[FS] Custom config loaded (320 bytes)
[WEB] Web server started
[UART] Opened Rx/Tx connection (iRT)
[WIFI] Connecting to SSID: teh Interwebz...
[WIFI] Connected to SSID teh Interwebz (hostname: irt-esp, IP: 192.168.0.160)
[OTA] Listening to firmware updates on irt-esp.local:8266
[SYSTEM] Disabling serial port communication
[TELNET] Connected to IRT-ESP version 1.9.10.20110420. Type ? for commands.
log j

System Logging set to Jabber mode

->
(00:00:11.693) irt_rawTelegram: 01: F9
(00:00:11.811) irt_rawTelegram: 01: FF
(00:00:11.936) irt_rawTelegram: 02: FD FA
(00:00:11.936) irt_crcErr1: 02: FD FA
(00:00:12.071) irt_rawTelegram: 0B: 00 46 46 2B 2B 6D 6D 5E 5E 08 48
(00:00:12.072) irt_otherTelegram: 0B: 00 46 46 2B 2B 6D 6D 5E 5E 08 48
(00:00:12.090) irt_rawTelegram: 01: 7F
(00:00:12.108) irt_rawTelegram: 01: 00
(00:00:12.331) irt_rawTelegram: 14: 29 29 7F 7F 2E 2E 6D 6D 73 73 46 46 2B 2B 6D 6D 5E 5E 08 48
(00:00:12.332) irt_otherTelegram: 14: 29 29 7F 7F 2E 2E 6D 6D 73 73 46 46 2B 2B 6D 6D 5E 5E 08 48
(00:00:12.349) irt_rawTelegram: 01: 7C
(00:00:12.387) irt_rawTelegram: 01: 00
(00:00:12.431) irt_rawTelegram: 04: 2F 2F 7C 7C
(00:00:12.431) irt_otherTelegram: 04: 2F 2F 7C 7C
(00:00:12.452) irt_rawTelegram: 01: FE
(00:00:12.471) irt_rawTelegram: 01: E2
(00:00:12.793) irt_rawTelegram: 02: 7C FB
(00:00:12.793) irt_crcErr1: 02: 7C FB
(00:00:12.911) irt_rawTelegram: 01: F9
(00:00:13.031) irt_rawTelegram: 01: FF
(00:00:13.133) irt_rawTelegram: 02: FD FA
(00:00:13.134) irt_crcErr1: 02: FD FA
(00:00:13.310) irt_rawTelegram: 0F: 00 0B 8B 2B 2B 6D 6D 0D CD 01 21 16 16 7F 7F
(00:00:13.310) irt_otherTelegram: 0F: 00 0B 8B 2B 2B 6D 6D 0D CD 01 21 16 16 7F 7F
(00:00:13.347) irt_rawTelegram: 01: 00
(00:00:13.607) irt_rawTelegram: 17: 46 46 61 0F 05 C5 01 2E 6D 6D 02 52 01 11 2E 2E 2B 2B 6D 6D 36 36 7E
(00:00:13.608) irt_otherTelegram: 17: 46 46 61 0F 05 C5 01 2E 6D 6D 02 52 01 11 2E 2E 2B 2B 6D 6D 36 36 7E
l(00:00:13.911) irt_rawTelegram: 01: FB
(00:00:14.031) irt_rawTelegram: 01: F9
o(00:00:14.153) irt_rawTelegram: 01: FF
(00:00:14.255) irt_rawTelegram: 02: FD FA
(00:00:14.255) irt_crcErr1: 02: FD FA
g(00:00:14.429) irt_rawTelegram: 0F: 00 1F 1F 2B 2B 6D 6D 13 93 07 08 3E 3E 7F 7F
(00:00:14.430) irt_otherTelegram: 0F: 00 1F 1F 2B 2B 6D 6D 13 93 07 08 3E 3E 7F 7F
(00:00:14.467) irt_rawTelegram: 01: 00
(00:00:14.589) irt_rawTelegram: 0C: 2A AA 01 50 36 36 2E 2E 6D 6D 3A 3A
(00:00:14.589) irt_otherTelegram: 0C: 2A AA 01 50 36 36 2E 2E 6D 6D 3A 3A
 (00:00:14.630) irt_rawTelegram: 01: BE
(00:00:14.789) irt_rawTelegram: 0D: 63 05 2B 6D 6D 01 89 01 4A 03 1B 7C 7C
(00:00:14.789) irt_otherTelegram: 0D: 63 05 2B 6D 6D 01 89 01 4A 03 1B 7C 7C
(00:00:14.807) irt_rawTelegram: 01: 00
(00:00:14.831) irt_rawTelegram: 02: 07 F7
(00:00:14.831) irt_crcErr1: 02: 07 F7
n(00:00:14.846) irt_rawTelegram: 01: 00

System Logging set to None
Victor-Mo commented 3 years ago

Hi @grunz-ux ,

Very interesting project ! Because of issues #10 and #13 I have been doing some reverse engineering of the Moduline 300 thermostat. The moduline 300 has a discreet interface, the older modulines use a custom chip. I always assumed the iRT bus was very similar to the EMS bus. A current / voltage bus. But last week I came to the conclusion the iRT is a current loop only bus. (I feel a bit stupid not think of this earlier because also the Nefit service tool has a series connection...)

From what I could measure the bus is idle at 11 mA (serial mark state (1)). When the boiler wants to transmit the loop current is increased to 23 mA (serial space state (0)), if the thermostat wants to transmit the loop current is reduced to 3mA (serial space state (0)). Because the moduline 300 (and others) try to maintain +/- 5.5 Volt across their inputs it becomes very difficult to detect the signals as voltages.

I have been experimenting with an opto-coupler (ltv817) in line (series connection) with a moduline 300. That also seems to give very good results. But it needs some more tweaking because the current through the optocoupler is a bit high, causing the output to saturate.

I should remove the python scripts, they are for the EMS bus.

If I run the data you collect with the Pi through my test program it correctly decodes it, so the interface works !:

(00:00:06.857) irt_rawTelegram: 33: 01 01 FE 73 73 52 52 25 25 43 43 78 78 01 01 FF FF AD AD 01 01 46 46 25 25 19 19 73 73 52 52 25 25 43 43 78 78 07 07 FF FF A1 A1 07 07 4D 4D 00 00 9D 9D 
(00:00:06.857) : 01:46 07:4D 73:52 78:07   
(00:00:06.857) irt_rawTelegram: 2B: 01 01 FE A4 A4 52 52 25 25 94 94 1F E0 A6 A6 01 01 FF FF 73 73 16 E9 A8 A8 46 46 25 25 B0 B0 40 BF A3 A3 52 52 25 25 93 93 53 AC 
(00:00:06.857) : 01:46 07:4D 73:52 78:07 | A3:53 A4:1F A6:16 A8:40   -H
(00:00:06.857) irt_rawTelegram: 35: 01 01 FE 82 82 52 52 25 25 B2 B2 84 7B 83 83 01 01 FF FF 56 56 02 FD 93 93 46 46 25 25 8B 8B 00 FF 90 90 52 52 25 25 A0 A0 A7 58 C9 C9 07 07 FF FF 10 10 01 FE 
(00:00:06.857) : 01:46 07:4D 73:52 78:07 | 82:84 83:02 90:A7 93:00 A3:53 A4:1F A6:16 A8:40 C9:01   -H
(00:00:06.858) irt_rawTelegram: 31: 01 01 FE 97 97 52 52 25 25 A7 A7 03 FC 84 84 01 01 FF FF 51 51 55 AA 8A 8A 46 46 25 25 92 92 FE 01 73 73 52 52 25 25 43 43 78 78 06 06 00 00 74 74 
(00:00:06.858) : 01:46 07:4D 73:52 78:06 | 82:84 83:02 84:55 8A:FE 90:A7 93:00 97:03 A3:53 A4:1F A6:16 A8:40 C9:01   -H
(00:00:06.858) irt_rawTelegram: 2F: 01 01 FE 81 81 52 52 25 25 B1 B1 46 B9 DE DE 01 01 FF FF 0B 0B F7 08 73 73 52 52 25 25 43 43 78 78 05 05 04 04 62 62 05 05 04 04 00 00 0D 0D 
(00:00:06.858) : 01:46 05:04 07:4D 73:52 78:05 | 81:46 82:84 83:02 84:55 8A:FE 90:A7 93:00 97:03 A3:53 A4:1F A6:16 A8:40 C9:01 DE:F7   -H
(00:00:06.858) irt_rawTelegram: 33: 01 01 FE 73 73 52 52 25 25 43 43 78 78 01 01 FF FF AD AD 01 01 46 46 25 25 19 19 73 73 52 52 25 25 43 43 78 78 07 07 FF FF A1 A1 07 07 4D 4D 00 00 9D 9D 
(00:00:06.858) : 01:46 05:04 07:4D 73:52 78:07 | 81:46 82:84 83:02 84:55 8A:FE 90:A7 93:00 97:03 A3:53 A4:1F A6:16 A8:40 C9:01 DE:F7   -H
(00:00:06.858) irt_rawTelegram: 2B: 01 01 FE A4 A4 52 52 25 25 94 94 1F E0 A6 A6 01 01 FF FF 73 73 16 E9 A8 A8 46 46 25 25 B0 B0 40 BF A3 A3 52 52 25 25 93 93 53 AC 
(00:00:06.858) irt_rawTelegram: 36: 01 01 FE 82 82 52 52 25 25 B2 B2 84 7B 83 83 01 01 FF FF 56 56 02 FD 93 93 46 46 25 25 8B 8B 00 FF 90 90 52 52 25 25 A0 A0 A7 58 C9 C9 07 07 FF FF 10 10 01 FE 02 
EMS-ESP system stats:
  System logging set to Jabber
  LED is off, Listen mode is off
  Boiler is enabled, Thermostat is enabled, Solar Module is disabled, Mixing Module is disabled, Shower Timer is disabled, Shower Alert is disabled

EMS Bus stats:
  Bus is connected, protocol: Buderus
  Rx: # successful read requests=40, # CRC errors=0
  Tx: Last poll=0.500 seconds ago, # successful write requests=0

Boiler stats:
  Hot tap water: off
  Central heating: active
  Warm Water activated: on
  Warm Water selected temperature: 0 C
  Warm Water current temperature: 64.0 C
  Warm Water 3-way valve: off
  Selected flow temperature: 0 C
  Current flow temperature: 37.0 C
  Return temperature: 30.0 C
  Gas: on
  Boiler pump: on
  Fan: on
  Ignition: off

  System service code: -H (83)
  Heating temperature setting on the boiler: 70 C
  Outside temperature: 0.0 C

I think the reason it does not work in combination with the esp8266 is that I use the serial interface in inverted mode, But if you change line 13 in irtuart.h from: #define IRTUART_CONFIG_PASSIF (0x1C | (1 << UCRXI) ) // 8N1 (8 bits, no stop bits, 1 parity), invert Rxd to: #define IRTUART_CONFIG_PASSIF 0x1C) // 8N1 (8 bits, no stop bits, 1 parity)

and then recompile, it should work.

grunz-ux commented 3 years ago

Ah of course! Works like a charm now :)

First I made it with one comparator based on your original description that it does 10mA for 0 and 20mA for 1. Then I didn't get any proper telegrams so I had to get an oscilloscope and noticed that it's dual level.

The board is now connected to terminals 3 and 4 and I didn't have any problems with the thermostat (which has ~15m cable).

erhapp commented 3 years ago

Does this mean that the BBQ-Kees modified board can not be used?

Victor-Mo commented 3 years ago

@erhapp The BBQ Kees board can also be used. But there are a number of people that had problems getting it to work or needed to tweak the detection resistors. I am currently working on a optocoupler based interface. That is looking very good. I can now also actively send messages when the thermostat is still connected.

mletenay commented 1 year ago

Sorry for reviving an old ticket, but is there any progress with the optocoupler inteface ? Any schema I could try to build and test ? (I am more SW than HW guy, so I bought BBQKees' latest EMS interface board V3, started desoldering R5 only after that realizing it's completely different board design ...)

bbqkees commented 1 year ago

@mletenay the basic circuit of the V3 is almost the same but all the component numbers have changed. R5 is now R22. R5 on the V3 (which you removed incorrectly) is 360 Ohm and needs to be put back.

After you remove R22 from the V3 you then need to add a 1.5MOhm resistor from the non-ground pin of the R22 and to pin 2 of the IC.

(I have no plans to make a dedicated board for iRT.)

grunz-ux commented 1 year ago

image

You need no optocoupler interface since the insulation is in the UBA. The circuit above works reliable for listening to iRT.

Victor-Mo commented 1 year ago

@mletenay sorry for not replying earlier. I do not have much time for this project. One of the big issues when using opto-couplers is that there transfer characteristic varie wildly between opto's from the same series. So I could not design a circuit that will always perform the same. But I like the circuit that @grunz-ux has designed. It provide's some separation by means of the capacitors and is a clean and simple design.

I think the quickest way is what @bbqkees suggests. For most people that modification is enough to get a working system.

I do not think I will have any time soon to develop another working interface circuit. But i will try to free up some time to modify the documentation to at least indicate the different board types.

If @grunz-ux is okay with it I will also put his circuit in the documentation ?

mletenay commented 1 year ago

@Victor-Mo I understand, thanks a lot anyway. My initial attempts with modified bbqkees' board were not successful, so decided to give a try to grunz-ux design and coincidentally I just received my lm393s today. What I'm bit unsure is the final setup, do I got it right that the connection after R12 goes to RX on the esp8266 ? And sorry for another stupid question, the R3 is the resistance of the thermostat itself or should be added there ?

grunz-ux commented 1 year ago

@Victor-Mo sure, no problem.

Victor-Mo commented 1 year ago

@mletenay The connection after R12 goes to the RX input of the ESP. What I am not sure of if @grunz-ux is using the standard software or a modified one that does not invert the serial signal. (See my initial answer on this issue).

Th resistor R3 is not a 'real' resistor but it is the thermostat it self. I think it was just added for the simulation.

mletenay commented 1 year ago

So I have built the grunz-ux's interface, adjusted IRTUART_CONFIG_PASSIF and connected in series with ERC thermostat. I see some data which seem to resemble the protocol, but they are not decoded:

(00:30:12.821) irt_rawTelegram: 01: 01 
(00:30:12.941) irt_rawTelegram: 01: 02 
(00:30:13.041) irt_rawTelegram: 01: 03 
(00:30:13.161) irt_rawTelegram: 01: 00 
(00:30:13.281) irt_rawTelegram: 01: 01 
(00:30:13.381) irt_rawTelegram: 01: 02 
(00:30:13.501) irt_rawTelegram: 01: 03 
...
(00:30:15.621) irt_rawTelegram: 11: 01 FE 90 FF 21 C7 E5 BA 45 01 13 6F 82 07 CC 11 C2 
(00:30:15.621) irt_otherTelegram: 11: 01 FE 90 FF 21 C7 E5 BA 45 01 13 6F 82 07 CC 11 C2 
...
(00:30:21.098) irt_rawTelegram: 20: 01 FE 90 93 82 95 BA 45 82 DC 8A 39 B5 4A A3 C2 32 F6 5B A4 85 9B FD 75 04 FB 8A 27 42 D5 A6 59 
(00:30:21.099) irt_otherTelegram: 20: 01 FE 90 93 82 95 BA 45 82 DC 8A 39 B5 4A A3 C2 32 F6 5B A4 85 9B FD 75 04 FB 8A 27 42 D5 A6 59 
...
(00:30:26.296) irt_rawTelegram: 16: 01 FE 90 48 15 54 BA FF 45 73 52 25 43 78 04 00 70 04 00 4D 29 FF 
(00:30:26.297) irt_otherTelegram: 16: 01 FE 90 48 15 54 BA FF 45 73 52 25 43 78 04 00 70 04 00 4D 29 FF 
...

Any hint what could be wrong or where should I look ?

I have analyzed some telegrams "20", there are several versions of them and they repeat randomly. But all have similar structure of same and different [] triplets.

(00:45:57.404) irt_rawTelegram: 20: 01 FE 90 [5D 08 0A] BA 45 82 [7E DB 39] B5 4A A3 [A2 2D 4A] 5B A4 85 [48 FC CE] 04 FB 8A [6F 18 34] A6 59
(00:46:07.607) irt_rawTelegram: 20: 01 FE 90 [55 C0 11] BA 45 82 [9E 7B 52] B5 4A A3 [21 C7 D6] 5B A4 85 [FD 5D 0B] 04 FB 8A [5A 3E C6] A6 59
(00:46:18.089) irt_rawTelegram: 20: 01 FE 90 [88 BC 5B] BA 45 82 [B0 BD 3D] B5 4A A3 [0A 08 97] 5B A4 85 [19 99 E1] 04 FB 8A [16 00 A6] A6 59
(00:46:38.090) irt_rawTelegram: 20: 01 FE 90 [93 82 95] BA 45 82 [DC 8A 39] B5 4A A3 [C2 32 F6] 5B A4 85 [9B FD 75] 04 FB 8A [27 42 D5] A6 59
Victor-Mo commented 1 year ago

@mletenay It looks like it is only picking-up the boiler/UBA side of the data. The data from the thermostat is missing. So probably on of the comperator is not detecting the signal. A message should start with 01 01 FE, The first '01' is from the boiler indicating slot 1, the the thermostat indicates it wants to send with '01' and the boiler confirms with the inverse 'FE'. All most all bytes from the thermostats gets echo'ed by the boiler. So you should see a lot of duplicate bytes. For example: 01 01 FE 90 90 93 93 83 83 95 95 46 B9 .....

mletenay commented 1 year ago

Indeed ! It was my lousy soldiering, one comparator had cold joint on input. Now it works like a charm. There seem to be some unrecognized telegrams, but they may be my boiler/thermostat specific so I'm going to trace and decode them. But the basic stuff works and I can read the boiler state now. @Victor-Mo @grunz-ux Thank you guys for help and your great work !

Victor-Mo commented 1 year ago

Please share any messages, it is always interesting to get some new data. I tried to document the messages in the wiki: https://github.com/Victor-Mo/IRT-ESP/wiki/iRT-Telegram-Types