• 0

AD2 Protocol UART Script - reading Vaillant eBus


Go to solution Solved by attila,

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?

 

Edited by Telemeter
typo
Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
  • Solution

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
    }
} 

 

Edited by attila
Link to post
Share on other sites
  • 0

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!

Edited by Telemeter
Test result added
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now