sonstiges:tuerklingel
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungNächste ÜberarbeitungBeide Seiten der Revision | ||
sonstiges:tuerklingel [2015-02-14 11:07] – [Pinout] breti | sonstiges:tuerklingel [2023-09-29 21:58] – [Empfänger mit Netzteil versorgen] schuballaa | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Türklingel ====== | ====== Türklingel ====== | ||
+ | |||
===== Übersicht ===== | ===== Übersicht ===== | ||
Zeile 6: | Zeile 7: | ||
Es wurde eine Möglichkeit gefunden, das Klingelsignal abzugreifen und in die Räume Bornstr. 16-17 zu verlängern (E- und Kreativwerkstatt). | Es wurde eine Möglichkeit gefunden, das Klingelsignal abzugreifen und in die Räume Bornstr. 16-17 zu verlängern (E- und Kreativwerkstatt). | ||
+ | |||
+ | **Optional: | ||
+ | |||
+ | Es könnte zu jeder zeit an sender und oder Empfängern eine Li-ion Akku (via JST) angeschlossen werden und somit auch mobil betrieben werden z.b bei Veranstaltungen die im Hinnenhof stattfinden um kein Klingeln zu verpassen. | ||
+ | |||
+ | **Achtung bei Powerbanks!** | ||
+ | |||
+ | Da sich die meisten Powerbanks bei geringer Last ausschalten, | ||
+ | |||
===== Sprechanlage ===== | ===== Sprechanlage ===== | ||
- | Die Sprechanlage nutzt ein 2-Draht-Bussystem vom Typ STK QwikBus, welches die Türsprechstelle mit den Haustelefonen verbindet. Daher ist es nicht möglich, das Klingelsignal direkt abzugreifen, | + | Die Sprechanlage nutzt ein 2-Draht-Bussystem vom Typ [[http:// |
Das Haustelefon ist vom Typ STR HT 3033. | Das Haustelefon ist vom Typ STR HT 3033. | ||
+ | Das Steuergerät ist ein SP 333 ({{: | ||
===== Pinout ===== | ===== Pinout ===== | ||
Zeile 26: | Zeile 37: | ||
===== Funk-Türklingel ===== | ===== Funk-Türklingel ===== | ||
- | Da uns keine Leitung zwischen den Räumen Bornstr. 14-15 sowie 16-17 zur Verfügung steht, mussten wir auf eine [[http:// | + | Da uns keine Leitung zwischen den Räumen Bornstr. 14-15 sowie 16-17 zur Verfügung steht, mussten wir auf eine [[http:// |
+ | |||
+ | Wenn geklingelt wird, zieht ein n channel mosfet den Pin 4 des [[https:// | ||
===== Sender in Haustelefon einbauen ===== | ===== Sender in Haustelefon einbauen ===== | ||
- | Der Sender | + | Der Sender |
+ | |||
+ | {{https:// | ||
+ | |||
+ | |||
+ | ===== Sourcecode ===== | ||
+ | |||
+ | Sender: | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | // Set your new MAC Address\\ | ||
+ | uint8_t newMACAddress[] = {0x30, 0xAF, 0xA0, 0x05, 0x1D, 0x63}; | ||
+ | |||
+ | // REPLACE WITH YOUR ESP RECEIVER' | ||
+ | uint8_t broadcastAddress1[] = {0x30, 0xAF, 0xA1, 0x05, 0x1D, 0x63};\\ | ||
+ | uint8_t broadcastAddress2[] = {0x30, 0xAF, 0xA2, 0x05, 0x1D, 0x63}; | ||
+ | |||
+ | typedef struct bell_struct {\\ | ||
+ | uint64_t trigger; | ||
+ | } bell_struct; | ||
+ | |||
+ | bell_struct bell; | ||
+ | |||
+ | esp_now_peer_info_t peerInfo; | ||
+ | |||
+ | // callback when data is sent\\ | ||
+ | void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {\\ | ||
+ | char macStr[18]; | ||
+ | Serial.print(" | ||
+ | // Copies the sender mac address to a string\\ | ||
+ | snprintf(macStr, | ||
+ | | ||
+ | Serial.print(macStr); | ||
+ | Serial.print(" | ||
+ | Serial.println(status == ESP_NOW_SEND_SUCCESS ? " | ||
+ | } | ||
+ | |||
+ | void setup() {\\ | ||
+ | Serial.begin(115200); | ||
+ | |||
+ | WiFi.mode(WIFI_STA); | ||
+ | |||
+ | // Set the ESP32 Board MAC Address.\\ | ||
+ | esp_wifi_set_mac(WIFI_IF_STA, | ||
+ | |||
+ | // Print the new MAC Address.\\ | ||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.macAddress()); | ||
+ | |||
+ | if (esp_now_init() != ESP_OK) {\\ | ||
+ | Serial.println(" | ||
+ | ESP.restart(); | ||
+ | } | ||
+ | |||
+ | esp_now_register_send_cb(OnDataSent); | ||
+ | |||
+ | // register peer\\ | ||
+ | peerInfo.channel = 0;\\ | ||
+ | peerInfo.encrypt = false;\\ | ||
+ | // register first peer\\ | ||
+ | memcpy(peerInfo.peer_addr, | ||
+ | if (esp_now_add_peer(& | ||
+ | Serial.println(" | ||
+ | return;\\ | ||
+ | } | ||
+ | |||
+ | // register second peer\\ | ||
+ | memcpy(peerInfo.peer_addr, | ||
+ | if (esp_now_add_peer(& | ||
+ | Serial.println(" | ||
+ | return;\\ | ||
+ | } | ||
+ | |||
+ | // Set pin 4 as an interrupt\\ | ||
+ | pinMode(4, INPUT_PULLUP); | ||
+ | attachInterrupt(digitalPinToInterrupt(4), | ||
+ | } | ||
+ | |||
+ | void triggerbell() {\\ | ||
+ | bell.trigger = 8562190430; | ||
+ | |||
+ | esp_err_t result = esp_now_send(0, | ||
+ | |||
+ | if (result == ESP_OK) {\\ | ||
+ | Serial.println(" | ||
+ | } else {\\ | ||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.macAddress()); | ||
+ | |||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | |||
+ | } | ||
+ | |||
+ | Empfänger1 | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | // Set MAC Address this device (bell receiver 1)\\ | ||
+ | uint8_t newMACAddress[] = {0x30, 0xAF, 0xA1, 0x05, 0x1D, 0x63}; | ||
+ | |||
+ | uint8_t addr[] = {0x30, 0xAF, 0xA0, 0x05, 0x1D, 0x63}; | ||
+ | |||
+ | unsigned long lastPrintoutTime = 0;\\ | ||
+ | bool isTriggered = false;\\ | ||
+ | unsigned long lastTriggeredTime = 0; | ||
+ | |||
+ | typedef struct bell_struct {\\ | ||
+ | uint64_t trigger; | ||
+ | } bell_struct; | ||
+ | |||
+ | //Create a struct_message called myData\\ | ||
+ | bell_struct myData; | ||
+ | |||
+ | void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, | ||
+ | memcpy(& | ||
+ | Serial.print(" | ||
+ | Serial.println(len); | ||
+ | Serial.print(" | ||
+ | Serial.println(myData.trigger); | ||
+ | if (memcmp(mac, | ||
+ | Serial.println(" | ||
+ | if (myData.trigger == 8562190430) {\\ | ||
+ | Serial.println(" | ||
+ | triggerbell(); | ||
+ | }\\ | ||
+ | }\\ | ||
+ | } | ||
+ | |||
+ | void setup() { | ||
+ | |||
+ | Serial.begin(115200); | ||
+ | |||
+ | Serial.println(); | ||
+ | |||
+ | WiFi.mode(WIFI_STA); | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.macAddress()); | ||
+ | |||
+ | // ESP32 Board add-on before version < 1.0.5\\ | ||
+ | // | ||
+ | |||
+ | // ESP32 Board add-on after version > 1.0.5\\ | ||
+ | esp_wifi_set_mac(WIFI_IF_STA, | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.macAddress()); | ||
+ | |||
+ | pinMode(LED_BUILTIN, | ||
+ | pinMode(4, OUTPUT); | ||
+ | |||
+ | digitalWrite(LED_BUILTIN, | ||
+ | digitalWrite(4, | ||
+ | delay(100); | ||
+ | digitalWrite(4, | ||
+ | digitalWrite(LED_BUILTIN, | ||
+ | delay(100); | ||
+ | |||
+ | //Set device as a Wi-Fi Station\\ | ||
+ | WiFi.mode(WIFI_STA); | ||
+ | |||
+ | //Init ESP-NOW\\ | ||
+ | if (esp_now_init() != ESP_OK) {\\ | ||
+ | Serial.println(" | ||
+ | ESP.restart(); | ||
+ | } | ||
+ | |||
+ | // Once ESPNow is successfully Init, we will register for recv CB to\\ | ||
+ | // get recv packer info\\ | ||
+ | esp_now_register_recv_cb(OnDataRecv); | ||
+ | } | ||
+ | |||
+ | \\ | ||
+ | void triggerbell() {\\ | ||
+ | if (!isTriggered || (millis() - lastTriggeredTime > 10000)) {\\ | ||
+ | isTriggered = true;\\ | ||
+ | lastTriggeredTime = millis(); | ||
+ | |||
+ | digitalWrite(LED_BUILTIN, | ||
+ | digitalWrite(4, | ||
+ | delay(100); | ||
+ | digitalWrite(4, | ||
+ | digitalWrite(LED_BUILTIN, | ||
+ | Serial.println(" | ||
+ | }\\ | ||
+ | } | ||
+ | |||
+ | void loop() {\\ | ||
+ | // Print out the `isTriggered` variable every second\\ | ||
+ | if (millis() - lastPrintoutTime > 1000) {\\ | ||
+ | Serial.print(" | ||
+ | Serial.println(isTriggered); | ||
+ | lastPrintoutTime = millis(); | ||
+ | }\\ | ||
+ | \\ | ||
+ | // Reset the `isTriggered` variable after 5 seconds\\ | ||
+ | if (millis() - lastTriggeredTime > 5000) {\\ | ||
+ | isTriggered = false;\\ | ||
+ | }\\ | ||
+ | \\ | ||
+ | } | ||
+ | |||
+ | Empfänger2 | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | // Set MAC Address this device (bell receiver 2)\\ | ||
+ | uint8_t newMACAddress[] = {0x30, 0xAF, 0xA2, 0x05, 0x1D, 0x63}; | ||
+ | |||
+ | uint8_t addr[] = {0x30, 0xAF, 0xA0, 0x05, 0x1D, 0x63}; | ||
+ | |||
+ | unsigned long lastPrintoutTime = 0;\\ | ||
+ | bool isTriggered = false;\\ | ||
+ | unsigned long lastTriggeredTime = 0; | ||
+ | |||
+ | typedef struct bell_struct {\\ | ||
+ | uint64_t trigger; | ||
+ | } bell_struct; | ||
+ | |||
+ | //Create a struct_message called myData\\ | ||
+ | bell_struct myData; | ||
+ | |||
+ | void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, | ||
+ | memcpy(& | ||
+ | Serial.print(" | ||
+ | Serial.println(len); | ||
+ | Serial.print(" | ||
+ | Serial.println(myData.trigger); | ||
+ | if (memcmp(mac, | ||
+ | Serial.println(" | ||
+ | if (myData.trigger == 8562190430) {\\ | ||
+ | Serial.println(" | ||
+ | triggerbell(); | ||
+ | }\\ | ||
+ | }\\ | ||
+ | } | ||
+ | |||
+ | void setup() { | ||
+ | |||
+ | Serial.begin(115200); | ||
+ | |||
+ | Serial.println(); | ||
+ | |||
+ | WiFi.mode(WIFI_STA); | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.macAddress()); | ||
+ | |||
+ | // ESP32 Board add-on before version < 1.0.5\\ | ||
+ | // | ||
+ | |||
+ | // ESP32 Board add-on after version > 1.0.5\\ | ||
+ | esp_wifi_set_mac(WIFI_IF_STA, | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.macAddress()); | ||
+ | |||
+ | pinMode(LED_BUILTIN, | ||
+ | pinMode(4, OUTPUT); | ||
+ | |||
+ | digitalWrite(LED_BUILTIN, | ||
+ | digitalWrite(4, | ||
+ | delay(100); | ||
+ | digitalWrite(4, | ||
+ | digitalWrite(LED_BUILTIN, | ||
+ | delay(100); | ||
+ | |||
+ | //Set device as a Wi-Fi Station\\ | ||
+ | WiFi.mode(WIFI_STA); | ||
+ | |||
+ | //Init ESP-NOW\\ | ||
+ | if (esp_now_init() != ESP_OK) {\\ | ||
+ | Serial.println(" | ||
+ | ESP.restart(); | ||
+ | } | ||
+ | |||
+ | // Once ESPNow is successfully Init, we will register for recv CB to\\ | ||
+ | // get recv packer info\\ | ||
+ | esp_now_register_recv_cb(OnDataRecv); | ||
+ | } | ||
+ | |||
+ | \\ | ||
+ | void triggerbell() {\\ | ||
+ | if (!isTriggered || (millis() - lastTriggeredTime > 10000)) {\\ | ||
+ | isTriggered = true;\\ | ||
+ | lastTriggeredTime = millis(); | ||
+ | |||
+ | digitalWrite(LED_BUILTIN, | ||
+ | digitalWrite(4, | ||
+ | delay(100); | ||
+ | digitalWrite(4, | ||
+ | digitalWrite(LED_BUILTIN, | ||
+ | Serial.println(" | ||
+ | }\\ | ||
+ | } | ||
- | Der Sender wurde von seinem Gehäuse befreit, die Batteriekontakte wurden entfernt und der Taster überbrückt. Anschließend passte die Senderplatine direkt in den unteren Bereich des Haustelefons HT 3033. | + | void loop() {\\ |
+ | // Print out the `isTriggered` variable every second\\ | ||
+ | if (millis() - lastPrintoutTime > 1000) {\\ | ||
+ | Serial.print(" | ||
+ | Serial.println(isTriggered); | ||
+ | lastPrintoutTime = millis(); | ||
+ | }\\ | ||
+ | \\ | ||
+ | // Reset the `isTriggered` variable after 5 seconds\\ | ||
+ | if (millis() - lastTriggeredTime > 5000) {\\ | ||
+ | isTriggered = false;\\ | ||
+ | }\\ | ||
+ | \\ | ||
+ | } | ||
sonstiges/tuerklingel.txt · Zuletzt geändert: 2023-09-29 22:49 von schuballaa