Raspberry Pi - Bluetooth LED Matrix
This tutorial instructs you how to control an LED matrix display with a smartphone through either Bluetooth or BLE. The Raspberry Pi has Bluetooth Low Energy (BLE) capabilities built-in, so we do not need to use an external Bluetooth module.
To send messages from the smartphone to the LED matrix display, we will use the Bluetooth Serial Monitor App. Once the message is received by Raspberry Pi, it will be displayed on the LED matrix display.
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables.
Overview of LED matrix display and Bluetooth Module
Before beginning this tutorial, it is suggested that you have a fundamental comprehension of LED matrix displays and Bluetooth modules, including their pinouts, how they work, and how to program them. If you are not familiar with these concepts, please look over the following tutorials for additional information:
- Raspberry Pi - LED Matrix Display tutorial
- Raspberry Pi - Bluetooth tutorial
- Raspberry Pi - BLE tutorial
Wiring Diagram
- To control the LED matrix display with Classic Bluetooth, We need to use the HC-05 Bluetooth module
This image is created using Fritzing. Click to enlarge image
- To control the LED matrix display with BLE, We need to use the HM-10 BLE Module
This image is created using Fritzing. Click to enlarge image
Raspberry Pi Code - controls LED matrix display via Bluetooth/BLE
The code can be used for both the HC-10 Bluetooth module and the HM-10 BLE module. It will be effective in both cases.
Detailed Instructions
- Make sure you have Raspbian or any other Raspberry Pi compatible operating system installed on your Pi.
- Make sure your Raspberry Pi is connected to the same local network as your PC.
- Make sure your Raspberry Pi is connected to the internet if you need to install some libraries.
- If this is the first time you use Raspberry Pi, See how to set up the Raspberry Pi
- Connect your PC to the Raspberry Pi via SSH using the built-in SSH client on Linux and macOS or PuTTY on Windows. See to how connect your PC to Raspberry Pi via SSH.
- Make sure you have the RPi.GPIO library installed. If not, install it using the following command:
- Enable the SPI interface on Raspberry Pi by following the instruction on Raspberry Pi - how to enable SPI inteface
- Enable the Serial interface on Raspberry Pi by following the instruction on Raspberry Pi - how to enable Serial inteface
- Install the luma.led_matrix library using the following command:
- Install the pyserial library for communication with bluetooth module:
- Create a Python script file bluetooth_led_matrix.py and add the following code:
- Save the file and run the Python script by executing the following command in the terminal:
- Download the Bluetooth Serial Monitor App to your smartphone.
- Launch the Bluetooth Serial Monitor App on your smartphone.
- Select either Classic Bluetooth or BLE, depending on the module being used.
- Connect the Bluetooth App to the HC-05 Bluetooth module or the HM-10 BLE module.
- Type a message, for example “HELLO”
- And then press the Send button
- To transmit it to the Raspberry Pi.
- Take a look at the message that is shown on the LED matrix display and the Bluetooth App.
- Check the output on the Android App.
If you discovered the Bluetooth Serial Monitor app to be useful, please think about giving it a 5-star rating on the Play Store. Your opinion is highly valued! Thank you!