LED Display Over Bluetooth With Android
Old Clock Redux
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
Flashing uC’s with GoodFET
I got myself one of GoodFET40 PCB’s the other day. The pcb is thin! But not only that, it requires you to surface mount some parts. Now, I haven’t done SMD soldering before so I enlisted help of one of my buddies. It didn’t go so well the first time, but I did manage to get the GoodFET firmware installed.
Once soldering is done, you first need to load goodfet firmware onto the main chip. For GoodFET40’s, it uses MSP430F2618. This chip allows you to load the firmware via Bootstrap Loading (BSL). I am not entirely sure how this works, but it seems to require a password to have it enabled so that you can bit-bang the firmware into the chip bytes or words at a time.
./goodfet.bsl --fromweb
This command will require you to have pre-installed:
– pyserial
– pysqlite
– curl
I’ve also tried
# --fromweb retrieves the precompiled hex from the web and stashes it to /tmp ./goodfet.bsl -e -p /tmp/.goodfet.hex
Now, once your GoodFET is programmed, you can test by
./goodfet.monitor test
If all goes well, you shouldn’t see any error or warning messages. For me, the results of the test were inconsistent between 2 different Ubuntu versions. (UPDATE: Kenneth has found a solution for errors I was getting on Ubuntu 10.04.) I am not sure if this due to FTDI drivers being different or some quirky differences in python serial library. I had intermittent timeouts. (The goodfet code seems to have defined timeout at 2 seconds).
In any case, once you have 1) hardware built 2) goodfet firmware loaded, it’s time to program your target chips.
Led Matrix Canvas
I wanted something “flashy” that grabs my attention when I am working. I am flooded with constant influx of emails, internal chat windows, and many terminal screens full of code. Sometimes it’s hard to get my attention when critical things happen in the trading environment and I notice it too late.
I had 2 of sure electronics 16×24 led matrix boards laying around. So I set out to create a led matrix “canvas” out of these 2 display boards. I didn’t want just a simple led display board. I wanted to build something flexible that can make the best out of our precious LED “real estate”. I envisioned something that I can easily control from a host PC. To make matters more complex, I not only wanted scrolling text messages, but render monochrome animations and images through it.
I didn’t think it’d be feasible to implement _all_ the functionalities I wanted into teensy firmware. One may argue that this is possible ( Peggy seems to have implemented lots of features into firmware), but I thought it’d be cooler to leave the complex image/animation processing on the host PC-side. I’ve decided to make teensy code concentrate on deciphering the drawing “commands”, and offload content generation on the host PC.
When you do a google search of led matrix boards, you can find tons of neat projects out there. However, many of them lack explanation or sufficient documentation on them. I am not sure if folks might find this project interesting or useful at all. I certain learned a lot from it, and herein I describe the details of this project hoping that it can be of use to someone who’s aiming to do something similar.
For the Impatient
Here’s the demo video of the project.
Parts/tools used:
- Teensy 2.0
- 2 x Sure Electronics LED Boards
- 2 female headers
- 2 male headers (2×5)
- Protoboard for wiring parts together
- C lib for communicating with ht1632 driver on led matrix board
- C lib for usb_serial
- C code to parse commands and control led matrix
- Python code to translate imgs, text, and 3D cube into commands
- PySerial lib to sent over serial device : /dev/ttyACM0
And here’s the source code for download. If you are on a linux box, you can simply run “make” in the project directory.
Now, if you want to know the details, continue reading below.