Ankündigung

Einklappen
Keine Ankündigung bisher.

ARDUINO am KNX

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • tuxedo
    antwortet
    So, hier die Screenshots zum Vergleich.... In grau der Arduino. In weiß meine MDT Wetterstation.

    Hatte mich nur in der Rückmeldung des eibd geirrt: In beiden Fällen kommt kein Fehler zurück. Die Konsole schweigt einfach. Aber wie man im Screenshot sehen kann, wird im Arduino-Fall gar kein Reset ausgelöst. Ich gehe davon aus dass die ACK Meldungen nicht rechtzeitig aufschlagen?!

    In beiden Fällen habe ich per eibd (mrestart local:/tmp/eib x.y.z) den Reset ausgeführt.

    Den modifizierten Stack und mein INO Projekt muss ich noch aufräumen. Hoffe ich schaffs diese Woche noch.

    Gruß
    Alex

    P.S. beim PA schreiben hapert's noch daran, dass der eibd ein memoryread auf adr=0060 haben will, meine arduino aber (noch) gar kein memory-read implementiert hat... Weiß jemand warum eibd da noch Adresse 0060 vom Gerät lesen will? Was sollte da stehen? hab hier noch keinen Vergleich mit einem echten KNX Gerät gemacht...
    Angehängte Dateien

    Einen Kommentar schreiben:


  • tuxedo
    antwortet
    Du hast auch den eibd verwendet? Hmm, komisch.

    Ich schau mal dass ich baldmöglichst meinen Stack-Umbau mal bereinige und hier online stelle...

    Einen Kommentar schreiben:


  • JuMi2006
    antwortet
    Ich habe sowohl Reset als PA erfolgreich am laufen. Hab es allerdings noch nicht mit normalen Geräten verglichen.

    Eigentlich warte ich mit meinem Shield auf deinen Stack um bestimmte pins für LED, Taster und Reset zu reservieren.

    Einen Kommentar schreiben:


  • tuxedo
    antwortet
    @Keldan2

    Beim groben überfliegen sieht's so aus als müsste das so funktionieren. Unterschätze aber den Aufwand nicht.

    @Rest
    Hat schon jemand mehr als nur Gruppenadressen lesen/schreiben mit der Lib gemacht?

    Hatte gestern wieder etwas Zeit zum basteln und hab mal programmieren der PA und Rücksetzen des Gerätes getestet (Basis ist das Codebeispiel zum programmieren der PA)

    PA setzen geht, aber es kommt zu einem Timeout. Die PA kam aber dennoch an und ist aktiv.
    Reset geht nicht. Kommt auch zum Timeout und Reset wird erst gar nicht ausgeführt.

    Losgetreten habe ich die Befehle (bis jetzt noch) per eibd.

    Wenn ich beide Aktionen mit einem Nicht-Arduino-Gerät probiere und den ETS Busmonitor-Mitschnitt beider Geräte (Arduoino+NichtArduino), dann sieht man, dass die ACK Meldungen nicht den selben Ablauf haben.

    Sieht so aus, als würde die Arduino-Implementierung das eine oder andere ACK Paket unterschlagen bzw. erst gar nicht senden.

    Screenshots kann ich noch nachliefern...

    Hat hier schon jemand Erfahrungen sammeln können?

    Einen Kommentar schreiben:


  • keldan2
    antwortet
    Einstieg mit ersten Projekt RFID

    Hallo Kollegen,

    da mein FP von Conrad aufgrund seiner Unzuverlässigkeit, Trägheit nervt habe ich mich auf die Suche nach einem Codeschloss RFID / Code gemacht.

    Verliebt habe ich mich mittlerweile in diese Ausseneinheit,

    Zutrittskontrolle stouch & sKey von Sebury, jetzt bei I-KEYS · RFID-Technik

    und ich würde ungern wieder davon Abstand nehmen.

    Um das ganze sicher im Inneren auszuwerten - so weit wie möglcih manipulationssicher zu machen- setzt hier der Hersteller auf die Wiegandschnittstelle. Hierzu werden vom Hersteller selber auch eigene Türconverter angeboten.

    Beim Googeln bin ich auf zwei interessante Links gestossen bei denen mein Wunsch-Codeschloss (s.o.) mit einem Arduino zur Auswertung der Wiegand genutzt wird.

    Teil 1-3:
    https://blog.thesen.eu/teil-1-rfid-c...-cac-cft-1000/

    Wiegand-26 Schnittstelle

    Da ich bislang noch nicht alles hier gelesen habe (echt viel...) und ich noch keine Berührung mit nem Arduino hatte->
    Ist es möglich das o.g.Codeschloss mittels Arduino und Auswertung im KNX (HS3) zu nutzen - oder würdet ihr mir davon abraten?

    Also mit meinem Laienverständnis würde ich sagen. Ich benötige

    -Sebury sTouch Standalone
    -Arduino Nano
    -Siemens BCU
    -und viel Zeit und Muße

    Kosten ca.130€

    LG und vielen Dank für eure Hilfe
    Daniel

    Einen Kommentar schreiben:


  • ThorstenGehrig
    antwortet
    Hi
    @simml: dein "Hautfehler" war das du die "alte" Befehlsweise genutzt hast!
    Du hattest: KnxTpUart knx(&Serial1, 15, 15, 20);
    Vetos Beispiel ist: KnxTpUart knx(&Serial1, "1.1.7");

    Der Unterschied sollte zu finden sein :-) (mir ist klar das es in 100000 Seiten dieses Threads leicht übersehen wird - müsste aber so in den Beispielscodes des Forks richtig drinnen sein).

    SIM-KNX ist, wenn ich richtig informiert bin, ein Serial-KNX-Interface, richtig?
    Das wird mit dieser Library nicht funktionieren. Diese Library ist eher dafür gedacht das SIM-KNX nicht benötigt wird (ein einfacher TP-UArt, 30€, siehe Threadanfang - reicht vollkommen, was anderes wird aber auch nicht unterstützt)

    Gruß
    Thorsten

    Einen Kommentar schreiben:


  • Simml
    antwortet
    Hätte da noch eine kurze Frage. Ich benutze momentan SIM-KNX, kann ich mit der KnxTpUart library da ohne probleme arbeiten?

    Aktuell bin ich ein bisschen verwundert was da alles bei dem Beispielsketch "ReceiveKNXTelegrams" im seriellen Monitor daher kommt wenn ich einen Taster drücke. So schaut das momentan nach einem Tastendruck aus, dabei will ich eigentlich nur einer Variablen den Boolschen Wert des Tasters zuweisen:

    Code:
    TP-UART Test
    UCSR1A: 100010
    UCSR1B: 10011000
    UCSR1C: 100110
    Incoming Byte: 96 - 60 - 1100000
    Available: 2
    Incoming Byte: 96 - 60 - 1100000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 63
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 120 - 78 - 1111000
    Available: 62
    Frame Error
    Incoming Byte: 120 - 78 - 1111000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Available: 61
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 60
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 59
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Available: 58
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 57
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 56
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 55
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 54
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 53
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 52
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 51
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 50
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Payload Length: 9
    Available: 49
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 48
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 47
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 46
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 45
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 44
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 43
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 42
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 41
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 40
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Repeated: 1
    Priority: 2
    Source: 1.8.152
    Target Physical: 1.8.24
    Routing Counter: 1
    Payload Length: 9
    Command: 0
    First Data Byte: 24
    Data Byte 2: 11000
    Data Byte 3: 10011000
    Data Byte 4: 11000
    Data Byte 5: 11000
    Data Byte 6: 11000
    Data Byte 7: 0
    Data Byte 8: 11000
    Checksum mismatch
    10011000
    1100111
    Event IRRELEVANT_KNX_TELEGRAM
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Available: 39
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 38
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 37
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 36
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 35
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 34
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 33
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 32
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 230 - E6 - 11100110
    Available: 31
    Frame Error
    Incoming Byte: 230 - E6 - 11100110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 96 - 60 - 1100000
    Available: 30
    Frame Error
    Incoming Byte: 96 - 60 - 1100000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 29
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 120 - 78 - 1111000
    Available: 28
    Frame Error
    Incoming Byte: 120 - 78 - 1111000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Available: 27
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 26
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 25
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Available: 24
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 23
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Available: 22
    Frame Error
    Incoming Byte: 6 - 6 - 110
    Event UNKNOWN
    Event UNKNOWN
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 21
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 20
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 19
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 18
    Frame Error
    Incoming Byte: 120 - 78 - 1111000
    Available: 17
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 16
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Payload Length: 9
    Available: 15
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 14
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 13
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 12
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 11
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 10
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 9
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 8
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 7
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 6
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Repeated: 1
    Priority: 2
    Source: 1.8.24
    Target Physical: 7.8.0
    Routing Counter: 1
    Payload Length: 9
    Command: 0
    First Data Byte: 0
    Data Byte 2: 10011000
    Data Byte 3: 11000
    Data Byte 4: 11000
    Data Byte 5: 11000
    Data Byte 6: 11000
    Data Byte 7: 11000
    Data Byte 8: 0
    Checksum mismatch
    11000
    10011111
    Event IRRELEVANT_KNX_TELEGRAM
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 5
    Frame Error
    Incoming Byte: 152 - 98 - 10011000
    Available: 4
    Frame Error
    Incoming Byte: 134 - 86 - 10000110
    Available: 3
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 2
    Frame Error
    Incoming Byte: 24 - 18 - 11000
    Available: 1
    Frame Error
    Incoming Byte: 0 - 0 - 0
    Available: 0
    Timeout while receiving message
    Payload Length: 16
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Available: 0
    Timeout while receiving message
    Repeated: 1
    Priority: 2
    Source: 8.6.24
    Target Group: 3/0/0
    Routing Counter: 7
    Payload Length: 16
    Command: 15
    First Data Byte: 63
    Data Byte 2: 11111111111111111111111111111111
    Data Byte 3: 11111111111111111111111111111111
    Data Byte 4: 11111111111111111111111111111111
    Data Byte 5: 11111111111111111111111111111111
    Data Byte 6: 11111111111111111111111111111111
    Data Byte 7: 11111111111111111111111111111111
    Data Byte 8: 11111111111111111111111111111111
    Data Byte 9: 11111111111111111111111111111111
    Data Byte 10: 11111111111111111111111111111111
    Data Byte 11: 11111111111111111111111111111111
    Data Byte 12: 11111111111111111111111111111111
    Data Byte 13: 11111111111111111111111111111111
    Data Byte 14: 11111111111111111111111111111111
    Data Byte 15: 11111111111111111111111111111111
    Checksum mismatch
    11111111111111111111111111111111
    11111111111111111111111100011110
    NCD Telegram 15 received
    Available: 0
    Timeout while receiving message
    Event IRRELEVANT_KNX_TELEGRAM

    Einen Kommentar schreiben:


  • Simml
    antwortet
    Habe das Problem jetzt durch folgende zwei Schritte lösen können:

    1) Update der IDE von 1.0.6 auf 1.6.0
    2) Die zwei header Dateien gemäß Thorstens Post modifizieren: https://bitbucket.org/dka/arduino-tp...es-not-compile

    Danke für die Mithilfe,

    Viele Grüße,
    Simon

    Einen Kommentar schreiben:


  • vento66
    antwortet
    Bei mir schaut das so aus:
    Code:
      #include <KnxTelegram.h>
      #include <KnxTpUart.h>
      #include <SPI.h>
      #include <PN532_SPI.h>
      #include "PN532.h"
    
      PN532_SPI pn532spi(SPI, 10);
      PN532 nfc(pn532spi);
    
    //Initialize the KNX TP-UART library on the Serial1 port of Arduino Mega
    KnxTpUart knx(&Serial1, "1.1.7");
    
      const int green = 13;    // LED connected to digital pin 9
      const int red = 12;     // LED connected to digital pin 10
      const int blue = 11 ;    // LED connected to digital pin 11
      // Remember if we have sent on current keypress
    
      long letzteMillis = 0; // initialisiere Variable fuer den Zeitpunkt der letzten LED-Aktualisierung
      long intervall = 2000;         //  Intervall, für die nächste Abfrage
      boolean value = LOW;
      
    void setup() {
      Serial1.begin(19200);
      UCSR1C = UCSR1C | B00100000; // Even Parity
      knx.uartReset();
      knx.addListenGroupAddress("8/0/9"); //16393 BS Voll
      knx.addListenGroupAddress("8/0/10"); //16394 Door open
      knx.addListenGroupAddress("8/0/11"); //16395 fail
      knx.addListenGroupAddress("8/0/12"); //16396 Prog Mode
      knx.addListenGroupAddress("8/0/13"); //16397 store/del OK
      knx.addListenGroupAddress("8/0/14"); //16398 gesperrt
    .....

    Einen Kommentar schreiben:


  • Simml
    antwortet
    Hallo, Danke für die schnelle Rückmeldung.
    Hab nen Arduino Mega 2560 und hab den auch ausgewählt. Wenn ich anstatt Serial1 Serial eintrage gehts leider auch nicht .

    Einen Kommentar schreiben:


  • vento66
    antwortet
    Welchen Arduino hast Du, was für ein Board ist eingestellt? Nicht alle haben eine Serial1. Die serial Schnitstellen fangen bei "serial" an. Serial1 ist dann die 2.Schnittstelle.

    Einen Kommentar schreiben:


  • Simml
    antwortet
    Hallo zusammen,

    Versuche gerade ein einfaches Beispiel zu kompilieren. Allerdings scheiterts momentan an KnxTpUart knx(&Serial1, 15, 15, 20);:

    Code:
    #include <KnxTpUart.h>
    
    // Initialize the KNX TP-UART library on the Serial1 port of Arduino Mega
    // and with KNX physical address 15.15.20
    KnxTpUart knx(&Serial1, 15, 15, 20);
    
    void setup() {
      Serial.begin(9600);
      Serial.println("TP-UART Test");  
    
      Serial1.begin(19200);
      UCSR1C = UCSR1C | B00100000; // Even Parity
    
      Serial.print("UCSR1A: ");
      Serial.println(UCSR1A, BIN);
    
      Serial.print("UCSR1B: ");
      Serial.println(UCSR1B, BIN);
    
      Serial.print("UCSR1C: ");
      Serial.println(UCSR1C, BIN);
    
      knx.uartReset();
    }
    
    
    void loop() {
    }
    
    void serialEvent1() {
      KnxTpUartSerialEventType eType = knx.serialEvent();
      if (eType == TPUART_RESET_INDICATION) {
         Serial.println("Event TPUART_RESET_INDICATION"); 
      } else if (eType == UNKNOWN) {
        Serial.println("Event UNKNOWN");
      } else if (eType == KNX_TELEGRAM) {
         Serial.println("Event KNX_TELEGRAM");
         KnxTelegram* telegram = knx.getReceivedTelegram();
         
         // Here you have the telegram and can do whatever you want
      }
    }
    "no matching function for call to 'KnxTpUart::
    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.
    Arduino: 1.0.6 (Windows 7), Board: "Arduino Mega 2560 or Mega ADK"
    In file included from C:\Users\Simon\Documents\Arduino\libraries\TP_UART _Library/KnxTpUart.h:8,
    from sketch_feb21a.ino:1:
    C:\Users\Simon\Documents\Arduino\libraries\TP_UART _Library/KnxTelegram.h:92: error: 'Serial_' has not been declared
    In file included from sketch_feb21a.ino:1:
    C:\Users\Simon\Documents\Arduino\libraries\TP_UART _Library/KnxTpUart.h:38: error: expected `)' before '*' token
    sketch_feb21a:5: error: no matching function for call to 'KnxTpUart::KnxTpUart(HardwareSerial*, int, int, int)'
    C:\Users\Simon\Documents\Arduino\libraries\TP_UART _Library/KnxTpUart.h:36: note: candidates are: KnxTpUart::KnxTpUart()
    C:\Users\Simon\Documents\Arduino\libraries\TP_UART _Library/KnxTpUart.h:36: note: KnxTpUart::KnxTpUart(const KnxTpUart&)

    Den Port scheints ja zu geben. Hat jemand eine Idee worans liegen könnte? Habe bisher ja eigentlich nur die Library runtergeladen und versucht ein Beispiel zu kompilieren...

    Danke und viele Grüße,
    Simon

    Einen Kommentar schreiben:


  • sten123
    antwortet
    Hi,

    ich verwende Thorstens Fork vom arduino-tpuart mit dem Siemens Busankoppler um den Füllstand der Zisterne auszulesen. Ich nutze die Funktionen groupWriteBool() und groupWrite4ByteFloat() um Messwerte und Steuerungsinformationen auf den KNX-Bus zu senden. Das funktioniert aber bei mir nicht zuverlässig, ich habe immer wieder Situationen wo Bool- oder Float-Telegramme verloren gehen, obwohl ich den Rückgabewert der Funktionen auswerte und das Senden im Fehlerfall bis zu 3 mal wiederhole.

    Kennt jemand diesen Effekt?

    Viele Grüße

    Sten

    Einen Kommentar schreiben:


  • JuMi2006
    antwortet
    Zitat von tuxedo Beitrag anzeigen
    Wäre es nicht flexibler/besser das über den Visu-PC zu lösen ?
    Nein,
    Zitat von tuxedo Beitrag anzeigen
    (außer man braucht die Ansage in Visu-abgelegene Räumen)
    genau deswegen.

    @Thorsten:

    Eigentlich ganz simpel die SD-Karte anschließen und einen BC546B als Verstärker. Das tun auch andere ... hatte zuerst auch "irgend einen" angeschlossen.
    Als Librarys lediglich noch TMRpcm und SD. Lediglich mit 3.3V/8Mhz hab ich die Files noch nicht abspielen können (nur halbe Geschwindigkeit ).

    Was ich noch suche sind passende Lautsprecher. Also irgendwas das von der Leistung passt und die man an die Blindabdeckung des Schalterprogrammes kleben kann. Ich wollte da eigentlich nicht noch eine "richtige" Verstärkerschaltung basteln.

    Das ist hier aber nur ein kurzer Test ob es wirklich funktioniert. Die Steckbrettvariante .
    Code:
    /*
      SD card basic file example
     
     This example shows how to create and destroy an SD card file 	
     The circuit:
     * SD card attached to SPuI bus as follows:
     ** UNO:  MOSI - pin 11, MISO - pin 12, CLK - pin 13, CS - pin 4 (CS pin can be changed)
      and pin #10 (SS) must be an output
     ** Mega:  MOSI - pin 51, MISO - pin 50, CLK - pin 52, CS - pin 4 (CS pin can be changed)
      and pin #52 (SS) must be an output
     ** Leonardo: Connect to hardware SPI via the ICSP header
    
     created   Nov 2010 by David A. Mellis
     modified 9 Apr 2012 by Tom Igoe
     modified 13 June 2012 by Limor Fried
     
     This example code is in the public domain.
     	 
     */
    #include <SPI.h>
    #include <SD.h>
    #include <TMRpcm.h>           //  also need to include this library...
    #include <KnxTpUart.h>
    
    // Initialize the KNX TP-UART library on the Serial1 port of Arduino Mega
    KnxTpUart knx(&Serial1, 15, 15, 20);
    
    // Initialize Audio
    TMRpcm audio;   // create an object for use in this sketch
    
    void setup()
    {
      // KNX-RELATED
      Serial1.begin(19200);
      UCSR1C = UCSR1C | B00100000; // Even Parity
      knx.uartReset();
      knx.addListenGroupAddress(0,0,3);
      
      // AUDIO RELATED
      audio.speakerPin = 10; //11 on Mega, 9 on Uno, Nano, etc
    
      // SERIAL RELATED
      // Open serial communications and wait for port to open:
      Serial.begin(9600);
       while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
      }
    
      // SD-CARD RELATED
      // change this to match your SD shield or module;
      //     Arduino Ethernet shield: pin 4
      //     Adafruit SD shields and modules: pin 10
      //     Sparkfun SD shield: pin 8
      const int chipSelect = 4;
      
      File root;
      Serial.print("Initializing SD card...");
      // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
      // Note that even if it's not used as the CS pin, the hardware SS pin 
      // (10 on Arduino Uno boards, 53 on the Mega) must be left as an output 
      // or the SD library functions will not work. 
      pinMode(SS, OUTPUT);
    
      if (!SD.begin(chipSelect,7,6,5)) { //SD.begin(ChipSelect, MOSI, MISO, CLK)
        Serial.println("initialization failed!");
        return;
      }
      Serial.println("initialization done.");
      root = SD.open("/");
      
      //DEBUG RELATED
      printDirectory(root, 0);
    }
    
    void loop()
    { 
      //knx-test
      //bool success = knx.groupWriteBool(0,0,3, true);
    }
    
    //KNX RELATED STUFF
    void serialEvent1() {
      KnxTpUartSerialEventType eType = knx.serialEvent();
      if (eType == KNX_TELEGRAM) {
         Serial.println("Event KNX_TELEGRAM");
         KnxTelegram* telegram = knx.getReceivedTelegram();
         int value = telegram->get1ByteIntValue();
         String val_string = String(value);
         Serial.println(val_string);
        
        Serial.println("Start play " + val_string + ".WAV");
        //audio.quality(1); 
        audio.setVolume(1); // 5 = max
        String f1 = val_string;
        String f2 = ".WAV";
        String filename = f1 + f2;
        Serial.println(filename);
        char audio_filename[filename.length() + 1];
        filename.toCharArray(audio_filename, filename.length() + 1); 
        audio.play(audio_filename); //the sound file need to be char
         
      }
    }
    
    // JUST PRINT SD-CARD TO SERIAL FOR DEBUG
    void printDirectory(File dir, int numTabs) {
      // Begin at the start of the directory
      dir.rewindDirectory();
      
      while(true) {
         File entry =  dir.openNextFile();
         if (! entry) {
           // no more files
           Serial.println("**nomorefiles**");
           break;
         }
         for (uint8_t i=0; i<numTabs; i++) {
           Serial.print('\t');   // we'll have a nice indentation
         }
         // Print the 8.3 name
         Serial.print(entry.name());
         // Recurse for directories, otherwise print the file size
         if (entry.isDirectory()) {
           Serial.println("/");
           printDirectory(entry, numTabs+1);
         } else {
           // files have sizes, directories do not
           Serial.print("\t\t");
           Serial.println(entry.size(), DEC);
         }
         entry.close();
       }
    }

    Einen Kommentar schreiben:


  • tuxedo
    antwortet
    Zitat von JuMi2006 Beitrag anzeigen
    Bei mir liegt gerade ein Board auf dem Tisch das mir Sprachansagen per GA macht. Per Steckbrett funktionierts schon. Die Daten werden als .wav auf micro-SD gespeichert und dann per GA abgerufen, ganz simpel per Szenennummer ... 1 spielt 1.wav, 2 spielt 2.wav usw..
    Wäre es nicht flexibler/besser das über den Visu-PC zu lösen (außer man braucht die Ansage in Visu-abgelegene Räumen)?

    Einen Kommentar schreiben:

Lädt...
X