MQTT enabled led sign


#1

just a quick look at what i’m working on at the moment.
A led sign with 12 max7219 displays hookup up to a esp8266 running homie-esp8266.

It subscribes to a mqtt topic and displays the messages published to that topic.
I pllan on using this together with the HASS MQTT notification service (and on my to do list: when not showing notifications show a time and date)

using the MQTT service option in developer options:


LED Matrix MQTT Sign
#2

Nice. I like the LED display casing etc. Did you design it or is it some sort of kit?


#3

the casing is my own design and lasercut by http://www.snijlab.nl
it’s a simple box design made with http://www.makercase.com


#4

Again Nice… Simple is the best :smiley:


#5

FIY:
i’m feeding the display with following automation. This way the display is fed with changes rather then pulling them in.

alias: 'mqtt test'
trigger:
  platform: state
  entity_id: climate.thermostaat,sensor.netatmo_binnen2_co2, sensor.netatmo_binnen_co2, sensor.netatmo_binnen2_temperature, sensor.netatmo_binnen_temperature, sensor.slaapkamer_eva_temperature, sensor.netatmo_buiten_temperature
action:
  service: mqtt.publish
  data_template:
    topic: "devices/5ccf7fc3b1c6/text/on/set"
    payload: "{{ trigger.to_state.name }} is {{ trigger.to_state.state }} "

#6

Will you be sharing code for this at some stage? I like it.


#7

i’m using this:
3x FC16 display (search aliexpress for ‘4 in one dot matrix max7219’)
Wemos D1 Mini
MD_Parola arduino lib (https://github.com/MajicDesigns/MD_Parola)
MAX7219 arduino lib (https://github.com/MajicDesigns/MD_MAX72XX)
esp8266 ntpclient (https://github.com/gmag11/NtpClient)
homie-esp8266 (https://github.com/marvinroger/homie-esp8266)
homie-eps8266 is excellent because you can setup the esp8266 via a web configpage, no more wifi credentials in your source code!

i’m using this sketch at the moment. Can use some serious help with this as the esp watchdog is giving me headaches when scrolling long lines of text. I tried to resolve this by adding a lot of ‘ESP.wdtFeed();’ all over the place…had to disable serial to make it usable…

#include <Homie.h>
#include <SPI.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <TimeLib.h>
#include <NtpClientLib.h>

////////////////////////////////////////////////////////////////////////
//PAROLA
////////////////////////////////////////////////////////////////////////
#define  MAX_DEVICES 12
#define CLK_PIN   14
#define DATA_PIN  13
#define CS_PIN    15
MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
//MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);

HomieNode textNode("text", "sign");

bool textOnHandler(const HomieRange& range, const String& value) {
  String text = "   +++++ " + value + " +++++   ";
  int value_len = text.length() + 1 ;
  char txtbuffer[value_len] ;
  text.toCharArray(txtbuffer, value_len );
  ESP.wdtFeed();
  textNode.setProperty("on").send(value);
  P.displayText(txtbuffer , PA_CENTER, 20, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT );
  ESP.wdtFeed();
  while (!P.displayAnimate()) {
    delay(500);
    ESP.wdtFeed();
  }
  ESP.wdtFeed();
  Homie.getLogger() << "text is " << value << endl;
  ESP.wdtFeed();
  return true;
}

void setup() {
  ESP.wdtDisable();
  ESP.wdtEnable(WDTO_8S);
  P.begin();
  //Serial.begin(115200);
  Serial << endl << endl;
  Homie_setFirmware("awesome-sign", "1.0.0");
  textNode.advertise("on").settable(textOnHandler);
  Homie.setup();
  P.displayText("Initialising ...", PA_CENTER, 1, 2000, PA_PRINT, PA_PRINT );
  while (!P.displayAnimate());
  NTP.onNTPSyncEvent([](NTPSyncEvent_t error) {
    if (error) {
      Serial.print("Time Sync error: ");
      if (error == noResponse)
        Serial.println("NTP server not reachable");
      else if (error == invalidAddress)
        Serial.println("Invalid NTP server address");
    }
    else {
      Serial.print("Got NTP time: ");
      Serial.println(NTP.getTimeDateString(NTP.getLastNTPSync()));
    }
  });
  NTP.begin("pool.ntp.org", 1, true);
  NTP.setInterval(1800);
}

void loop() {
  Homie.loop();
  char charBuf[100];
  sprintf(charBuf, "%02u : %02u", hour(), minute());
  P.displayText(charBuf, PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT );
  while (!P.displayAnimate())
  ESP.wdtFeed();
  }

#8

This sounds like fun. OK well I’m going to order some modules and add this on the “Must Play With” list :smiley:

I’ll be back at you at some stage.

Kman


#9

OK ordered :smiley: Not bad, $13USD delivered for 3 modules.


#10

you can save memory by putting literal strings in memspace like:
Serial.print(F(“Hello World”))
your problem looks like a short of RAM .


#11

@koen01 Have you got any further with this. Am about to start looking at it and get it going.


#12

No sorry. My wife decided it was to big and ugly to have in the living room so it ended up disused in the junk closet…the code I posted worked reasonably well by the way


#13

What a shame. Stick it in your office at least :smiley: or the man cave if you have one. OK well I will play with this next. Thanks and I may have a few questions down the line.


#14

This is a very interesting one, you can use this as HASS notification and display on the LED.
Do you have a detailed instruction how can it be done? Thanks!


#15

Would you mind posting an install routine …just bought 3 units to play with


#16

What exactly do you mean with install routine?


#17

I mean step by step tutorial :wink:


#18

A step by step tutorial would be awesome! I built this LED scrolling sign, but I want to redo the code to make an MQTT connected version for displaying text messages sent to an MQTT broker. Here’s my project: https://www.hackster.io/wizworks/wifi-marquee-scroller-e68977