Log in

22 January 2008 @ 03:02 pm
Coca Cola Display Hack - an intro to Micrel controllers  
Well, I was walking around one day, and I came across a totally destroyed coke machine. I poked around the innards and decided not to harvest it. I did however find the display unit (the thing that scrolls 'Ice Cold Coca Cola' and the price) and so pocketed it.

It's been sitting in a box all alone for about a year, and I finally went about trying to do something with it. I thought it would be as simple as powering it up, letting it scroll the coke message, and sitting it on my desk for a year or two. Boy was I wrong.

The device has a 4-pin header on the back, and strangely uses that old cd-audio connector plug. Well I traced the lines and figured out the pinout:

4- Data
3- Clock
2- DC+ (5v ~ 12v)
1- DC- (GND)

This device features the Micrel MM5451 controller, which I must say is absolutely incredible. It has 35 outputs and takes a very simple single serial data/clock input at just about any baud rate between 300bps and 400,000bps. Basically as fast as my laptop could spit information thru the LPT port, the chip could handle it.

It also features four 14-segment LEDs and a single large LED (change only light)

The problem is that four 14-segment LEDs add up to a neccessary 56 outputs, which is way more than the Micrel can handle. The board uses a sort of transistor flip-flip interface, which uses bits 2 and 3 of the incoming data to control whether the character information activates display 1 and 2, or 2 and 3. If you activate both bits, it duplicates the character information to both at the same time. In order to make four completely different numbers/letters appear, you have to send two alternating data strings faster than the eye can distinguish (which needless to say, can't be done over a computer LPT port).

I whipped up a quick VB program to send the appropriate signals, and tinkered with various settings and stuff, and I found that you have to send the data in a certain format: (always in binary)

[header] [bank select] [left display character] [right display character] [LED] [footer]

The header is always just '1'
The Bank select bits choose which 2 of the displays are activated
00 - All Off
01 - Display 1 and 2
10 - Display 3 and 4
11 - All On
Display character codes are a 15-bit code (14 bits that correspond directly to each segment, and one dead bit). For example the following are the codes for numbers:
0 - 111111000000000
1 - 011000000000000
2 - 110110001000100
3 - 111100001000100
4 - 011001001000100
5 - 101101001000100
6 - 101111001000100
7 - 111000000000000
8 - 111111001000100
9 - 111101001000100
You must send two of these, because two Displays are activated at a time.
The LED bit is 0 for off, and 1 for on.
The footer consists of 2 dead bits. They must be sent or the display is screwed up.

so to show the number '1234' you would have to send the following two binary strings over and over as fast as you can:
1 01 011000000000000 110110001000100 0 00
1 10 111100001000100 011001001000100 0 00

the first places numbers 1 and 2 on the first two displays, the second places numbers 3 and 4 on the second two displays.

With the right timing, and the right codes, you can make a pretty neat display:

latriyrcho on February 16th, 2013 10:01 pm (UTC)
Find friends with benefits and Be Naughty! Go Here dld.bz/chwZJ