ESP32 mqtt 128x32 Led Matrix

Hallo Forum,
ich brauche bitte euere Hilfe.Ich experimentiere mit einer LED Matrix.Es sollen Werte von einen Wechselrichter(Lumentree 600) mit Trucki Stick auf der Matrix angezeit werden.Mqtt Verbindung funktioniert, Werte kommen an und auf der Serial Ausgabe angezeigt.
Aber wie kann ich die einzelnen Werte rausfiltern und einzeln anzeigen(Serial Konsole)?
Zu Beispiel T2SG418981/VBAT - 26.00 zu T2SG418981/VBAT - 26.00 Volt einzeln ?
Grüße-Martin


#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>

#include <NTPClient.h>
#include <WiFiUdp.h>

#include <time.h>
#include "Adafruit_GFX.h"
//#include "FreeMonoBold12pt7b.h"
//#include "kongtext4pt7b.h"
#include "PxMatrix.h"
#include <Ticker.h>

#include <MQTTClient.h>
#include <ArduinoJson.h>

// Pins for LED MATRIX
#ifdef ESP32

#define P_LAT 19
#define P_A 23
#define P_B 5
#define P_C 17
#define P_D 18
#define P_E 0
#define P_OE 16
hw_timer_t *timer = NULL;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
#endif
//#include <Ticker.h>
//Ticker display_ticker;

const char *ssid = "******";
const char *password = "*************";

const char MQTT_BROKER_ADRRESS[] = "192.168.2.198";  // CHANGE TO MQTT BROKER'S ADDRESS
const int MQTT_PORT = 1883;
const char MQTT_CLIENT_ID[] = "ESP32MATRIX128";  // CHANGE IT AS YOU DESIRE
const char MQTT_USERNAME[] = "********";             // CHANGE IT IF REQUIRED, empty if not required
const char MQTT_PASSWORD[] = "********";            // CHANGE IT IF REQUIRED, empty if not required

//const char *topic_1 = "T2SG418981/VBAT";
//const char *topic_2 = "T2SG418981/ACSETPOINT";

String topic_1 = "T2SG418981/VBAT";
String topic_2 = "T2SG418981/ACSETPOINT";


const int PUBLISH_INTERVAL = 5000;  // 5 seconds
unsigned long lastPublishTime = 0;

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000);

WiFiClient WifiClient;
WiFiClient network;
MQTTClient mqtt = MQTTClient(256);

#define matrix_width 64
#define matrix_height 32

// This defines the 'on' time of the display is us. The larger this number,
// the brighter the display. If too large the ESP will crash
uint8_t display_draw_time = 60;  //30-70 is usually fine

PxMATRIX display(128, 32, P_LAT, P_OE, P_A, P_B, P_C, P_D);

// Some standard colors
uint16_t myRED = display.color565(255, 0, 0);
uint16_t myGREEN = display.color565(0, 255, 0);
uint16_t myBLUE = display.color565(0, 0, 255);
uint16_t myWHITE = display.color565(255, 255, 255);
uint16_t myYELLOW = display.color565(255, 255, 0);
uint16_t myCYAN = display.color565(0, 255, 255);
uint16_t myMAGENTA = display.color565(255, 0, 255);
uint16_t myBLACK = display.color565(0, 0, 0);

uint16_t myCOLORS[8] = { myRED, myGREEN, myBLUE, myWHITE, myYELLOW, myCYAN, myMAGENTA, myBLACK };

#ifdef ESP32
void IRAM_ATTR display_updater() {
  // Increment the counter and set the time of ISR
  portENTER_CRITICAL_ISR(&timerMux);
  display.display(display_draw_time);
  portEXIT_CRITICAL_ISR(&timerMux);
}
#endif

void display_update_enable(bool is_enable) {


#ifdef ESP32
  if (is_enable) {
    timer = timerBegin(0, 80, true);
    timerAttachInterrupt(timer, &display_updater, true);
    timerAlarmWrite(timer, 4000, true);
    timerAlarmEnable(timer);
  } else {
    timerDetachInterrupt(timer);
    timerAlarmDisable(timer);
  }
#endif
}

void setup() {

  Serial.begin(115200);  // Initialize serial

  display.begin(16);
  //display.setMuxDelay(1, 1, 1, 1, 1);
  display.setMuxPattern(SHIFTREG_ABC_BIN_DE);
  display.setColorOffset(5, 5, 5);
  display.setColorOrder(RRGGBB);
  display.setMuxDelay(0, 1, 0, 0, 0);
  display.setPanelsWidth(2);

  //display.setFastUpdate(true);
  display.setRotation(0);  // we don't wrap text so it scrolls nicely

  display.setTextColor(myCYAN);
  display.setCursor(2, 0);
  display.println("Connecting");

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(200);
    display.print(".");
  }

  display.setTextWrap(false);
  display.clearDisplay();
  display.println("");
  display.print("WiFi OK");
  //display_update_enable(true);

  //display.setBrightness(70);
  display.clearDisplay();
  display.setTextColor(myCYAN);
  display.setCursor(2, 0);
  display.print("Pixel");
  display.setTextColor(myMAGENTA);
  display.setCursor(2, 8);
  display.print("Time");
  display_update_enable(true);

  delay(3000);
  timeClient.begin();
  // print your board's IP address:
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());

  connectToMQTT();
}


union single_double {
  uint8_t two[2];
  uint16_t one;
} this_single_double;

unsigned long last_draw = 0;

void scroll_text(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB) {
  uint16_t text_length = text.length();
  display.setTextWrap(false);  // we don't wrap text so it scrolls nicely
  display.setTextSize(1);
  display.setRotation(0);
  display.setTextColor(display.color565(colorR, colorG, colorB));

  // Asuming 5 pixel average character width
  for (int xpos = matrix_width; xpos > -(matrix_width + text_length * 5); xpos--) {
    display.setTextColor(display.color565(colorR, colorG, colorB));
    display.clearDisplay();
    display.setCursor(xpos, ypos);
    display.println(text);
    delay(scroll_delay);
    yield();

    // This might smooth the transition a bit if we go slow
    // display.setTextColor(display.color565(colorR/4,colorG/4,colorB/4));
    // display.setCursor(xpos-1,ypos);
    // display.println(text);

    delay(scroll_delay / 5);
    yield();
  }
}

void scroll_text_2(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB) {
  uint16_t text_length = text.length();
  display.setTextWrap(false);  // we don't wrap text so it scrolls nicely
  display.setTextSize(1);
  display.setRotation(0);
  display.setTextColor(display.color565(colorR, colorG, colorB));

  // Asuming 5 pixel average character width
  for (int xpos = matrix_width; xpos > -(matrix_width + text_length * 5); xpos--) {
    display.setTextColor(display.color565(colorR, colorG, colorB));
    display.clearDisplay();
    display.setCursor(xpos, ypos);
    display.println(text);
    delay(scroll_delay);
    yield();

    // This might smooth the transition a bit if we go slow
    // display.setTextColor(display.color565(colorR/4,colorG/4,colorB/4));
    // display.setCursor(xpos-1,ypos);
    // display.println(text);

    delay(scroll_delay / 5);
    yield();
  }
}

void connectToMQTT() {
  // Connect to the MQTT broker
  mqtt.begin(MQTT_BROKER_ADRRESS, MQTT_PORT, network);

  // Create a handler for incoming messages
  mqtt.onMessage(messageReceived);

  Serial.print("Arduino UNO R4 - Connecting to MQTT broker");

  while (!mqtt.connect(MQTT_CLIENT_ID, MQTT_USERNAME, MQTT_PASSWORD)) {
    Serial.print(".");
    delay(100);
  }
  Serial.println();

  if (!mqtt.connected()) {
    Serial.println("Arduino UNO R4 - MQTT broker Timeout!");
    return;
  }

  // Subscribe to a topic, the incoming messages are processed by messageHandler() function
  if (mqtt.subscribe(topic_1))
    Serial.print("Arduino UNO R4 - Subscribed to the topic-1: ");
  else
    Serial.print("Arduino UNO R4 - Failed to subscribe to the topic-1: ");

  Serial.println(topic_1);
  Serial.println("Arduino UNO R4 - MQTT broker Connected!");

  // Subscribe to a topic, the incoming messages are processed by messageHandler() function
  if (mqtt.subscribe(topic_2))
    Serial.print("Arduino UNO R4 - Subscribed to the topic-2: ");
  else
    Serial.print("Arduino UNO R4 - Failed to subscribe to the topic-2: ");

  Serial.println(topic_2);
  Serial.println("Arduino UNO R4 - MQTT broker Connected!");
}

void messageReceived(String &topic, String &payload) {

  Serial.println("incoming: " + topic + " - " + payload);
      
}


uint8_t icon_index = 0;

void loop() {

  
  //scroll_text(15,20,"Welcome to PxMatrix!",96,96,250);
  //display.clearDisplay();

  mqtt.loop();
  if (millis() - lastPublishTime > PUBLISH_INTERVAL) {
    
    lastPublishTime = millis();
  }

  timeClient.update();
  Serial.println(timeClient.getFormattedTime());
  delay(1000);

  display.clearDisplay();
  display.setTextSize(1);
  display.setCursor(2, 2);
  display.setTextColor(myWHITE);
  display.println(timeClient.getFormattedTime());
  display.setFont();
}


Ich würde mir mal diese Funktion ganz genau anschauen:

Hallo Rintin,
wenn ich

Serial.println("incoming: " + topic_1 + " - " + payload);
Serial.println("incoming: " + topic_2 + " - " + payload);

probiere sind die Wetre durcheinander! Siehe Screenshot.

Oder meinst du was anderes?
Grüße Martin

Ja, du bekommst topic im Aufruf der Funktion und das kannst du mit topic_1 vergleichen. Wenn das übereinstimmt, kannst du es z.B. payload ausgeben.

Und was soll ich jetzt machen?
Kannst du mir bitte helfen?
Grüße

Ich kann gerade nicht testen aber versuch mal das:

void messageReceived(String &topic, String &payload) {
  if( topic == topic_1){
    Serial.println(payload);
  }   
}

Hallo Rintin,
Klasse von dir! Funktioniert schon mal sehr gut.
Mal sehen wie ich das an der Matrix umsetzen kann.
Darf ich mich wieder melden ?

Grüße-Martin

void messageReceived(String &topic, String &payload) {
  if( topic == topic_1){
    Serial.println("VBAT " + payload + " Volt");
  }
  if( topic == topic_2){
    Serial.println("ACSETPOINT " + payload + " Watt");
  }
  if( topic == topic_3){
    Serial.println("Verbrauch " + payload + " Watt");
  }            
}

Klar. Einfach hier ins Forum schreiben

Danke !!

Eine ungefragte Anmerkung: 128 * 32 = 4096 Pixel. Bei maximal 60 mA je Pixel komme ich auf 245 A. Damit kann man schweißen!

Hast Du das berücksichtigt?

Im 1/16 Scan...

...aber bitte keine Screenshots mehr.
Man kann auch im seriellen Monitor Zeilen markieren, kopieren und als Code hier posten.

Wenn das WS2812B oder ähnliche sind ( nicht WS2815) dann stimmt die Rechnung bei allen voll angesteuerten LED.
Wenn WS2812B oder ähnliche nur mit 1/16 der max Intensität angesteuert werden bedeutet das, daß im mittel nur 1/16 des Stroms gebraucht wird, wegen der PWM mit unsynchroinisierter Taktrate hat man aber Momentanströme von 1/16 bis 1 mal des Maximalstroms bei allen eingeschaltenen LED.

Ist es einen LEDmatrix mit normaln LED dann sind immernoch bis zu 256 LEDs gleichzeitig an. Bei angenommenen 20mA (oder bei 1/16 auch besser mehr) sind das bis zu 5A, wobei 1/16 etwas blass sind.

Die in #1 eingebundene Bibliothek PxMatrix.h läßt an eine LED Matrix mit 3 Farben denken also das fünffache.

Hast Du da Tutorial

gelesen, das in

verlinkt ist?

Im Tutorial steht: "The first thing we'll need is a pretty large 5v power supply, Adafruit suggest that 64x32 matrix can require up the 8 Amps! This is worst case scenario"
Da Du ein 128x32 Matrix hast müßte der max Strom 16A sein.

Grüße Uwe

Hallo an Alle,

auch nochmal ein Gutes Neues Jahr für Euch.
Mit der LED Matrix Geschichte habe ich schon ca. 4 Jahren angefangen.Damals habe ich auch eine kl. Platine machen lassen mit Anschluss für einen Bewegungsmelder(Arduino Teil) und einen Mosfet(der die Panel Spannung/Strom schaltet).

Irgendwann verlief das im Sand.Seit ca. 2 Jahren habe ich ein kl. Smart Home eingerichtet(HomeAssistant) und zudem ein 2000W Balkonkraftwerk mit Batterie Speicher.Da möchte ich mir die wichtigsten Daten auf der Matrix anzeigen lassen und nicht immer mit dem Tablet oder Handy rum machen.

Ich habe kurz mal gefilmt was jetzt Stand der Dinge ist.
Die Topics(data) im Wechsel,immer 3 im Intervall (jetzt 6 Sekunden).
Datum und Wochentag im Intervall (jetzt 5 Sekunden)
Platz für 1x Lauftext wäre noch da.....

Eigentlich brauche ich nur einen Lauftext der Zeitunabhänig laufen soll.Oder auch nicht..

Hier der Video Link : https://www.youtube.com/watch?v=lQ-IGWBW5xI

Es kommen aber bestimmt noch MQTT Topics dazu.

Grüße Martin

Hübsch

Danke

Hallo an Alle Verfolger,

jetzt läuft der Lauftext.Musste aber was ändern.

Die Topics(data) im Wechsel,immer 3 im Intervall (jetzt 6 Sekunden).
Datum und Wochentag im Intervall (jetzt 5 Sekunden).

Das endgültige Layout steht aber noch nicht fest.

Hier der neue Video Link : https://www.youtube.com/watch?v=rVLeDB0mU6o

Vielen Dank noch mal.
Ich bin aber noch nicht fertig.Wie gesagt habe ich ja eine(bzw. 5)Platine mit DS3231 RTC.Die möchte ich noch mit einpflegen.Evtl. auch einen Bewegungsmelder und Alarmeingänge.

Grüße Martin

Hallo Forum,
ich brauche wieder euere Hilfe.Ich möchte(habe) eine IR Fernbedienung angeschlossen.Da möchte ich dann verschiede Modi machen.Der Sketch von der Fernbedienung funktioniert wunderbar.Nur im zusammenspiel mit dem Display Code geht es nicht.Ich denke es liegt an dem hw-timer/display-updater.
Was kann ich tun?
Ausgabe serial ist: other Button
Grüße-Martin
Code Snipsel und ganzer Sketch im Anhang.

void fern() {

  if (IrReceiver.decode()) {
    translateIR();
    IrReceiver.resume();
  }
}

/*-----( Declare User-written Functions )-----*/
void translateIR()  // takes action based on IR code received
// describing Car MP3 IR codes
{
  uint16_t command = IrReceiver.decodedIRData.command;
  switch (command) {
    case 69:
      Serial.println(" CH-            ");
      break;
    case 70:
      Serial.println(" CH             ");
      break;
    case 71:
      Serial.println(" CH+            ");
      break;
    case 68:
      Serial.println(" PREV           ");
      break;
    case 64:
      Serial.println(" NEXT           ");
      break;
    case 67:
      Serial.println(" PLAY/PAUSE     ");
      break;
    case 7:
      Serial.println(" VOL-           ");
      break;
    case 21:
      Serial.println(" VOL+           ");
      break;
    case 9:
      Serial.println(" EQ             ");
      break;
    case 22:
      Serial.println(" 0              ");
      break;
    case 25:
      Serial.println(" 100+           ");
      break;
    case 13:
      Serial.println(" 200+           ");
      break;
    case 12:
      Serial.println(" 1              ");
      break;
    case 24:
      Serial.println(" 2              ");
      break;
    case 94:
      Serial.println(" 3              ");
      break;
    case 8:
      Serial.println(" 4              ");
      break;
    case 28:
      Serial.println(" 5              ");
      break;
    case 90:
      Serial.println(" 6              ");
      break;
    case 66:
      Serial.println(" 7              ");
      break;
    case 82:
      Serial.println(" 8              ");
      break;
    case 74:
      Serial.println(" 9              ");
      break;
    default:
      Serial.println(" other button   ");
  }
  delay(100);
}  //END translateIR

Serial:


14:38:05.992 -> incoming: T2SG418981/VBAT ---> 26.60
14:38:06.025 -> incoming: T2SG418981/METER ---> 271.71
14:38:06.409 -> incoming: batteriemonitor/sensor/instantaneous_power/state ---> 311.00
14:38:06.473 -> incoming: batteriemonitor/sensor/soc/state ---> 32
14:38:06.537 -> incoming: victron/sensor/gartenhecke_panel_power/state ---> 254
14:38:06.730 ->  other button   
14:38:07.244 ->  other button   
14:38:07.340 -> incoming: batteriemonitor/sensor/instantaneous_power/state ---> 313.00
14:38:07.566 ->  other button   
14:38:07.663 -> incoming: batteriemonitor/sensor/soc/state ---> 32
14:38:07.695 -> incoming: T2SG418981/ACSETPOINT ---> 0.00
14:38:07.758 -> incoming: T2SG418981/VBAT ---> 26.60
14:38:07.791 -> incoming: T2SG418981/METER ---> 271.71
14:38:08.177 ->  other button   
14:38:08.306 -> incoming: batteriemonitor/sensor/instantaneous_power/state ---> 314.00
14:38:08.499 -> incoming: batteriemonitor/sensor/soc/state ---> 32
14:38:08.916 -> incoming: T2SG418981/ACSETPOINT ---> 0.00
14:38:08.949 -> incoming: T2SG418981/VBAT ---> 26.60
14:38:09.012 -> incoming: T2SG418981/METER ---> 258.63
14:38:09.108 ->  other button   
14:38:09.431 -> incoming: batteriemonitor/sensor/instantaneous_power/state ---> 313.00
14:38:09.494 -> incoming: batteriemonitor/sensor/soc/state ---> 32
14:38:10.233 -> incoming: T2SG418981/ACSETPOINT ---> 0.00
14:38:10.457 -> incoming: T2SG418981/VBAT ---> 26.60

Erste Seite:

#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <time.h>

#include <Arduino.h>
#define NO_LED_FEEDBACK_CODE

#include "PinDefinitionsAndMore.h"
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 26

const char* ssid = "****";
const char* password = "*********";
const char* ntpServer = "de.pool.ntp.org";

WiFiUDP ntpUDP;
WiFiClient WifiClient;
WiFiClient network;
WiFiClient net;
NTPClient timeClient(ntpUDP, "de.pool.ntp.org", 3600, 60000 * 5);  // 60 mal 1000 ms = jede minute 60000x60=3600000ms =60 min
//NTPClient timeClient(ntpUDP, "de.pool.ntp.org", 3600, 60000);  // 60 mal 1000 ms = jede minute 60000x60=3600000ms =60 min
/////NTPClient(UDP& udp, IPAddress poolServerIP, long timeOffset, unsigned long updateInterval);//////

#include <RTClib.h>

RTC_DS3231 rtc;

String daysNames[] = {
  "Sonntag",
  "Montag",
  "Dienstag",
  "Mittwoch",
  "Donnerstag",
  "Freitag",
  "Samstag"
};


#include <RTClib.h>
#include "Adafruit_GFX.h"
#include "PxMatrix.h"
#include <Ticker.h>
#include <MQTTClient.h>
#include <ArduinoJson.h>

unsigned long previousMillis = 0;
unsigned long currentMillis = millis();

unsigned long previousMillis_rtcupdate = 0;
//const long interval_rtcupdate = 3600 * 1000;  // 60 mal 1000 ms = jede minute //// 3600 = jede stunde
const long interval_rtcupdate = 300000;  // 60 mal 1000 ms = jede minute //// 3600 = jede stunde 300000 = 5 Minuten

unsigned long previousMillis_uhr = 0;
const long interval_uhr = 1000;

unsigned long previousMillis_1;
unsigned long currentMillis_1 = millis();

unsigned long previousMillis_2;
unsigned long currentMillis_2 = millis();

unsigned long previousMillis_3;
unsigned long currentMillis_3 = millis();

int anzeige = 1;
int screen = 1;

struct ScrollType {
  String text;
  uint16_t color;
  int xpos;
  uint8_t ypos;
  String Delay;
  unsigned long lastScrollTime;
};

// Pins for LED MATRIX
#ifdef ESP32

#define P_LAT 19
#define P_A 23
#define P_B 5
#define P_C 17
#define P_D 18
//#define P_E 0
#define P_OE 16
hw_timer_t* timer = NULL;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
#endif

// MQTT Verbindungsdaten
const char* mqtt_client_id = "ESP32MATRIX128";
const char* mqtt_server = "*****";
const int mqtt_port = 1883;
const char* mqtt_user = "******";
const char* mqtt_pass = "******";

String deviceName = "ESP32MATRIX128";

String mqtt01Topic = "T2SG418981/METER";
String mqtt01Data;

String mqtt02Topic = "T2SG418981/ACSETPOINT";
String mqtt02Data;

String mqtt03Topic = "T2SG418981/VBAT";
String mqtt03Data;

String mqtt04Topic = "batteriemonitor/sensor/soc/state";
String mqtt04Data;

String mqtt05Topic = "victron/sensor/gartenhecke_panel_power/state";
String mqtt05Data;

String mqtt06Topic = "victron/sensor/hauswand_panel_power/state";
String mqtt06Data;

String mqtt07Topic = "batteriemonitor/sensor/instantaneous_power/state";
String mqtt07Data;


MQTTClient mClient;

#define matrix_width 128
#define matrix_height 32

#define PxMATRIX_double_buffer true

uint8_t display_draw_time = 40;  //30-70 is usually fine

PxMATRIX display(128, 32, P_LAT, P_OE, P_A, P_B, P_C, P_D);

// Some standard colors
uint16_t myRED = display.color565(255, 0, 0);
uint16_t myGREEN = display.color565(0, 255, 0);
uint16_t myBLUE = display.color565(0, 0, 255);
uint16_t myWHITE = display.color565(255, 255, 255);
uint16_t myYELLOW = display.color565(255, 255, 0);
uint16_t myCYAN = display.color565(0, 255, 255);
uint16_t myMAGENTA = display.color565(255, 0, 255);
uint16_t myBLACK = display.color565(0, 0, 0);

uint16_t myCOLORS[8] = { myRED, myGREEN, myBLUE, myWHITE, myYELLOW, myCYAN, myMAGENTA, myBLACK };

ScrollType A = { "Scrolltext 1", myRED, 128, 8, "25", 0 };
ScrollType B = { "Scrolltext 2", myGREEN, 128, 8, "25", 0 };
ScrollType C = { "Scrolltext 3", myBLUE, 128, 8, "25", 0 };

String infoText1;
String infoText2;
String infoText3;

union single_double {
  uint8_t two[2];
  uint16_t one;
} this_single_double;

unsigned long last_draw = 0;


#ifdef ESP32
void IRAM_ATTR display_updater() {
  // Increment the counter and set the time of ISR
  portENTER_CRITICAL_ISR(&timerMux);
  display.display(display_draw_time);
  portEXIT_CRITICAL_ISR(&timerMux);
}
#endif

void display_update_enable(bool is_enable) {

#ifdef ESP32
  if (is_enable) {
    timer = timerBegin(0, 80, true);
    timerAttachInterrupt(timer, &display_updater, true);
    timerAlarmWrite(timer, 4000, true);
    timerAlarmEnable(timer);
  } else {
    timerDetachInterrupt(timer);
    timerAlarmDisable(timer);
  }
#endif
}


void setup() {

  Serial.begin(9600);  // Initialize serial
  
  display.begin(16);
  display.setScanPattern(LINE);
  display.setMuxPattern(SHIFTREG_ABC_BIN_DE);
  display.setColorOrder(RRGGBB);
  display.setColorOffset(5, 8, 5);
  display.setColorOrder(RRGGBB);
  display.setMuxDelay(5, 5, 5, 5, 5);
  display.setPanelsWidth(2);
  display.setBrightness(180);
  display.setRotation(0);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);  /////

  int counter = 0;
  while (WiFi.status() != WL_CONNECTED) {
    delay(200);
    if (++counter > 100) ESP.restart();
    Serial.print(".");
  }
  Serial.println("\n\nWiFi connected\n\n");
  delay(2000);
  display.setTextColor(myCYAN);
  display.setCursor(70, 22);
  display.print("WiFi OK");

  display.clearDisplay();
  display.setTextColor(myCYAN);
  display.setCursor(2, 10);
  display.print("ESP32 Pixel");
  display.setTextColor(myMAGENTA);
  display.setCursor(70, 10);
  display.print("Time");

  configTime(0, 0, ntpServer);
  setenv("TZ", "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00", 1);

  display_update_enable(true);

  delay(3000);

  display.fillRect(0, 10, 128, 10, myBLACK);

  display.setTextSize(1);
  display.setCursor(20, 8);
  display.setTextColor(myRED);
  display.println("Update RTC !");

  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());

  delay(3000);

  if (!rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1)
      ;
  }
  //rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); ////manuel setzen

  mClient.begin(mqtt_server, mqtt_port, net);
  mClient.onMessage(messageReceived);
  connect();
  
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);

  display.clearDisplay();

}  ///end setup


void connect() {
  Serial.print("\nconnecting mqtt-broker...");

  while (!mClient.connect(mqtt_client_id, mqtt_user, mqtt_pass)) {
    Serial.print(".");
    delay(1000);
  }
  Serial.println("\nconnected!");

  Serial.println("Subscribing MQTT topics.");
  mClient.subscribe(mqtt01Topic);
  mClient.subscribe(mqtt02Topic);
  mClient.subscribe(mqtt03Topic);
  mClient.subscribe(mqtt04Topic);
  mClient.subscribe(mqtt05Topic);
  mClient.subscribe(mqtt06Topic);
  mClient.subscribe(mqtt07Topic);
}

void messageReceived(String& topic, String& payload) {
  Serial.println("incoming: " + topic + " ---> " + payload);
  if ((topic.compareTo(mqtt01Topic)) == 0) mqtt01Data = payload;
  if ((topic.compareTo(mqtt02Topic)) == 0) mqtt02Data = payload;
  if ((topic.compareTo(mqtt03Topic)) == 0) mqtt03Data = payload;
  if ((topic.compareTo(mqtt04Topic)) == 0) mqtt04Data = payload;
  if ((topic.compareTo(mqtt05Topic)) == 0) mqtt05Data = payload;
  if ((topic.compareTo(mqtt06Topic)) == 0) mqtt06Data = payload;
  if ((topic.compareTo(mqtt07Topic)) == 0) mqtt07Data = payload;
}

void loop() {

  mClient.loop();

  if (!mClient.connected()) {
    connect();
  }

  if (WiFi.status() == WL_CONNECTED) {
    display.setTextSize(1);
    display.setTextColor(myGREEN);
    display.setCursor(122, 0);
    display.println(".");
  }
  if (mClient.connected() == true) {
    display.setTextSize(1);
    display.setTextColor(myBLUE);
    display.setCursor(118, 0);
    display.println(".");
  }

  fern();
  rtcupdate();
  datum();
  uhrzeit();
  mqtt_wechsel_1();



}  //end loop

pixeltime_128x32_kopie_3i_rtc_IR_Remote-forum.zip (11,7 KB)

Mach das mal so

Hallo,

leider keinen Erfolg.Es wird kein command(o) angezeigt.
Egal welcher Tastendruck auf der IR Fernbedieung,es kommt immer -> other Button
Ich habe was vom esp32 hw-timer gelesen.Das verstehe ich aber nicht.
Irgenwas mit Interrupt setzen?

Grüße-Martin

Er soll auch kein command anzeigen. Sondern eine Zahl vor dem other button