Introduction: Simple Moving Message WIFI Display Using MQTT and D1 Mini
This is a simple moving message WIFI display, We are just using 3 pieces of hardware - and can really get away with just two pieces.
You will need some basic soldering skills for putting the pin headers on the D1 Mini, and shields.
I generally find prices for the D1 Mini a bit better on Aliexpress, but feel free to source your own parts.
Required Hardware: (Dollars are in U.S. Dollar)
D1 Mini - About $2.55 https://www.aliexpress.com/item/1pcs-Smart-Electro...
Matrix LED Shield - About $1.60 - https://www.aliexpress.com/item/Matrix-LED-Shield-...
Not required but maybe handy to have:
Dual Base Shield - About $.50 - https://www.aliexpress.com/item/Double-Socket-Dual...
About $4.65 total.
Some optional hardware:
For power I keep it very simple, and used the USB port on the D1 - a cell phone charger, or just plugged into the USB port on a computer works well.
However Wemos does have a couple of other power options,
Battery Shield - About $1.10 - https://www.aliexpress.com/item/WeMos-D1-Mini-Batt...
(You will need a LiPO battery which will add some cost to the project)
DC power shield - About $2.11 - https://www.aliexpress.com/item/DC-Power-Shield-V1...
Skills and tools needed:
A basic soldering iron, and some basic solder skill will be needed. That is really it.
The Build:
Once the pins are soldered on to the boards, you just need to plug the matrix shield into the D1 mini. The only note here is there is a little "dot" on the matrix shield, there is also a dot on the D1 mini (or there should be) - match them, and plug it in.
That's it...
Step 1: Grab the Code, Setup the Arduino IDE, and Program!
The Code can be found here: https://github.com/kd8bxp/Simple-Moving-Message-WI...
There are a few libraries that also need to be installed, and if you haven't done so - you will need to install the ESP8266 boards into the Arduino IDE.
Follow the instructions here to add the boards:
https://github.com/esp8266/Arduino
We need to included a wemos_matrix_gfx library made by Thomas Fredericks. This really couldn't have been made without his library. I also submitted a couple of "examples" for him to include in the examples. You should check those out too! I'm almost positive you'll have to install this manually - either by using the "Add .ZIP file" or just unzip/rename the folder, and copy it to the libraries directory in your Arduino folder.
The other libraries you will need are in the library manager - so they should be easier to install.
Adafruit_GFX library more information can be found here: https://github.com/adafruit/Adafruit-GFX-Library
and PubSubClient library https://github.com/knolleary/pubsubclient
Once you have all that installed, open my sketch: d1_mini_matrix_wifi_display.ino
Near line 40 you'll find where you need to put your router informations - SSID, and PASSWORD.
I am using a public MQTT broker (test.mosquitto.org) it's not secure so don't send anything sensitive. If you wish to use your own broker, or a different broker - you can change that here.
(See my instructable on using a Raspberry PI Zero W as a AP and MQTT Broker if you want to set up your own broker)
It is also probably a good idea to change the "subTopic" - on line 45. Otherwise your display could display messages you don't to see. And you could publish messages to other peoples displays.
Want to learn a bit more about MQTT - I have a previous project that I explain it a bit more found here:
ESP32/ESP8266 WIFI Display Using MQTT Protocol. (step 4 & 5)
Briefly MQTT is a simple publish/subscribe lightweight messaging protocol designed for constrained devices and low bandwidth, high latency or unreliable networks. Making it nice for IoT devices.
Step 2: Publish Your Message.
In order to publish your message you need a MQTT client, there are a lot of them out there. And even some that have a web interface (using Websockets) - I go into great detail on installing and using a MQTT broker in my previous WIFI display instructable. (step 5). Let's keep it simple, and use a Websocket.
http://test.mosquitto.org/ws.html you'll see a "connect" button, a 'Topic' form, and a 'Payload' form. (Payload = message). You'll want to make sure you are connected to the broker, type in your topic name (matrixDisplay10), and type your message into the payload. Click publish and you should see a message on your display.
In the picture above I am using the linux mosquitto client, The idea is the same -
mosquitto_pub -h test.mostquitto.org -t "matrixDisplay10" -m "This is a message"
That is about it, a nice simple Matrix WiFi Display....I hope you enjoy. Thank you!