ESP8266 - Bluetooth LED Matrix

This tutorial instructs you how to use ESP8266 control an LED matrix display with a smartphone through Bluetooth or BLE.

We will have two different modules to choose from: HC-05 for Classic Bluetooth (Bluetooth 2.0) and HM-10 for Bluetooth Low Engery (BLE, Bluetooth 4.0). The tutorial will provide step-by-step instructions for both modules.

To send messages from the smartphone to the ESP8266, we will use the Bluetooth Serial Monitor App. Once the message is received by ESP8266, it will be displayed on the LED matrix display.

ESP8266 NodeMCU LED matrix display Bluetooth

In detail, we will learn:

Hardware Preparation

1×ESP8266 NodeMCU
1×Micro USB Cable
1×HC-05 Bluetooth Module
1×(Alternative) HM-10 BLE Module
1×LED matrix display
1×Breadboard
1×Jumper Wires
1×(Optional) 5V Power Adapter for ESP8266
1×(Optional) ESP8266 Screw Terminal Adapter

Or you can buy the following sensor kit:

1×DIYables Sensor Kit 30 types, 69 units
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you. We appreciate your support.

Overview of LED matrix display and Bluetooth Module

Prior to beginning this tutorial, it is suggested that you have a fundamental comprehension of LED matrix displays and Bluetooth modules, including their pinouts, how they operate, and how to code them. If you are not acquainted with these topics, please take a look at the following tutorials for more information:

Wiring Diagram

  • To control the LED matrix display with Classic Bluetooth, the HC-05 Bluetooth module must be connected to ESP8266 as per the wiring diagram below:
The wiring diagram between ESP8266 NodeMCU and LED matrix display Bluetooth

This image is created using Fritzing. Click to enlarge image

See more in ESP8266's pinout and how to supply power to the ESP8266 and other components.

  • To control the LED matrix display with BLE, you can utilize the HM-10 Bluetooth module and connect it to ESP8266 in accordance with the wiring diagram below:
The wiring diagram between ESP8266 NodeMCU and LED matrix display BLE

This image is created using Fritzing. Click to enlarge image

ESP8266 Code - controls LED matrix display via Bluetooth/BLE

The following code is applicable for both the HC-10 Bluetooth module and the HM-10 BLE module. It will function correctly with either one.

/* * This ESP8266 NodeMCU code was developed by newbiely.com * * This ESP8266 NodeMCU code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp8266/esp8266-bluetooth-led-matrix */ #include <SoftwareSerial.h> #include <MD_Parola.h> #include <MD_MAX72xx.h> #define HARDWARE_TYPE MD_MAX72XX::FC16_HW #define MAX_DEVICES 4 // 4 blocks #define CS_PIN 9 #define SOFT_RX D2 // The ESP8266 pin connected to the TX of the bluetooth module #define SOFT_TX D1 // The ESP8266 pin connected to the RX of the bluetooth module SoftwareSerial bluetooth(SOFT_RX, SOFT_TX); // create an instance of the MD_Parola class MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); void setup() { Serial.begin(9600); bluetooth.begin(9600); ledMatrix.begin(); // initialize the object ledMatrix.setIntensity(0); // set the brightness of the LED matrix display (from 0 to 15) ledMatrix.displayClear(); // clear LED matrix display } void loop() { if (Serial.available()) { // if there is data comming String text = Serial.readStringUntil('\n'); // read string until meet newline character ledMatrix.displayClear(); // clear led matrix display ledMatrix.displayScroll(text.c_str(), PA_CENTER, PA_SCROLL_LEFT, 100); bluetooth.print("LED Matrix displayed: ");// reports action to smartphone app bluetooth.println(text); } if (ledMatrix.displayAnimate()) { ledMatrix.displayReset(); } }

Detailed Instructions

To get started with ESP8266 on Arduino IDE, follow these steps:

  • Check out the how to setup environment for ESP8266 on Arduino IDE tutorial if this is your first time using ESP8266.
  • Wire the components as shown in the diagram.
  • Connect the ESP8266 board to your computer using a USB cable.
  • Open Arduino IDE on your computer.
  • Choose the correct ESP8266 board, such as (e.g. NodeMCU 1.0 (ESP-12E Module)), and its respective COM port.
  • Click to the Libraries icon on the left bar of the Arduino IDE.
  • Search for “MD_Parola” and locate the MD_Parola library.
  • Then, press the Install button.
ESP8266 NodeMCU MD_Parola library
  • You will be asked to install the “MD_MAX72XX” library
  • Click Install All button to install the dependency.
ESP8266 NodeMCU MD_MAX72XX library
  • Install the Bluetooth Serial Monitor App on your smartphone.
  • Take the code given and open it in the Arduino IDE. Upload the code to your ESP8266. If you have trouble uploading, try disconnecting the TX and RX pins from the Bluetooth module, upload the code, and then reconnect the RX/TX pins.
  • Open the Bluetooth Serial Monitor App on your smartphone.
  • Choose the Classic Bluetooth or BLE option, depending on the module you are using.
Bluetooth Serial Monitor App
  • Connect the Bluetooth App to the HC-05 Bluetooth module or the HM-10 BLE module.
Bluetooth Serial Monitor pairing
  • Type a message, such as “HELLO”, and press the Send button to transmit it to the ESP8266.
Bluetooth Serial Monitor App
  • Examine the message that appears on the LED matrix display and the Bluetooth App.
  • Confirm the outcome on the Android App.
Bluetooth Serial Monitor App

If you found the Bluetooth Serial Monitor app to be useful, please consider giving it a 5-star rating on the Play Store. Your feedback would be much appreciated! Thank you!

Video Tutorial

Function References

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!