MQTT enabled led sign

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:

2 Likes

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

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

Again Nice… Simple is the best :smiley:

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 }} "

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

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();
  }
2 Likes

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

2 Likes

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

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

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

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

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.

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!

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

What exactly do you mean with install routine?

I mean step by step tutorial :wink:

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

1 Like

Hi!!

Need help please… What is the problem???

msg_led:15: error: invalid conversion from 'int' to 'MD_MAX72XX::moduleType_t' [-fpermissive]

 MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

                                                               ^

In file included from C:\Users\ncouto\Documents\Arduino\msg_led\msg_led.ino:3:0:

C:\Users\ncouto\Documents\Arduino\libraries\MD_Parola\src/MD_Parola.h:1081:3: error:   initializing argument 1 of 'MD_Parola::MD_Parola(MD_MAX72XX::moduleType_t, uint8_t, uint8_t, uint8_t, uint8_t)' [-fpermissive]

   MD_Parola(MD_MAX72XX::moduleType_t mod, uint8_t dataPin, uint8_t clkPin, uint8_t csPin, uint8_t numDevices = 1);

   ^

Multiple libraries were found for "ArduinoJson.h"
 Used: C:\Users\ncouto\Documents\Arduino\libraries\ArduinoJson
 Not used: C:\Users\ncouto\Documents\Arduino\libraries\arduino_736263
exit status 1
invalid conversion from 'int' to 'MD_MAX72XX::moduleType_t' [-fpermissive]

If using the newer libs you need to specify the hardware…

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may/will 
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW

#define  MAX_DEVICES 12

#define CLK_PIN   D7  // or SCK
#define DATA_PIN  D6  // or MOSI
#define CS_PIN    D5  // or SS
  
// HARDWARE SPI
//MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);