Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Bluetooth-Controlled LED Matrix

IOT102-SE1825, Group 9

Ngo Khai Nguyen, Ngo Dang Khoa, Tran Tien Dat, Ngo Tran Quan, and Le The Dung
FPT University, Ho Chi Minh Campus, Vietnam
{nguyennkse150947, khoandse182731, datttse172487, quanntse160230}@fpt.edu.vn, dunglt96@fe.edu.vn
Abstract
In this project, we created a system that lets people control and display content on an LED matrix using Bluetooth connectivity.
Our setup includes an 8x32 LED matrix, a Bluetooth module, a DS1307 module to get the date and time, and an LM35 sensor
to measure the temperature. With this setup, users can connect their smartphones to the Bluetooth module through a specially
designed mobile app. This app allows them to manage and customize what is shown on the LED matrix from their phones, making
it very convenient and user-friendly.
The system continuously collects the latest date, time, and temperature from the DS1307 and LM35 modules. Users have the
option to display this information or to show custom text with various effects, making the display more engaging and personalized.
The system operates in two distinct modes: automatic and manual. In automatic mode, it cycles through displaying the date, time,
and temperature, ensuring that users always have the most up-to-date information. In manual mode, users can input and display
any custom text they want, providing a high level of customization.

I. I NTRODUCTION
This project focuses on developing a Bluetooth-controlled LED matrix system that allows people to control and display
various information on an LED screen. The system includes several important components, such as a Bluetooth module for
wireless communication, an 8x32 LED matrix for displaying content, a DS1307 real-time clock for getting the current date
and time, and an LM35 temperature sensor for measuring the temperature.
The main goals of this project are to accurately display the date, time, and temperature data and to give users the ability to
customize what appears on the LED matrix using a mobile app. This means that users can connect their smartphones to the
system via Bluetooth and use the app to change and control the display.
The system features two main modes of operation. In automatic mode, the LED matrix continuously shows real-time data,
including the current date, time, and temperature. This is useful for users who want to keep track of important information
without having to manually update it. In manual mode, users can display custom text with different visual effects, allowing
for greater personalization and creativity. This mode is perfect for displaying messages, names, or any other text that the user
wants.
II. M ETHODS AND M ATERIALS
A. System Model and Block Diagram

Fig. 1. Block diagram of the developed system.

B. Components and Peripheral Devices


Arduino
The Arduino acts as the central processing unit (CPU) in this project, managing and coordinating the various components
of the Bluetooth-controlled LED matrix system. It runs programs to handle data retrieval, processing, and display functions.
The Arduino fetches date and time data from the DS1307 real-time clock module and collects temperature readings from the
LM35 sensor, preparing this information for display on the 8x32 LED matrix. It controls what content is shown, including
date, time, temperature, and custom text, and handles different display modes: an automatic mode that cycles through date,
time, and temperature, and a manual mode for custom text with various effects.

Fig. 2. Arduino.

Bluetooth Module
The Bluetooth module plays a crucial role in the project by establishing wireless connectivity between he LED matrix
system and external devices like smartphones. Through a dedicated mobile app, users can connect to the module to toggle
between automatic mode, which displays real-time date, time, and temperature, and manual mode, where custom text and
visual effects can be showcased on the LED matrix. This bidirectional communication allows users to send commands via
Bluetooth, providing remote control over what is displayed

Fig. 3. BLuetooth HC-05

8x32 LED Matrix with Max7219 Driver


The 8x32 LED Matrix, controlled by the Max7219 driver and interfaced with the Arduino, displays essential information
such as date, time, and temperature in the project. It serves as the main output device, showing real-time data collected from
the DS1307 module for time and the LM35 sensor for temperature. The Arduino communicates with the Max7219 driver
to manage the matrix’s display, ensuring that information is accurately presented in a clear and readable format. This setup
simplifies the interface between the Arduino and the LED matrix, making it an integral part of the system’s functionality for
displaying crucial data to users

Fig. 4. 8x32 LED Matrix

DS1307 Real-Time Clock Module


The DS1307 Real-Time Clock Module independently provides accurate real-time date and time information to the project,
separate from the Arduino’s runtime. Connected via the I2C communication protocol, the Arduino interacts with the DS1307
module to fetch and display precise date and time data on the LED matrix. This setup ensures that the system always displays
up-to-date information without relying on the Arduino’s processing time, enhancing reliability and accuracy in timekeeping
functions within the project
Fig. 5. Ds1307 Module

LM35 Temperature Sensor


The LM35 Temperature Sensor measures ambient temperature and is connected to the Arduino’s analog input. This sensor
provides accurate temperature readings, which the Arduino processes and uses to display temperature information on the LED
matrix. By continuously monitoring the temperature through the LM35 sensor, the system can provide real-time updates on
environmental conditions, enhancing the project’s functionality in temperature monitoring applications.

Fig. 6. LM35 Sensor

TABLE I
I NTERFACING BETWEEN A RDUINO AND ITS COMPONENTS

Arduino Bluetooth Module DS1307 Module LM35 Sensor LED Matrix


GND GND GND GND GND
5V VCC VCC VCC VCC
RX (D0) TX
TX (D1) RX
A0 (Analog Input) Analog Output
SDA (I2C) SDA Data Input
SCL (I2C) SCL Clock Input
D2-D7 (Digital) Data, Clock, Latch

C. Software Programming
Adruino, IDE Android app: Serial Bluetooth Terminal
CODE:
# include <Wire . h>
# include <RTClib . h>
# include <MD Parola . h>
# include <MD MAX72xx . h>
# include < S o f t w a r e S e r i a l . h>

/ / Pin d e f i n i t i o n s f o r LED m a t r i x
# define HARDWARE TYPE MD MAX72XX : : FC16 HW
# define MAX DEVICES 4
# define CLK PIN 13
# define DATA PIN 11
# define CS PIN 10
/ / B l u e t o o t h module p i n s
# d e f i n e BLUETOOTH RX 1
# d e f i n e BLUETOOTH TX 0

S o f t w a r e S e r i a l B l u e t o o t h (BLUETOOTH RX, BLUETOOTH TX ) ; / / RX , TX


MD Parola m y D i s p l a y = MD Parola (HARDWARE TYPE, CS PIN , MAX DEVICES ) ;
RTC DS1307 r t c ;
DateTime now ;

char r e c e i v e d D a t a [ 5 0 ] = ” ” ;
b o o l manualMode = f a l s e ;

void s e t u p ( ) {
S e r i a l . begin (9600);
Bluetooth . begin (9600);
Wire . b e g i n ( ) ;
r t c . begin ( ) ;

myDisplay . begin ( ) ;
myDisplay . setIntensity (3); / / S e t b r i g h t n e s s (0 −15)
myDisplay . s e t T e x t A l i g n m e n t ( PA CENTER ) ;
myDisplay . setPause (1000); / / Pause b e t w e e n e f f e c t s

if (! rtc . isrunning ()) {


S e r i a l . p r i n t l n ( ” RTCisNOTrunning ! ” ) ;
r t c . a d j u s t ( DateTime ( F ( DATE ) , F ( TIME )));
}
}

void loop ( ) {
readBluetooth ( ) ;
i f ( manualMode ) {
displayManualMode ( ) ;
} else {
displayAutomaticMode ( ) ;
}
}

void r e a d B l u e t o o t h ( ) {
s t a t i c byte index = 0;
while ( Bluetooth . a v a i l a b l e ( ) > 0) {
char r e c e i v e d C h a r = B l u e t o o t h . r e a d ( ) ;
i f ( r e c e i v e d C h a r == ’ \ n ’ ) {
r e c e i v e d D a t a [ i n d e x ] = ’ \0 ’ ; / / N u l l − t e r m i n a t e t h e s t r i n g
processCommand ( r e c e i v e d D a t a ) ;
index = 0;
} else {
r e c e i v e d D a t a [ i n d e x ++] = r e c e i v e d C h a r ;
i f ( i n d e x >= s i z e o f ( r e c e i v e d D a t a ) ) {
index = s i z e o f ( receivedData ) − 1;
}
}
}
}

v o i d processCommand ( char * command ) {


i f ( s t r n c m p ( command , ”DATE TIME” , 9 ) == 0 ) {
displayDateTime ( ) ;
manualMode = f a l s e ; / / E x i t manual mode i f switched to automatic
} e l s e i f ( s t r n c m p ( command , ”TEMPERATURE” , 1 1 ) == 0 ) {
displayTemperature ( ) ;
manualMode = f a l s e ; / / E x i t manual mode i f switched to automatic
} e l s e i f ( s t r n c m p ( command , ”MANUAL MODE” , 1 1 ) == 0 ) {
manualMode = t r u e ; / / E n t e r manual mode
} else {
d i s p l a y C u s t o m T e x t ( command ) ;
manualMode = t r u e ; / / E n t e r manual mode
}
}

void displayDateTime ( ) {
now = r t c . now ( ) ;
char d a t e T i m e S t r i n g [ 2 0 ] ;
s p r i n t f ( d a t e T i m e S t r i n g , ”%02d :%02 d %02d−%02d−%04d ” , now . h o u r ( ) , now . m i n u t e ( ) , now . day ( ) , now
m y D i s p l a y . d i s p l a y T e x t ( d a t e T i m e S t r i n g , PA CENTER , 0 , 0 , PA SCROLL LEFT , PA SCROLL LEFT ) ;
}

void d i s p l a y T e m p e r a t u r e ( ) {
i n t rawADC = a n a l o g R e a d ( A0 ) ;
f l o a t t e m p e r a t u r e = ( rawADC / 1 0 2 3 . 0 ) * 5 0 0 . 0 ; / / LM35 c a l i b r a t i o n f o r 10mV p e r d e g r e e C e l s i u
char t e m p S t r i n g [ 1 0 ] ;
s p r i n t f ( t e m p S t r i n g , ” %.2 fC ” , t e m p e r a t u r e ) ;
m y D i s p l a y . d i s p l a y T e x t ( t e m p S t r i n g , PA CENTER , 0 , 0 , PA SCROLL LEFT , PA SCROLL LEFT ) ;
}

v o i d d i s p l a y C u s t o m T e x t ( char * t e x t ) {
m y D i s p l a y . d i s p l a y T e x t ( t e x t , PA CENTER , 0 , 0 , PA SCROLL LEFT , PA SCROLL LEFT ) ;
}

void displayManualMode ( ) {
/ / Display custom t e x t r e c e i v e d v i a B l u e t o o t h
displayCustomText ( receivedData ) ;
}

void displayAutomaticMode ( ) {
/ / D i s p l a y d a t e / t i m e and t e m p e r a t u r e i n s e q u e n c e
displayDateTime ( ) ;
delay (3000); / / Display date / time for 3 seconds

displayTemperature ( ) ;
delay (3000); / / Display temperature for 3 seconds
}

D. Programming Flowchart
In the Bluetooth-controlled LED matrix system, data input is received via Bluetooth from a smartphone. It connects to
retrieve either current date, time, and temperature automatically or custom text input manually. The system initializes modules
and attempts connection retries until successful. Depending on the mode chosen—Automatic or Manual—it processes data
from DS1307 and LM35 or custom text input. Data is then displayed on the LED matrix accordingly, providing real-time
information or user-defined messages with dynamic visual effects
Fig. 7. Flowchart

III. R ESULTS AND D ISCUSSION


A. Prototype Implementation
Describe how to implement the developed system in practice.
B. Experimental Results
Include illustrative figures showing the system’s operations in different scenarios. Give comments on the results in all figures.
C. Discussion
Give some discussions about the overall results, the advantages and disadvantages of the developed system.
IV. C ONCLUSION
Give a clear and concise description of the project’s outputs and the future directions for improving the developed system.

You might also like