Hallo,
wie finde ich den den letzten bzw. aktuellen Stand der KNX library?
Ist das hier https://bitbucket.org/thorstengehrig...m/src/default/ der aktuelle Stand?
Danke Euch.
Ankündigung
Einklappen
Keine Ankündigung bisher.
ARDUINO am KNX
Einklappen
X
-
Thank you for your advice!
I'll try to get the USB / KNX interface you mentioned and then I hope to find the problem soon.
Einen Kommentar schreiben:
-
Hi Mario,
for troubleshooting it's best to get a real KNX hardware and see what's happening on KNX. I recommend a USB interface and the ETS Demo. Maybe your School/University owns some hardware you can borrow.
With the confirmed working hardware you can analyze if the sender or the receiver is causing trouble and then troubleshoot further. Otherwise it's just guessing. Since your RX Led is blinking, there is physical activity on the bus, but you don't know if the transmitter is sending correct KNX data or just rubbish.
Einen Kommentar schreiben:
-
Hello guys!
First of all, I have to thank Thorsten for his work!
Secondly, I would like to apologize fot writing in English, but my German is very weak, especially technical German...
I would like to ask you for help with communicatin between two KNX devices...
In my diploma work (fig. 1) I use two KNX devices. Both consist of an Ardunio Nano controller and an Opternus TP-UART2 BOARD BTM2-PCB interface module.
I need to transfer two integer values (stav_tc, stav_osv) and two boolean values (tienenie_akt, tienenie_deakt) from one device - CONTROL PANEL to another - CONTROL UNIT.
CONTROL PANEL is situated inside the installation box under the push-buttons in "living room" (fig. 2).
CONTROL UNIT is situated in switchboard inside the DIN-rail mounted box in "technical room" (fig. 3).
Schemes of PCB's are available on: https://easyeda.com/mariobachorik/DP_Upravene
The problem is, that CONTROL PANEL is sending telegram to the bus (Ardunio Tx LED is blinking , fig. 4 - COM4 - reversed ? appears, when Arduino is sending telegram), but CONTROL UNIT can't read telegram from bus (Arduino Rx LED is blinking, but function serialEvent() is not activated).
My diploma work consultant recommended me to rename function serialEvent() to the handleSerial() and call it in the loop, for example:
void loop()
{
if(Serial.available())
handleSerial();
...
}
Unfortunately, this solution did not help me with my problem.
Below are the source codes of both devices.
Lines related to communication are marked with comment //KNX.
Any ideas, guys?
Thank you in advance for any idea...
Code used in CONTROL PANEL:
Code:#include <KnxTelegram.h> //KNX #include <KnxTpUart.h> //KNX #include <OneWire.h> #include <DallasTemperature.h> #include "U8glib.h" U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); float t_akt; float t_poz = 25; float t_kurenie; float t_chladenie; float t_kurenie_h; float t_chladenie_h; int id = 0; volatile int stav_tc = 0; //KNX volatile int stav_osv = 0; //KNX volatile bool tienenie_akt = false; //KNX volatile bool tienenie_deakt = false; //KNX const int tl_1 = 7; const int tl_2 = 8; const int tl_3 = 6; const int tl_4 = 4; const int tl_5 = 5; const int tl_6 = 3; const int t_senzor = 2; const int tpuart_reset = 13; //KNX char *str[] = {"NECINNE" , "KURENIE" , "CHLADENIE"}; OneWire oneWireDS(t_senzor); DallasTemperature senzoryDS(&oneWireDS); KnxTpUart knx(&Serial, "1.1.10"); //KNX void setup() { senzoryDS.begin(); pinMode(tl_1, INPUT_PULLUP); pinMode(tl_2, INPUT_PULLUP); pinMode(tl_3, INPUT_PULLUP); pinMode(tl_4, INPUT_PULLUP); pinMode(tl_5, INPUT_PULLUP); pinMode(tl_6, INPUT_PULLUP); pinMode(tpuart_reset, OUTPUT); //KNX digitalWrite(13, HIGH); //KNX delay(1000); digitalWrite(13, LOW); //KNX delay(1000); digitalWrite(13, HIGH); //KNX delay(1000); Serial.begin(19200, SERIAL_8E1); //KNX knx.uartReset(); //KNX delay(2000); } void loop() { senzoryDS.requestTemperatures(); t_akt = senzoryDS.getTempCByIndex(0); u8g.firstPage(); float t_kurenie = t_poz - 2; float t_chladenie = t_poz + 2; float t_kurenie_h = t_poz + 1; float t_chladenie_h = t_poz - 1; if (digitalRead(tl_1) == LOW && stav_osv >= 1){ id = 1; stav_osv = stav_osv - 1; knx.groupWrite1ByteInt("1/1/2", stav_osv); //KNX } if (digitalRead(tl_2) == LOW && stav_osv <= 2){ id = 2; stav_osv = stav_osv + 1; knx.groupWrite1ByteInt("1/1/2", stav_osv); //KNX } if (digitalRead(tl_3) == LOW){ id = 3; tienenie_akt = false; tienenie_deakt = true; knx.groupWriteBool("1/1/3", tienenie_akt); //KNX knx.groupWriteBool("1/1/4", tienenie_deakt); //KNX } if (digitalRead(tl_4) == LOW){ id = 4; tienenie_akt = true; tienenie_deakt = false; knx.groupWriteBool("1/1/3", tienenie_akt); //KNX knx.groupWriteBool("1/1/4", tienenie_deakt); //KNX } if (digitalRead(tl_5) == LOW && t_poz > 20){ t_poz = t_poz - 0.5; id = 5; } if (digitalRead(tl_6) == LOW && t_poz < 30){ t_poz = t_poz + 0.5; id = 6; } if (t_akt <= t_kurenie && stav_tc == 0){ stav_tc = 1; knx.groupWrite1ByteInt("1/1/1", stav_tc); //KNX } if (t_akt >= t_chladenie && stav_tc == 0){ stav_tc = 2; knx.groupWrite1ByteInt("1/1/1", stav_tc); //KNX } if (t_akt >= t_kurenie_h && stav_tc == 1){ stav_tc = 0; knx.groupWrite1ByteInt("1/1/1", stav_tc); //KNX } if (t_akt <= t_kurenie && stav_tc == 1){ stav_tc = 1; knx.groupWrite1ByteInt("1/1/1", stav_tc); //KNX } if (t_akt <= t_chladenie_h && stav_tc == 2){ stav_tc = 0; knx.groupWrite1ByteInt("1/1/1", stav_tc); //KNX } if (t_akt >= t_chladenie && stav_tc == 2){ stav_tc = 2; knx.groupWrite1ByteInt("1/1/1", stav_tc); //KNX } do { draw1(); } while (u8g.nextPage()); } void draw1(void){ u8g.setFont(u8g_font_profont10); u8g.setPrintPos(10, 18); u8g.print("TEPLOTA V MIESTNOSTI"); u8g.setPrintPos(0, 40); u8g.print("Aktualna:"); u8g.setPrintPos(65, 40); u8g.print(t_akt); u8g.setPrintPos(102, 40); u8g.print("st. C"); u8g.setPrintPos(0, 50); u8g.print("Pozadovana:"); u8g.setPrintPos(65, 50); u8g.print(t_poz); u8g.setPrintPos(102, 50); u8g.print("st. C"); u8g.setPrintPos(0, 60); u8g.print("Stav:"); u8g.setPrintPos(65, 60); u8g.print(str[stav_tc]); u8g.setPrintPos(120, 60); u8g.print(id); u8g.setPrintPos(55, 60); u8g.print(stav_osv); u8g.setPrintPos(0, 18); u8g.print(tienenie_akt); u8g.setPrintPos(120, 18); u8g.print(tienenie_deakt); }
Code used in CONTROL UNIT:
Code:#include <KnxTelegram.h> //KNX #include <KnxTpUart.h> //KNX #include <Servo.h> volatile int stav_tc = 0; //KNX volatile int stav_osv = 0; //KNX volatile bool tienenie_akt = false; //KNX volatile bool tienenie_deakt = false; //KNX const byte interruptPin = 2; const int rele_k = 4; const int rele_ch = 5; const int tpuart_reset = 13; //KNX Servo tienenie; KnxTpUart knx(&Serial, "1.1.11"); //KNX void setup(){ tienenie.attach(6); tienenie.write(90); pinMode(rele_k, OUTPUT); pinMode(rele_ch, OUTPUT); pinMode(2, INPUT_PULLUP); pinMode(3, OUTPUT); pinMode(tpuart_reset, OUTPUT); //KNX digitalWrite(13, HIGH); //KNX delay(1000); digitalWrite(13, LOW); //KNX delay(1000); digitalWrite(13, HIGH); //KNX delay(1000); Serial.begin(19200, SERIAL_8E1); //KNX knx.uartReset(); //KNX delay(1000); attachInterrupt(digitalPinToInterrupt(interruptPin ), detect_zero, RISING ); TCCR2A = _BV(COM2B0) | _BV(COM2B1) | _BV(WGM20) | _BV(WGM21); TCCR2B = _BV(CS22) | _BV(CS21) | _BV(CS20); OCR2B = 255; TCNT2 = 120; knx.addListenGroupAddress("1/1/1"); //KNX knx.addListenGroupAddress("1/1/2"); //KNX knx.addListenGroupAddress("1/1/3"); //KNX knx.addListenGroupAddress("1/1/4"); //KNX delay(1000); } void loop(){ if (tienenie_akt == false && tienenie_deakt == false){ tienenie.write(90); } if (tienenie_akt == false && tienenie_deakt == true){ tienenie.write(106); } if (tienenie_akt == true && tienenie_deakt == false){ tienenie.write(80); } if (tienenie_akt == true && tienenie_deakt == true){ tienenie.write(90); } if (stav_tc == 0){ digitalWrite(rele_k, LOW); digitalWrite(rele_ch, LOW); } if (stav_tc == 1){ digitalWrite(rele_ch, LOW); digitalWrite(rele_k, HIGH); } if (stav_tc == 2){ digitalWrite(rele_k, LOW); digitalWrite(rele_ch, HIGH); } if (stav_osv == 0){ OCR2B = 250; } if (stav_osv == 1){ OCR2B = 240; } if (stav_osv == 2){ OCR2B = 220; } if (stav_osv == 3){ OCR2B = 180; } } void detect_zero(){ TCNT2 = 120; } void serialEvent(){ //KNX KnxTpUartSerialEventType eType = knx.serialEvent(); if (eType != KNX_TELEGRAM) return; KnxTelegram* telegram = knx.getReceivedTelegram(); String target = String(0 + telegram->getTargetMainGroup()) + "/" + String(0 + telegram->getTargetMiddleGroup()) + "/" + String(0 + telegram->getTargetSubGroup()); if (telegram->getCommand() == KNX_COMMAND_WRITE){ if (target == "1/1/1"){ stav_tc = telegram->get1ByteIntValue(); } else if (target == "1/1/2"){ stav_osv = telegram->get1ByteIntValue(); } else if (target == "1/1/3"){ tienenie_akt = telegram->getBool(); } else if (target == "1/1/4"){ tienenie_deakt = telegram->getBool(); } } }You do not have permission to view this gallery.
This gallery has 4 photos.Zuletzt geändert von mariobachorik; 17.03.2020, 21:33.
Einen Kommentar schreiben:
-
Danke dreamy1
Dann werde ich mir wohl den Typ zulegen müssen. Immer diese Anfänger
;-)
Gruß
Bernhard
Einen Kommentar schreiben:
-
5WG1117-2AB12 ist das Zauberwort. So wie es im ersten Post geschrieben steht.
- Likes 1
Einen Kommentar schreiben:
-
Hi,
also selbst mit dem einfachen Script von raphaelhuber kann ich nicht auf den Bus senden, am Oszilloskop ist nichts zu sehen. Obwohl auf der Arduino Nano als auch beim Uno Seite die Pakte zu sehen sind.
Rx und TX habe ich schon mehrfach geprüft und für richtig befunden. Den Busankoppler habe ich auch schon gewechselt gegen einen neuen unbespielten. 5WG1 110-2AB02 und einen 5WG1 110-2AB01. ich glaube da mache ich etwas grundlegendes falsch.
Gibts da Einschränkungen der Busankoppler? Habt ihr da etwas gelesen oder gehört ?
Ich werde jetzt einfach einen aufbauen, der auf die gesendete Adresse hört und die LED ein und ausschaltet, wenn was über den Bus kommt.
Gruß
BernhardZuletzt geändert von boots; 15.03.2020, 16:38.
Einen Kommentar schreiben:
-
ja, alles was im Sketch programmiert ist (PA, GA(s), DPT) sollte auch in der ETS dokumentiert sein. Da geht (soweit mir bekannt) nichts zu automatisieren, ist also "zusätzliche Handarbeit", lohnt sich aber auf jeden Fall. Und wenn Du Deinen Sketch im Gruppenmonitor verfolgen willst, hilft es auch sehr gut weiter.Zitat von boots Beitrag anzeigennimmst du dann die Grp-Adresse aus dem Sketch oder eine andere?
Gruß Marco
- Likes 1
Einen Kommentar schreiben:
-
Danke Dreamy1 , sehr wichtiger Hinweis. Glatt überlesen.Zitat von dreamy1 Beitrag anzeigenDas auf der ersten Seite ist kein lauffähiger Code, u.a. muss dem UART noch even parity beigebracht werden. Schau mal in die Beispiele auf der verlinkten Seite im ersten Post, wo die Lib abliegt.
VG
Bernhard
Einen Kommentar schreiben:
-
Hi Marco, Danke.
nimmst du dann die Grp-Adresse aus dem Sketch oder eine andere?
Ich werde heute den Mega anschliessen, da der Nano Clone nicht funktioniert. Da kommt im Bus-Monitor immer nur "Schrei-Meldung". Sonst sehe ich nichts.
gruß
Bernhard
Einen Kommentar schreiben:
-
muss nichtZitat von boots Beitrag anzeigenmuss der Busankoppler in ETS eine Adresse bekommen?
. Es ist jedoch imho sehr sinnvoll, alle Geräte in der ETS anzulegen. Dazu nehme ich i.d.R. ein Dummy-Gerät. Darin kannst Du auch die verwendeten GAs einpflegen. So bleibt "alles" in der ETS sauber dokumentiert.
Gruß Marco
- Likes 1
Einen Kommentar schreiben:
-
Guten Morgen,
ich experinemtiere jatzt auch schon längere zeit mit KNX am Arduino.
Ich habe den Artikel denke ich komplett gelesen.
Trotzdem habe ich eine Frage: muss der Busankoppler in ETS eine Adresse bekommen?
Wenn ja, dann diese aus dem Sketch:
KnxTpUart knx(&Serial, "5.0.30");
Mit den nano nachbau komme ich auch nicht weiter, ich werde das ganze heute mit dem Mega testen.
Gruß
Bernhard
Einen Kommentar schreiben:
-
Hier mal Quick and dirty, das ganze LED-Geblinke kostet unnötige Zeit und sollte nach dem Debuggen entfernt werden...
Leider gehen die Einrückungen offenbar kaputt...
Code:// Geht auf NANO Original // Geht nicht auf Nano Nachbau // Geht auf Uno // Geht auf Pro Mini #include <KnxTpUart.h> KnxTpUart knx(&Serial, "1.1.199"); //Adresse des Geraetes int LED = 13; int target_6_6_1; int target_6_6_2; int target_6_6_3; int target_6_6_4; int target_2_2_5; void setup() { pinMode(LED, OUTPUT); // PIN 13 as output digitalWrite(LED, HIGH);delay(800);digitalWrite(LED, LOW);delay(800);digitalWrite(LED, HIGH);delay(800);digitalWrite(LED, LOW);delay(800); digitalWrite(LED, HIGH);delay(800);digitalWrite(LED, LOW);delay(800);digitalWrite(LED, HIGH);delay(800);digitalWrite(LED, LOW);delay(800); Serial.begin(19200, SERIAL_8E1); knx.uartReset(); knx.addListenGroupAddress("6/6/1"); knx.addListenGroupAddress("6/6/2"); knx.addListenGroupAddress("6/6/3"); knx.addListenGroupAddress("6/6/4"); knx.addListenGroupAddress("2/2/5"); // Optional: Abfragen der Werte bei Start delay(1000); knx.groupRead("6/6/1"); knx.groupRead("6/6/2"); knx.groupRead("6/6/3"); knx.groupRead("6/6/4"); } void loop() { } void serialEvent() { //Aufruf knx.serialEvent() KnxTpUartSerialEventType eType = knx.serialEvent(); //Evaluation of the received telegram -> only KNX telegrams are accepted if (eType == KNX_TELEGRAM) { KnxTelegram* telegram = knx.getReceivedTelegram(); digitalWrite(LED, HIGH); delay(100); digitalWrite(LED, LOW); delay(100); // Telegram evaluation on KNX (at reception always necessary) String target = String(0 + telegram->getTargetMainGroup()) + "/" + String(0 + telegram->getTargetMiddleGroup()) + "/" + String(0 + telegram->getTargetSubGroup()); // --------------------------------------------------------------- LESEANFRAGE BEANTWORTEN --------------------------------------------------------------------------- if (telegram->getCommand() == KNX_COMMAND_READ) { // Eine Leseanfrage mit der Bitte um Beantwortung if (target == "6/6/1") { target_6_6_1 = telegram->getBool(); // Wert in Variable speichern knx.groupAnswer1ByteInt("6/6/1", 126); // Anfrage beantworten } else if (target == "6/6/2") { target_6_6_2 = telegram->getBool(); // Wert in Variable speichern (ist das wirklich erforderlich?) knx.groupAnswer1ByteInt("6/6/1", 177); // Anfrage beantworten knx.groupRead("2/2/5"); // selbst eine Anfrage stellen } else if (target == "6/6/3") { target_6_6_3 = telegram->get1ByteIntValue(); } } // ---------------------------------------------------------- Selbst auf eine Antwort warten ----------------------------------------------------------------------- if (telegram->getCommand() == KNX_COMMAND_ANSWER) { if (target == "2/2/5") { target_2_2_5 = telegram->getBool(); if(target_2_2_5 == true) { knx.groupWriteBool("6/6/20", true); } else { knx.groupWriteBool("6/6/20", false); } } } // ----------------------------------------------------------- Nur mithören und reagieren -------------------------------------------------------------------------- if (telegram->getCommand() == KNX_COMMAND_WRITE) { if (target == "6/6/4") { target_6_6_4 = telegram->getBool(); if(target_6_6_4 == true) { digitalWrite(LED, HIGH); } else { digitalWrite(LED, LOW); } } } } }
- Likes 1
Einen Kommentar schreiben:
-
Kannst Du mal Deinen Sketch posten? Ich kriege lesen einfach nicht hin, weder mit UNO, noch mit Pro Mini noch mit Nano. Das Jumpern etc. habe ich alles probiert.Zitat von tooooooobi Beitrag anzeigenHier mal ein kurzer Zwischenstand, Lesen und Schreiben auf den Bus:
Klappt am UNO (mit dem Jumper)
Klappt am (original-) NANO (Ohne Jumper)
Klappt nicht am Nachbau-Nano (ch340g) - egal ob mit oder ohne Jumper
Hat jemand eine Idee wie sich die beiden Nanos unterscheiden? Liegt das am ch340g-Chip? Den Trick mit Pin 19 habe ich nicht probiert...
LG
Tobias
Einen Kommentar schreiben:


Einen Kommentar schreiben: