LED Matrix MQTT

check this out : https://www.youtube.com/watch?v=tfwAHx0MTxU

sound and looks awesome but i never tried it. I am not a programmer unfortunately and dunno how to implement all of this :confused:

1 Like

I started on a project similar to that a while ago. I’ve not touched the code in a long time, but it’s set up to connect and subscribe to MQTT topics and scroll messages. It combines a WS2812 LED strip as well, so you can optionally add a set of lights around the perimeter of the board.

Code is available here, and you can see a short demo of the final product at this youtube link. It has support for daylight saving (a concept I thoroughly hate, so I automated it), as well as sending the animation property and duration in the message itself.

I’ve set up a couple automations to have it display the currently playing track from my music server. This involves a template, current_track, as well as an automation. You can adjust the automation it to display anything you’d like.

sensors.yaml

- platform: template
  current_track:
      value_template: >
        {% if is_state('media_player.music_server','playing') %}
          {{ state_attr('media_player.music_server', 'media_artist') ~ ": " ~ state_attr('media_player.music_server', 'media_title') }}
        {% endif %}

automations.yaml

- id: '1545147072138'
  alias: Current Track
  trigger:
  - entity_id: sensor.current_track
    platform: state
  condition: []
  action:
  - data:
      payload_template: '{ "message": "{{states(''sensor.current_track'') }}", "repeat":
        0}'
      topic: messageboard/messages
    service: mqtt.publish
2 Likes

This sounds AWESOME!!! I’ll have a look into it very soon. Need t o think about a usecase with WAF :slight_smile:

with regards to the WS2812B LED strip which pin did you connect it on the esp8266? is it the same connection’s as BRUH’s ?

Take a look at example_config.h in the repo. It shows all the pin assignments I used. It should, in theory, allow you to use any pin configuration you’d like, but in my example, I’ve used D3 on a wemos D1 mini.

1 Like

Ok mate thanks

@ptrsnja @keithh666 i am trying to run both your systems but having little joy with both. if possible could i get some help. note im new to Arduino or this kind of thing but like the idea.

@keithh666 i have been through all the comments on this page https://community.home-assistant.io/t/led-matrix-mqtt-sign/19459/124 . when i verify and upload your sketch everything checks out but it still doesn’t connect to my network.

I am completely lost with it???

How can I help you out?

If you’re trying to use my code base, you’ll need to go through installing all the required libraries. They’re listed in the read me file, and you can find them using the library manager tool in the Arduino IDE. If you’re having trouble installing the libraries, YouTube is your friend.

Can you tell me more about your problem? E.g. answer some or all of the following:

  • Does your code compile in the Arduino IDE?
  • Can you upload it successfully to the board?
  • What board are you using?
  • Does it connect to your WiFi network?
  • Does it connect to your MQTT server?
  • Does it display anything on the LED matrix/matrices?
  • Do you see anything when connected to the device over the serial monitor?
  • Copy and paste anything you see in the console into a reply in this thread, using the code tags

I can’t help with @keithh666’s code, but I’m happy to help you troubleshoot issues with my project.

I would also be happy to help with my code, but as @ptrsnja has said I would need to know the same things, you said it compiled and uploaded OK, so that’s a good start, but what does the serial o/p show and did you correctly setup the wifi ssid and pw? The libraries need to be the latest and you haven’t told us what platform you are using and which of my code bases you are using.

Hi @ptrsnja @keithh666 i want to say thanks for your time, as i have successfully compiled Keith’s for now i will try to get this one running first.

Just to run through a few things first then Keith so

1 - i downloaded your NewerScrollingLEDSignCode zip file extracted and placed all the MQTT, pubsub & RSS files files in the same folder as the .INO file.
2 - installed MD_parola version 3.1.1 & MD_MAX72xx version 3.1.0 libraries via the manager
3 - Once i click verify everything seems ok
4 - Im planning to run the code on a D1 mini, just to confirm i have the D1 mini board selected, and the pins are connected as follows

#define CLK_PIN   D5  // or SCK
#define DATA_PIN  D7  // or MOSI
#define CS_PIN    D8  // or SS

5 - doesnt connect to the WIFI/MQTT
6 - all 4 LED modules light up (only runing one MAX7219 module)
7 - wifi settings placed inside " "

#define WIFI_SSID              "placed my SSID here"        // wifi ssid
#define WIFI_PASS              "placeed my PW here" // wifi password
#define WIFI_CONFIG_TOOL       WIFI_WPSCONFIG // Default tool if wifi fails to connect (WIFI_SMARTCONFIG, WIFI_MANAGER or WIFI_WPSCONFIG)
#define WIFIHOSTNAME           "MQTTSign"     // HostName

8 - Serial monito reads


wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v8b899c12
~ld

Hi! I am trying to xompile the sketch. I have all libraries installed but geet:

WARNUNG: Bibliothek Timezone-1.2.2 behauptet auf (avr) Architektur(en) ausgefĂŒhrt werden zu können und ist möglicherweise inkompatibel mit Ihrem derzeitigen Board, welches auf (esp8266) Architektur(en) ausgefĂŒhrt wird.
clock-message-board:468:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6

   StaticJsonBuffer<BUFFER_SIZE> jsonBuffer;

           ^

clock-message-board:787:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6

   StaticJsonBuffer<BUFFER_SIZE> jsonBuffer;

           ^

clock-message-board:902:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6

   StaticJsonBuffer<BUFFER_SIZE> jsonBuffer;

           ^

exit status 1
StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6

I guess we need to use adruinojson v5.xx right?

Nevermind 
I don’t get it running .nice would be a real tutorial with all libs included 


OK, what I found was that the new esp8266 board libraries don’t work (at least for me with a nodemcu) so I had to change the esp8266 board libs to 2.4.2 and then the wdt error goes away :slight_smile:

I would like setting up a repo with all libraries and make a how to if. You would provide the files @keithh666

So i changed the Board Libs of ESP8266 to 2.4.2 now the serial monitor reads

 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset

it looks like you have tried to run @ptrsnja code as i got this message however i manged to fined some libs HERE 5.13.5.zip.

I still ran into errors as im not connecting humidity sensor nor am i connecting a LED strip.

@ptrsnja if you would like the error when tring to verify here goes:-

WARNING: library Timezone-master claims to run on (avr) architecture(s) and may be incompatible with your current board which runs on (esp8266) architecture(s).
In file included from C:\Users\gauntr\Desktop\clock-message-board-master\clock-message-board\clock-message-board.ino:27:0:

C:\Users\gauntr\Documents\Arduino\libraries\FastLED-master/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.010

 #    pragma message "FastLED version 3.002.010"

                     ^

In file included from C:\Users\gauntr\Documents\Arduino\libraries\FastLED-master/FastLED.h:65:0,

                 from C:\Users\gauntr\Desktop\clock-message-board-master\clock-message-board\clock-message-board.ino:27:

C:\Users\gauntr\Documents\Arduino\libraries\FastLED-master/fastspi.h:115:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output

 #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"

                       ^

C:\Users\gauntr\Desktop\clock-message-board-master\clock-message-board\clock-message-board.ino: In function 'void readSensor()':

clock-message-board:434:55: error: 'HUMIDITY_CORRECTION' was not declared in this scope

   float humidity = sensor.readCompensatedHumidity() + HUMIDITY_CORRECTION;

                                                       ^

clock-message-board:435:47: error: 'TEMPERATURE_CORRECTION' was not declared in this scope

   float celsTemp = sensor.readTemperature() + TEMPERATURE_CORRECTION;

                                               ^

exit status 1
'HUMIDITY_CORRECTION' was not declared in this scope

@ptrsnja if you would like to contact me via discord gauntr#8137, just so we are not flooding this chat

Here are my settings for Arduino IDE



as you can see this is for a nodemcu as I don’t currently have any D1 Mini’s to test with.

You’ll need to set the parameter USE_SENSOR to false or 0, and it should ignore any attempts to read from a sensor. However, you’ll still need to include the definitions, as the code will be evaluated at time of compilation, and I’ve never attempted to use it without a sensor.

It looks like I created a bug in the config file. You’ll want to get rid of the conditional around the sensor definitions, lines 74 & 79. #if USE_SENSOR and #endif

@thundergreen You’re right, you’ll need to use ArduinoJSON < 6, as I’ve not refactored the code to use the updated library. I haven’t touched the project in a couple years, so I’m not sure what other libraries may have breaking changes. This project has kind of fallen by the wayside, so I’ll likely not be updating anything in it.