Page 13 of 39
Re: Toon as a domotica controller?
Posted: Sun Jan 17, 2016 12:02 pm
by marcelr
The ketelmodule translates requests from toon into OpenTherm-compliant commands for the boiler and vv. In the case of a bang-bang controlled boiler, it just switches the boiler on and off. No communication then, these boilers are just listeners.
The module operates more or less independent from toon; it just sends and receives data from the boiler at a preset rate (app. one datum every second), in a fixed sequence. As soon as toon sends or requests data, the latest values are passed through, in either direction. Everything is handled by an Atmel ATMega328 IIRC.
Data rates on the toon-side of the module can be much higher (limited by the 4800 baud serial IO).
Power supply of toon is 24VDC, indifferent for polarity. For testing, I used a small PLC power supply (24V, 1A), which is more than enough, toon's power uptake is just a few Watts.
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Sun Jan 17, 2016 3:58 pm
by cygnusx
I have a generic adapter here thats 24v 1,5amp max 36va. Would that work?
And how come the polarity doesnt matter, is it AC? Or does toon have a circuit which makes polarity not important?
And last, how does the ketelmodule communicatie with toon? Rf? Wifi? Modulation over the 24v just as opentherm?
Re: Toon as a domotica controller?
Posted: Sun Jan 17, 2016 6:54 pm
by marcelr
I have a generic adapter here thats 24v 1,5amp max 36va. Would that work?
Yes
And how come the polarity doesnt matter, is it AC? Or does toon have a circuit which makes polarity not important?
It's DC, and toon has simple circuitry to get the polarity right (a Graetz-bridge).
And last, how does the ketelmodule communicatie with toon? Rf? Wifi? Modulation over the 24v just as opentherm?
The last one. modulated serial I/O, 4800 baud, 8N1. I can get you the full terminal settings if you want them.
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Sun Jan 17, 2016 8:15 pm
by cygnusx
You think it would be difficult to make your own ketelmodule? In combination with a otgw? If someone can sniff the connection and find out what kind of Communications flows trough, you could mimic it. Or maybe even replace it with a Wifi serial connection now we have root access to toon?
I suppose that is where the ftdi is for in the toon? (I saw something like that in the boot information text)
Re: Toon as a domotica controller?
Posted: Sun Jan 17, 2016 11:28 pm
by marcelr
You think it would be difficult to make your own ketelmodule? In combination with a otgw?
I don't know, I'm not an expert in digital electronics. You could use an OTGW, without the "ketelmodule". Or find a ketelmodule on MP. Saw a request for one the other day, yours maybe? I wouldn't venture into a new design of such a module. It's not worth the effort. Better buy another second-hand toon with a module, faster and cheaper. Flog the toon without module afterwards (or keep it for testing).
If someone can sniff the connection and find out what kind of Communications flows trough, you could mimic it.
Already done. The I/O is fairly straightforward. Had to find a crc8 seed, the rest was plain sailing.
I suppose that is where the ftdi is for in the toon?
No, boiler I/O passes through one of the processor's UARTs (/dev/ttymxc1). Not sure what the ftdi drivers are used for, /dev/ttyUSB0 may be attached to a z-wave device, according to the config files (a device which, BTW, does not exist in the current version of toon).
small addition: You could intercept the I/O for the boiler, translate into OT commands for Schelte's OTGW, and transmit those to /dev/ttyUSB0 or similar. Maybe not a very elegant method, but feasible.
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Mon Jan 18, 2016 3:04 pm
by cygnusx
Could you post some raw communication data? And what was the crc8 seed? Since i don't have a ketelmodule i can't see any data flowing

I will try to create a boiler-bot just to play with the IO. If that works i think there is no problem to make a bridge to the OTGW.
Or i have to get my hands on a Ketelmodule, but as a not-customer of Eneco, i'm afraid my chances are slim!

Re: Toon as a domotica controller?
Posted: Mon Jan 18, 2016 8:58 pm
by marcelr
Could you post some raw communication data?
Yes, I could, but I have example code that actually works. You don't want to plough through megabytes of log data, FTFY.
It's written in plain old Kernighan and Ritchie C, please stick to that language if you want to add functionality. Not a lot else you can use in the openembedded tree anyway ...
Timing of the I/O is quite critical, so don't change these parameters unless you really need to (arguments of select() in a few spots).
Mind you, this is work in progress, so, much of the code posted today is not fully functional, hardly tested, and incomplete. No warranty whatsoever, if your toon burns down, along with your home, it wasn't me

.
If you have a working toon with boiler module, however, it will reset the module, get serial number etc., and set it to OpenTherm mode (if the boiler supports it).
(and possibly something else, but I don't remember exactly).
A full description of the protocol is in toon_OTGW.h (well, the stuff that I found so far).
Just run make (on a proper linux box, you will need some kernel code as well).
You may want to take a look at interceptty, a nice little utility to intercept and reroute serial I/O. Could be useful for redirecting toon's native commands to /dev/ttyUSB0 (or elsewhere), with a translation step to Schelte's OTGW. Used it myself for the initial tests on the protocol.
Good luck, and do post your progress!
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Tue Jan 19, 2016 11:22 am
by cygnusx
Looks good, but my C knowledge is limited. Hope to be able to do something with this.
But i don't fully understand the use of this software. What does it do at this moment? Does it communicate with the ketelmodule? Or with toon? And you run this software on Toon self?
Does it emulate a Ketelmodule?
And i thought there was also Python support builtin to the Toon image. I hoped to be able to build a python script to do this.
Re: Toon as a domotica controller?
Posted: Tue Jan 19, 2016 6:34 pm
by marcelr
It runs on toon, was compiled and linked in the openembedded tree, against toon's native kernel source and libraries. It talks to the boiler module and handles the responses of that module. No emulation, don't need it for myself, so haven't spent time on that. But when you read the protocols, it's fairly easy to implement (in K+R C

).
This is what it does so far:
If you have a working toon with boiler module, however, it will reset the module, get serial number etc., and set it to OpenTherm mode (if the boiler supports it).
(and possibly something else, but I don't remember exactly).
As such it forms the basis for direct boiler control (which is what I'm working on now, albeit slow). The protocol to do what toon natively does is there, just the sequence of steps hasn't been programmed yet. (I'm not interested in copying working code, that's already there and working).
I'm not sure about python. Haven't found python on my toon. I tried PHP for a short period of time, but it's too slow for proper serial IO with the boiler module.
In general you will find limited functionality in embedded systems. Toon is fairly well equipped, compared to other embedded systems. However, memory and disk space are limited, so don't expect a lot of fancy stuff in toon. From what I've seen so far, every piece of proprietary software is compiled C(++) code, linked against shared libraries, and stripped. Saves a lot of disk space. No python needed (and therefore not present).
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Tue Jan 19, 2016 10:19 pm
by cygnusx
Hm. Okay, well. There are alternatives. Interceptty could perhaps send the toon data to another serial port, maybe to the serial port we can use, or perhaps we can generate somekind of serial tunnel.
What i mean is something like this:
Opentherm Gateway -> Connected to Raspberry PI -> Connected via virtual serial to Toon.
Another alternative would be, designing a cirquit that does half of what the ketelmodule does. That is, splitting the serial data from the 24v. Powering the toon and providing a serial communication line for something like a raspberry pi, ESP8266, Arduino or maybe directly the OTGW.
While i'm writing. I think the last named option would be the best option for multiple reasons. Stability, and the possibility to write a good fake ketelmodule responder in Python or with Arduino code.
But, i'm lacking electronics skills in this. Someone who has some of these skills?
Next to that, i'm still looking for a good 24v adapter to see if my Toon actually works and play with the internals. Apparently the only 24v adapter i could find in my house does not work correctly...
Re: Toon as a domotica controller?
Posted: Wed Jan 20, 2016 9:12 am
by marcelr
Hm. Okay, well. There are alternatives. Interceptty could perhaps send the toon data to another serial port, maybe to the serial port we can use, or perhaps we can generate somekind of serial tunnel.
What i mean is something like this:
Opentherm Gateway -> Connected to Raspberry PI -> Connected via virtual serial to Toon.
You could also intercept the serial IO, send it to a network socket, pass it on to an OTGW through wifi and then do what needs to be done. Process reply data in reverse order and have it translated to serial stuff toon likes to see. That way you will end up with wireless control of your boiler, keep all functionality of toon, without fiddling around with a lot of software. The only thing you need is the interceptor/transceiver code (interceptty with some patching) and a small modification in the configuration files (another serial device instead of /dev/ttymxc1). Just grep for it and edit. Easy-peasy.
Again, I wouldn't venture into electronics design. Schelte's OTGW just works, for a fair price, hard to beat money- and time-wise.
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Wed Jan 20, 2016 9:42 am
by cygnusx
marcelr wrote:Hm. Okay, well. There are alternatives. Interceptty could perhaps send the toon data to another serial port, maybe to the serial port we can use, or perhaps we can generate somekind of serial tunnel.
What i mean is something like this:
Opentherm Gateway -> Connected to Raspberry PI -> Connected via virtual serial to Toon.
You could also intercept the serial IO, send it to a network socket, pass it on to an OTGW through wifi and then do what needs to be done. Process reply data in reverse order and have it translated to serial stuff toon likes to see. That way you will end up with wireless control of your boiler, keep all functionality of toon, without fiddling around with a lot of software. The only thing you need is the interceptor/transceiver code (interceptty with some patching) and a small modification in the configuration files (another serial device instead of /dev/ttymxc1). Just grep for it and edit. Easy-peasy.
Again, I wouldn't venture into electronics design. Schelte's OTGW just works, for a fair price, hard to beat money- and time-wise.
grtz,
marcelr
Yeah, think that would be the best solution. At least for now
When i get my toon working, i'll do my best to make that idea work!
Re: Toon as a domotica controller?
Posted: Wed Jan 20, 2016 2:11 pm
by cygnusx
Could you try to compile this package?:
http://sourceforge.net/projects/ser2net/
Since you have the complete toolchain set up.
Thx

Re: Toon as a domotica controller?
Posted: Wed Jan 20, 2016 4:09 pm
by marcelr
Will try tonight,
need to set up an oe recipe first, otherwise it won't work.
grtz,
marcelr
Re: Toon as a domotica controller?
Posted: Wed Jan 20, 2016 9:14 pm
by marcelr
Attached, unpack, upload to toon and:
Code: Select all
opkg install ser2net_2.9.1-r0_qb2.ipk
Not sure about dependencies.
grtz,
marcelr