Jump to content
  • 1

AD2 Protocol UART Script - reading Vaillant eBus


Telemeter

Question

last days I wondered if our Vaillant heating boiler is working efficiently. Even when it was very cold outside it did not run continously. The temp rised up to a maximum, not using the minimum power possible, stopping the burner and waiting for cool down of the water. Then starting again - and again...  Sitting in front of the display and writing a protocol on paper for hours was not a solution for me. So I remembered that the system uses a eBus (twisted pair of wires) for communication between main control heater, temperature controller, outside temperature sensor and so on. And I have the AD2! So, I have built a small circuit on my bread board to convert the eBus signal in order to use it with the digital input of AD2. 1972004076_ebusinterface.thumb.png.82ee2272234fc1856ff133eb43acde98.png

 

Then I was forced to write my first JavaScript for the Protocol window of Waveforms.

After two nights of Analog Discovery I finally got some data in a readable way.

The fist night I spent for looking through the data flow coming out of the eBus lokking for some interesting information. I saved the UART window that had received for some 20 Minutes @ 2400 baud to file and filled the first Excel sheet column with the bytes (35000 rows). Most of the Bytes were decimal 170 or #aa that is the word SYN that is asking the eBus participants to start communications if they like to. By studying the data I found the places where the flow and flow return temperatures are hidden being sent every 10 s. I also found the date and time which is communicated about once a minute. So I decided to spend another night to write my first Script. Up to now I had some programming skills in FORTRAN, BASIC Assembler VB for (Excel and Access)) Here it is, my first Java script:

// This script receives data from Vaillant eBus (energy bus) and processes it

// Settings to 2400 Baud hexadecimal in Protocol window

clear()

if(!('Protocol' in this)) throw "Please open the Protocol instrument";

print("_____________")

print("receiving eBus data...")

do { // repeat infinite ** how can the user stop this? **

Protocol.Mode.text = "UART" // make sure UART tab is selected

Protocol.UART.Receiver(); // reset receiver - that is start receiving data

wait(9); // time to fill the buffer rx with some data

rx = Protocol.UART.ReceiveArray(); // put the data to array rx

// print ("test rx length = " + rx.length) ;

var e =""

var eWord = rx.shift(); // look in the array

eWord= eWord.toString(16); // use hex to compare and decide about the contents

do { var e = rx.shift(); // delete SYN words = #aa

eWord= e.toString(16); //

}

while ((eWord == "aa") && (rx.length > 10)) // check, still enough data in array?

if ((rx[1].toString(16) == "b5") && (rx[2].toString(16) == "11") && (rx[7].toString(16) == "9"))

{ // find the temperatures for displaying

print ("Temp 1: " + (rx[8]/2).toFixed(1) + " °C Temp 2: " + (rx[9]/2).toFixed(1) + " °C");

} // decimal data devided by 2 bring °Celsius

} while (1 == 1) // start from beginning

 

In the image you can see the result. I find: The result is G R E AT so far!!! 1986404412_ErgebnisVorlauf-Ruecklauf.thumb.png.ef0f78363eff7c7b6fcd847c6783c72d.png

374523692_eBusSYN.thumb.png.fe4627f01d1f49c9bec2fd0521fe6df6.png1708466477_eBusSignal.thumb.png.2c8c508ad6171557a06b1ed9b9fc97c4.png

My problem is, that I am not yet able to look through every Byte of the continuing data flow. I wait for 9 seconds filling the buffer rx and then I look through it and then start from the beginning - OK so far. But I could not manage to fill up my array rx with the next portion of data that was coming during the time after the first fill up. I also do not know how to manage console input during the time my script is running in order to influence the program without stopping the process of gathering and evaluating the incoming data.

Could anybody give me some help how to deal with this?

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Hi @Telemeter

Is the following what you are looking for ?

clear()
if(!('Protocol' in this)) throw "Please open the Protocol instrument";
Protocol.Mode.text = "UART" // make sure UART tab is selected
Protocol.UART.Receiver(); // reset receiver - that is start receiving data
var rx = []
while(wait(1)){ // wait 1 sec and repeat while not stopped
    rx = rx.concat(Protocol.UART.ReceiveArray()) // append new words
    while(rx.length>10){
        if(rx.shift()==0xAA) continue;
        if (rx[1] == 0xB5 && rx[2]== 0x11 && rx[7] == 0x09){ // find the temperatures for displaying
            print ("Temp 1: " + (rx[8]/2).toFixed(1) + " °C Temp 2: " + (rx[9]/2).toFixed(1) + " °C");
        } // decimal data devided by 2 bring °Celsius
    }
} 

 

Link to comment
Share on other sites

Hi Attila,

that code looks like being very good - and streamlined, also - thank You!!! I will try out very soon. Concat is what I could not find in the script documentation. Could you recommend, where to look up all about the Java keywords and functions that are availlable for use?

Update: The code runs perfectly!

Link to comment
Share on other sites

Hi attila,

thanks for providing additional infos. (I did not receive any notification upon your post, pls excuse my late reaction on it)

I could extend the functionality of the script to find date and time as well as the outside temperature out of the eBus of my heating boiler.

I am trying now to obtain information about the event of a pressed key on the keyboard while the script is running. Using your links I found some keywords like onkeydown or keycode but I am not able to use them so far. I would like to gain back control over the running script by pressing some keys on my keybord.

Are those functions or objects (onkeydown or keycode) availlable in the scripting tool of AD2, and if positive, could you give me a hint how to use them?

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...