Shop OBEX P1 Docs P2 Docs Learn Events
Interface to a cheap LED badge display — Parallax Forums

Interface to a cheap LED badge display

DuctapemasterDuctapemaster Posts: 90
edited 2007-06-10 17:08 in Robotics
Every time my dad goes on a business trip, he always brings home tons of "chotchkies". Most of it is just stuff like silly putty, pens, and other random company branded items. But, this year was different. I got the usual stuff, but something special shocked.gif was in this years batch of random items:

attachment.php?attachmentid=47382

So, this 'display badge' is cool in itself. It's basically a programmable dot matrix display that scrolls text. The controls were simple enough, a button that makes the display enter set mode and move to the next character, and two others to scroll up or down through the character list. Here's a pic of the back of the badge:

attachment.php?attachmentid=47380

A pic from when it's on:

attachment.php?attachmentid=47381

So, this got me thinking...I decided upon a computer interface that would take a string of text and output it to the display. But first I had to check out how the thing works. When I looked inside the display, it seemed simple enough to interface. All I had to do was hook a couple of transistors up the switches and control them with my BS2...WRONG! As it turns out, a pair of buttons share a common pin and when pressed, connect that common pin to another pin on the microcontroller. So, I needed a different approach (early testing with transistors as switches didn't turn out so well). I checked my IC stock and found a CD4066 Quad Bilateral Switch. It was the perfect chip for the job. So, I hooked everything up on a breadboard and wrote a simple program to make the display enter set mode and pulse the "up" pin as many times needed to get a certain character to display. It worked, but it needed more.

I soon had it working using a 20 byte array to hold the characters to be displayed, and a combination of LOOKUP and LOOKDOWN tables to make a crude character map. Basically the program scanned the array for the number of valid characters (all unused characters were set to zero), looked up each character in the LOOKDOWN table, looked up the pulses to get to that character in the LOOKUP table, did some math, and pulsed the pin to get the character to display. I had to use this approach because the characters that the display can show don't go in ASCII order and they are quite limited; there's 58 possible characters it can display. The difficult part about all this was that when the display moves to the next character, instead of going back to "A" (the starting character) it keeps the previous character. This is where the 'do some math' comes in handy. The math determines whether the next character comes before or after the previous one, or if it is the same. If the character is after, it simply pulses the remaining number of times to get to that character. If it comes before the previous character, the stamp pulses the display through all possible characters and starts from "A". If the character is the same as the previous one, it just skips to the next letter with no pulses.

The input from the computer comes from the DEBUGIN command. It takes individual characters and maps them to the 20 byte array mentioned above. When a caret (^) is entered, the stamp starts outputting characters to the display. This is so one can have a text string less that 20 characters go out to the display. The caret was chosen as it isn't a character the display can output.

I will attach the code in the next post (I'm at the 5 attachment limit on this one). If you need explanation of any part just ask...

So the final design came out like this:

attachment.php?attachmentid=47383

Here's what the debug terminal looks like:

attachment.php?attachmentid=47379

I did this project mainly because it tested my programming abilities (I'm only 16, so I have limited knowledge of it) and it allowed me to use PBASIC 2.5 for the first time. I had never used some of the commands (LOOKUP and LOOKDOWN) or used arrays before, so it was a good chance to try them out too. I'm one of those people who just can't leave anything the way it is. I always need to change it and make it better...

Let me know what you guys think and if you have any suggestions.

On and BTW, the next step is wireless programming! More on that later...

-Dan

Post Edited (Ductapemaster) : 5/28/2007 5:54:11 PM GMT
640 x 427 - 78K
640 x 427 - 78K
640 x 427 - 59K
640 x 427 - 82K
640 x 427 - 80K

Comments

  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-05-28 07:59
    Here's the code for the thing...
    It's fully commented, so understanding what's going on should be easy

    P.S. I would love to get a video of this in action (It's pretty cool to watch) but sadly, I don't have a video camera and neither do my parents. Sorry!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    sig.png

    Post Edited (Ductapemaster) : 5/28/2007 8:19:46 AM GMT
  • phil kennyphil kenny Posts: 233
    edited 2007-05-29 01:50
    Very nice job of hacking the badge display. Keep it up.

    phil
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-05-29 10:01
    I love this kind of stuff. If you can get a vendor site for the badge to buy one, that would be great (schematics maybe asking for too much though).



    Great job!
  • Rob7Rob7 Posts: 275
    edited 2007-05-29 14:47
    Great project !

    Rob7
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-05-29 22:47
    T&E Engineer said...
    If you can get a vendor site for the badge to buy one, that would be great (schematics maybe asking for too much though).

    I would love to find one, but the only hindering fact is that the box is very sparse. It contains no indication as to a manufacturer. The closest thing to that is "Made in China". Other than that, the box just has all the features of the display.

    I will do some googling for some more info and possible where to buy one. I wish I had a schematic. It would have made my job a bit easier, but thats what hacking is all about. I will post a pic of the insides of the thing sometime tonight.

    Also, the interesting thing is that the box nor the display is branded by a company in any way. Usually these things have company logos all over them.

    Thanks for the comments guys!

    -Dan
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-05-30 06:06
    Well, after some googling, I was surprised tongue.gif to find a company that sells the exact same badge in bulk. They sell in packs of a dozen at $10 apiece ($120 total for those of you not mathematically inclined). Here's the link:

    http://www.z-import.net/ZHotnewitems.html

    The badge seems to be a different color than the one I have, and it says "Read Me" on the front, but no big deal. Also, here are the pics I promised...

    Front:

    attachment.php?attachmentid=47412

    Back:

    attachment.php?attachmentid=47411

    Hehe...they spelled 'power' wrong:

    attachment.php?attachmentid=47413

    Well, good luck if you choose to buy them and try this for yourself. Let me know if anybody needs any info.

    Oh, and sorry for the horrendous flash spots on the pictures...I'm still learning how to use the camera!

    -Dan

    Post Edited (Ductapemaster) : 5/30/2007 6:12:28 AM GMT
    640 x 427 - 101K
    640 x 427 - 91K
    640 x 427 - 54K
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-05-31 06:08
    I worked a bit on the programming tonight and I got both the 'up' and 'down' button interface working. Before, the display had to cycle through all the letters to get back to the beginning instead of just backing up in the character map. Now I hooked up the 'back' button and it works much faster now.

    I attached the revised code.

    Also, I found out that I have my grandparents video camera hanging around and I will post up a video (on youtube) probably tomorrow of this thing in action. Beforehand I have some soldering to do however...the new button needs wires.

    -Dan
  • WhitWhit Posts: 4,191
    edited 2007-05-31 20:02
    Dan,

    Very cool hack on the freebie display badge. It came out great. Can't wait for the video. If the text is long enough, how does it scroll?

    Thanks for the source too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-06-01 01:11
    Whit said...
    If the text is long enough, how does it scroll?

    The display scroll at four different speed, selectable by a button on the back. Eventually I will add in some code for selectable speeds in the debug terminal, but finals, SAT 2's and the ACT are fast approaching so this is on hold for a bit...

    I'll try and make the video tonight when I'm done with my homework/studying duties redface.gif.
    Whit said...
    Thanks for the source too.

    Sure. I like to not be so stingy with my code so people can understand how my project works...as long as they don't steal it I'm fine with them looking at it. I have had countless time where just looking at someone elses code gives me some sort of inspiration or the solution to a problem.

    -Dan
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-06-01 01:43
    Does it scroll only right to left? Can it also scroll up/down/left/right too?
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-06-01 02:10
    It only scroll's right to left, but what do you expect? It was free! I'm not complaining. Eventually I might just replace the chip inside with an SX or BS2, but maybe not. It's pretty cool as is. Once I get the wireless working though, it will be much better.

    -Dan
  • WhitWhit Posts: 4,191
    edited 2007-06-01 04:13
    Dan,

    Check this out - http://www.pro-lite.com/specialty-xpression.htm
    Look at the download section too! Don't know what they cost though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney

    Post Edited (Whit) : 6/1/2007 4:18:51 AM GMT
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-06-01 06:19
    Pretty cool stuff they sell...but still, hacking is so much more fun then buying something! Thanks for the link though.

    Well, I was messing with the board tonight and I could not get the 'down' button working for over an hour, so I decided to go back to the original idea of cycling through all the letters. I can't believe it gives up on me now, after it was just working this afternoon! Darnit. Maybe I'm just missing somethign stupid.

    Also, the display is having some trouble at the moment. I think it's running out of batteries...or so I hope. It's just optuptting garbage at the moment, and I didn't change the program at all. I'll buy a pack of batteries this weekend and see how it turns out. At the moment the video will have to wait until I get it working again...sorry!

    Wish me and my display luck...

    -Dan
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-06-08 03:49
    Well, I finally had some time last night and I posted the video of my display on YouTube. Here's the link if you're interested: http://www.youtube.com/watch?v=_Jq2yJMo44s


    Let me know what you guys think.

    Thanks,

    Dan

    [noparse][[/noparse]Link activated by Moderator]

    Post Edited By Moderator (Chris Savage (Parallax)) : 6/8/2007 2:39:04 PM GMT
  • Skywalker49Skywalker49 Posts: 172
    edited 2007-06-08 21:49
    Hello Dan,

    great project and very well documented on the forum and the source too.
    Keep up the good works. I liked the video very much.

    Success,
    Ed
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-06-08 22:29
    Thanks, I appreciate the comment. I have another project I will be posting up later today, so look out for it.

    -Dan
  • WhitWhit Posts: 4,191
    edited 2007-06-10 12:54
    Great video Ductapemaster. Works great.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • WhitWhit Posts: 4,191
    edited 2007-06-10 12:57
    Ductapemaster said...

    Also, the display is having some trouble at the moment. I think it's running out of batteries...or so I hope. It's just optuptting garbage at the moment, and I didn't change the program at all. I'll buy a pack of batteries this weekend and see how it turns out.
    Was the problem just the batteries?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • Rob7Rob7 Posts: 275
    edited 2007-06-10 17:08
    Dan,

    Enjoyed the video, Keep us posted on your progress !

    Rob7

    Post Edited (Rob7) : 6/10/2007 5:17:01 PM GMT
Sign In or Register to comment.