Led display with bluetooth

jbremnant’s blog

bluetooth module

I came across this neat bluetooth module called HC-06. It can be found as cheap as $6 on ebay, and gives you convenient UART access to bluetooth wireless capabilities.

My 3yr old has this home-made LED clock in his room. I thought it was time for an upgrade since the clock was very minimalistic. Its only function was to keep track of time and display it on the LED panel. And considering it was my first “completed” project with avr (atmega168), I thought I could make it better this time around.

I wanted to make use of bluetooth capability somehow, and thought it would be neat to send a text message to the display. In addition, I decided change up a few things:

  • receive bluetooth text message up to 64 chars and scroll it across the panel
  • set the time via bluetooth
  • consolidate 2 push buttons into 1 for manual time adjustment
  • make some noise with the piezo I put in there

The upgrade seems to have worked out nicely. I can send messages to it from my Android phone or from a Linux PC with bluetooth dongle attached. I used iteadstudio’s bluetooth assistant app to send text to the display.

The HC-06 module needs a bit of setting up before it can be used. On the internet, usually there are two variants of this module: HC-05 and HC-06. AFAIK, the hardware is identical across both modules, but the firmware is not. The main difference is that HC-05 is slave-only, whereas HC-06 can act as both master and slave.

These modules support AT commands which can be used to configure the bluetooth hardware. For example, you can change the passcode used in pairing (default: 1234) or change the baud rate. In order to issue the AT commands against it, you will need to put the chip into CMD mode. The easiest way to interface HC-06 chip is through FTDI over USB. If you own an Arduino or an FTDI breakout, you will need to make the corresponding TX/RX connections from the FTDI chip to HC-06 in order to be able to talk to it. I bought the Arduino bluetooth shield from iteadstudio, which conveniently makes all the pins accessible.

You will need to attach to the virtual device on Linux that represents the FTDI chip. On Ubuntu, that’s usually /dev/ttyUSB0. I use “minicom” for serial comm:

minicom -D /dev/ttyUSB0 -b 38400

But it’s usually good to just run

and configure the serial port manually. Make sure both the software and the hardware flow control is turned off.

Once the connection is made, verify that HC-06 module can respond to the commands. As soon as you type

it should repeatedly send back:

Here is the bare minimum AT commands I had to issue to configure the HC-06 module for my setup:

# set as slave
AT+ROLE=0
# set uart baud rate with stopbit, no parity
AT+UART=38400,1,0
# connect to any address
AT+CMODE=1

Читайте также:  2006 volvo xc90 bluetooth

Once the module is configured, it needs to be reset into “DAT” mode. This is the mode that can send/receive data from master nodes that are paired up against it. Remember that the “CMD” mode is only used for issuing AT commands for modifying the config on the chip.

A Bit About the Hardware & Firmware

The LED panel is relatively cheap, and is sold by Sure Electronics. Its dimension is 8×32, which makes 256 individual LED’s that can be manipulated. These panels contain a driver chip, HT1632, which makes every LED on the panel addressible with just 3 pins. The source file ht1632.[hc] contains the logic to communicate with the driver chip, and supports rudimentary functions to draw, print limited set of fonts, and scroll text across the panel.

I am a total noob when it comes to PCB design, soldering, and circuitry. The mini breadboard serves me well here. I don’t need to keep highly accurate time, and don’t mind a minute or two drift per year benchmarked against the “true” time. There are a few electrical properties that creates this time deviation. But simply put, this “small” time drift can happen when the oscillations produced by the 32.678kHz crystal is affected by things like inherent capacitance (more like parasitic) in the breadboard, temperature, overall integrity of the circuitry, etc… In any case, I am not overly concerned about accuracy, and this toy is not designed to keep military-grade time!

Only few parts are needed to build the necessary circuit to recreate this:

  • 1 atmega168
  • 1 HC-06 module (possibly on breakout board)
  • 1 32.678kHz crystal oscillator
  • 1 push button
  • 1 breadboard & couple of jumper wires
  • 1 piezo buzzer
  • few discrete components: 2 resistors, 1 capacitor
  • Lego blocks

And lastly, the firmware. The main source “clockdisplay.c” implements time keeping and processing data received via UART. It keeps track of hours, minutes, and seconds via software using interrupts. The interrupt is triggered each second, and 32.678kHz is chosen precisely for this reason. It has a frequency that is exactly 2^15. Therefore, the hardware counters are much more conducive to scaling by factors of 2. For example, the hardware registers are configured so that the ticks are generated exactly at multiples of 2. The function below sets up atmega168’s timer counters so that the interrupt is generated exactly 1 second apart.

Within the interrupt routine, the following function is called to update the global volatile variables that keeps track of hours, minutes, seconds:

void update_datetime(uint8_t noincrement) < if(!noincrement) seconds++; if(seconds >= 60) < seconds = 0; minutes++; >if(minutes >= 60) < minutes = 0; hours++; >if(hours >= 24) < hours = 0; days++; if( (days == 32) || (days == 31 && months == (4|6|9|11)) || (days == 30 && months == 2 && leap_year != 0) || (days == 29 && months == 2 && leap_year == 0) ) < days = 1; months++; if(months == 13) < months = 1; years++; if( (years % 400 == 0) || (years % 4 == 0 && years % 100 != 0) ) < leap_year = 1; >else < leap_year = 0; >> > > >

The interrupt is generated from this auxiliary clock source (crystal oscillator), but what about the execution of the main code block? I use the internal clock on Atmega168 to run the main code, the part that processes UART data, displaying text on LED panel, etc… The mcu is configured to run at 8MHz and this requires fuse settings to be modified. You can run this command to change the fuse bits. (WARN! misuse of this command can brick the chip) Modifying the fuse bits can be done using AVR ISP programmers. I used a cheap clone.

avrdude -F -p m168 -P usb -c avrispmkII -U lfuse:w:0xE2:m

Читайте также:  Аудио bluetooth адаптер iphone

Adding Bluetooth Capability
Here is the clock going through surgery (hopefully for fine enhancements!). Luckily, I haven’t used up the RXD/TXD pins used by Atmega168’s hardware UART (PD0, PD1). The HC-06 bluetooth module will communicate bi-directionally with the host mcu using only these 2 pins.

The UART interface is a standard serial protocol that relies on baudrate. As such, the RXD/TXD can be connected to other devices that can “talk” UART and will be able to communicate with the mcu. In fact, you can hook up the FTDI chip directly in lieu of HC-06 and manipulate this LED clock directly from a terminal. Any other wireless modules that use the UART serial communication could probably replace HC-06.

That’s it! The hardware setup is simple and rest of the communication is then managed by the software on the Android app. The firmware simply accepts characters from the uart library, acts on the command being sent, and then echo’s back some confirmation characters. The uart library for atmega168 is also very simple, and it’s the one I have been using with the nerdkit when I first got into mcu’s.

Источник

Arduino LED Display With Bluetooth Control

license

Introduction: Arduino LED Display With Bluetooth Control

Arduino Smart POV

Wifi Controlled Car / IOT Bot

In this instructable, we will be making 32X8 LED Matrix display that will have the functionality of changing the Text Message with our smartphone in real time and will make our own the app using MIT App Inventor.

So, friends lets get started with this cool and awesome project.

Step 1: Designing Our PCB on Fritzing

We have designed the PCB on Fritzing, which is an open-source hardware initiative that makes electronics accessible as a creative material for anyone.

It is a 2 layered PCB design where we have perfectly packed our required stuff very neatly.

Now it is time to export the Gerber file and order our PCBs.

Step 2: Order Our PCBs at Very Low Cost From JLCPCB

Once, you have created the zip folder of your PCB’s Gerber file.Now, it is the time to upload the file to JLCPCB and make the requirements accordingly like selecting the masking as black, which i have did for my PCBs. If, you are looking for the best quality PCBs for your projects than JLCPCB is the best option to go for.

They are offering 10 PCBs for just 2$ with shipping extra and I find it as the best deal available.

So, Where to prototype 10 PCBs for $2 only: https://jlcpcb.com

Step 3: Components Required :

  • Arduino (NANO or UNO)
  • Bluetooth module HC-05
  • LEDs ( 32X8= 256 pcs)
  • MAX7219 LED matrix driver IC ( 4 Pcs)
  • 10uF capacitor ( 4 pcs)
  • 100nF capacitor ( 4 pcs)
  • 40K Resistor (4 pcs)
  • Connectors, solder, wires, tools, etc.

Step 4: Working

Here, we have created 4 matrices each of 8X8 LEDs. Each MAX7219 driver can handle a 64 LEDs matrix. The Arduino will send the data using a serial communication. So we have to connect the clock and load pins from the Arduino to all MAX7219 drivers. The data pin will be only connected to the first driver. From the «data out» pin of the first driver, we will connect a wire to the second «Data» of the second driver and so on. That’s how we connect four 8×8 matrices in series. We should also connect the Bluetooth module to the Tx and Rx pins of the Arduino and supply 5V to it and to each of the MAX7219 drivers.First, let’s take a look on how to connect each of the 8×8 matrices. Once we have our 4 matrices we can join them together with the «data out» «data in» pins.

Читайте также:  Подключить клавиатуру через bluetooth

Источник

8×8 LED MATRIX DISPLAY | ARDUINO | BLUETOOTH CONTROL

license

Introduction: 8×8 LED MATRIX DISPLAY | ARDUINO | BLUETOOTH CONTROL

LINE FOLLOWER ROBOT || ARDUINO CONTROLLED

Vending Machine||candy Dispenser|| Arduino Bluetooth Controlled||DIY

SIMPLE CARBOT || ARDUINO || BLUETOOTH CONTROL || TUTORIAL

About: i love electronics and enjoy making tutorials so that i can share my experience with others 🙂 ALTHOUGH THE TRUTH IS I LOVE IT WHEN PEOPLE SAY THEY LIKE MY WORK ☺ More About magichtg »

In this tutorial i show how to build a 8 x 8 LED matrix using an Arduino .

DO COMMENT WHAT YOU THINK ABOUT THIS INSTRUCTABLE,SO THAT I CAN IMPROVE IN MY FURTHER INSTRUCTABLES

have a look at the video tutorial for a better understanding of the entire tutorial.

PARTS NEEDED:

JUMPER WIRES

☻CARDBOARD PIECE(16 CM BY 16CM)

ARDUINO UNO

LAPTOP OR PC (FOR UPLOADING CODE TO ARDUINO

POWER SUPPLY ( I USED A POWER BANK TO SAVE BATTERIES)

Step 1: ASSEMBLE THE CIRCUIT USING CARDBOARD SHELL

PUT IN ALL THE 64 LEDs IN THE CARDBOARD PC AS SHOWN

Step 2: SOLDER THE LEDS AS PER THE CIRCUIT DIAGRAM

FIRST SOLDER THE POSITIVE TERMINALS OF THE LEDS ROW WISE

NEXTBENDTHE NEGATIVE TERMINALS A LITTLE BIT AND SOLDER THEM COLUMN WISE (AS SHOWN) ACCORDINGLY.

EDIT: JUST ADDED FEW EXTRA IMAGES TO UNDERSTAND THE SOLDERING PART A LITTLE BETTER

Step 3: SOLDER JUMPER WIRES AND POP THE CIRCUIT OUT

SOLDER 8 JUMPER WIRES IN THE ROWS AND 8 JUMPER WIRES IN THE COLUMN .

FINALLY POP THE CIRCUIT OUT OF THE CARDBOARD SHELL

Step 4: ARDUINO

CONNECT THE AURDUINO WITH THE LED MATRIX

CONNECT EACH OF THE COLUMN TO PIN 2,3,4,5,6,7,8,9 RESPECTIVELY

ALSO,CONNECT EACH OF THE ROW TO PIN 10,11,12,13,14,15,16,17 RESPECTIVELY.

FINALLY UPLOAD THE FINAL CODE TO THE AURDUINO THROUGH THE CONNECTING WIRE

To download the final code go to the below link :

Step 5: CONNECT BLUETOOTH

CONNECT THE BLUETOOTH DEVICE HC-05 TO THE AURDUINO:

connect rx of bluetooth to tx of arduino

connect tx of bluetooth to rx of arduino

Step 6: Download Android Application

download arduino bluetooth controller from playstore

Step 7: Let’s Play With the App

click on connect and select your bluetooth device .

congratulations!! you have a working led matrix display controlled via bluetooth

Arduino Contest 2017

Remote Control Contest 2017

LED Contest 2017

1 Person Made This Project!

  • 8x8 LED MATRIX DISPLAY | ARDUINO | BLUETOOTH CONTROL

Did you make this project? Share it with us!

Recommendations

High Contrast Braille Keypad With Indicator Lights

AI-assisted Pipeline Diagnostics and Inspection W/ MmWave

ESP32-Powered Tabletop Kinetic Sand Drawing Robot

Touch Cam - a Raspberry Pi Camera

Project-Based Learning Contest

Project-Based Learning Contest

Wear It Contest

Wear It Contest

Make It Bridge

Make It Bridge

20 Comments

rishitmordani

pls help it is not working
error:
failed to open this sketch «C:\Users\Office\Downloads\led_matrix_8x8 final code\led_matrix_8x8 final code.ino»

rishitmordani

pls help not working it is showing
«C:\Users\Office\Downloads\led_matrix_8x8 final code\led_matrix_8x8 final code.ino»
failed to open this sketch

azizabzi

Can we not use 8×8 matrix LEDs instead of assembling 64 leads in the matrix form? It makes things easy. I hope your code should still work.

magichtg

YOU MAY BUT THE CODE WON’T WORK I GUESS. ALSO THIS IS MORE FUN TO ASSEMBLE 🙂

azizabzi

Thank you for the prompt reply. I also believe that the code won’t work.

GourinathK

I did everything with 8*8 matrix display.
Lights are blinking when we give commands in mobile.
What can I do now

botgames

Hi, I can’t open the sketch. I keep getting errors. Could not create the sketch and Failed to open sketch:»C:\Users\Office\Downloads\led_matrix_8x8 final code\led_matrix_8x8 final code.ino» Do you have another link to the sketch. I’ve spent 2 days making this and I’m really want to finish. Any help would be greatly appreciated.

Newoldbuilder

Very nice. I voted for all 3 categories. What is the spacing of the LEDs?
Will the HC-05 work with the iPhone?

magichtg

Ya i guess app is available in the app store

toasterizer

Nicely done. If you could put 3 or 4 of them together you could make a nice scrolling display.

magichtg

yeah nice idea. would try to do that soon 🙂

Источник

Оцените статью
Adblock
detector