Monday 25 November 2024
Font Size
   
Friday, 05 August 2011 19:00

Build an LED Display Board That Tweets

Rate this item
(0 votes)

As a member of Alpha One Labs, a hackerspace in Brooklyn, I get to play with a lot of technology that others have thrown away. So when we were given a LED sign that didn’t have any of the control circuitry attached, just 12 cut wires dangling out the bottom, I decided that this sign should live again. After hooking it up and enabling it to display incoming tweets, a prototype was born. In this guide, I'll walk you through how to make your very own LED display board tweeting machine from scratch.

This is a wiki anyone can edit. If you want to show off your soldering skills and improve on this version, please log in and contribute.

Materials

  • Circuit board
  • 128 LEDs for each board (RS part number 276-0309)
  • 1 piece (part number 276-147) circuit board
  • Wire-wrap wire (red: 278-501, white: 278-502, blue: 278-503)
  • Wire wrap tool (276-1570)
  • 22-gauge hookup wire (278-1224)
  • Soldering iron (64-2070)
  • Solder (64-002)
  • Desoldering braid (64-2090)
  • From Digikey, Mouser, Jameco, etc:

a. 2x74HC164, 8-bit shift register b. 2xULN2803, 8 darlington driver c. 2xMDP1603, 8x100? DIP resistor pack, or 4 5-packs of 100? resistors (part number 271-005)

  • Arduino
  • Aligator clamps (two colors)
  • Two AA batteries
  • Electrical tape

Wire up the boards

First, Arrange the LEDs in 8 rows of 16 LEDs each, with the short lead (flat side of LED) facing forward. Solder all the long leads on each row together leaving the leads hanging off the edge of the board.

Apply electrical tape to each row to prevent the solder from shorting the circuit.

Solder all the short leads in the columns together, down toward the empty space at the bottom of the board.

Wire the chips to the board

Whenever you’re working with any sort of electronic component, you want to have the datasheet on hand, even if you’re really familiar. It will tell you everything the component does, and more importantly, what the limits are — you never want to let the Magic Smoke out of a device, especially one you’re handing off to someone else!

For this device, we used one MDP1603, one ULN2803, and one 74HC164 (for each 8 LEDs). Place them on the board toward the bottom.

The ULN2803 is a transistor array. (Note: the datasheet for this item can be found here.) Transistors amplify current. The transistors in this array allow a microcontroller, whose outputs are typically able to drive 20-25 mA, to handle a great deal more current. The ratio of input current to output current is called the gain (which you look up on the datasheet). In this case it’s listed as 1000. That means the 20mA input from the processor can control up to 20,000mA or 20A. But not quite - this is where the datasheet comes in handy. The Absolute Maximum Continuous Collector Current (think of the collector as the ‘output’ of a transistor, and the base is the ‘input’) for this device is 500mA. Since typical high brightness LEDs consume about 100mA (that’s right, from the datasheet), we’re well within the limits on both the input and output side. Looking at the pinout for the ULN2003, I followed the outputs, which went through a resistor (which drops the voltage from the 5V the Arduino and transistors output, to the 1.7V the LED's datasheet says they want), then each to one column of 8 LEDs.

Now to the inputs. From the datasheet, the 74HC164 is a shift register. A shift register is a kind of bucket brigade for bits. There’s a single data input, 8 data outputs labelled A-H, and a line labelled “clock”. Every time the clock line goes from 0 to 1, all the bits “shift” one place: the data input goes to output A, output A is passed to output B, output B to output C, etc, and output H is dumped on the floor (lost). The A-G outputs from each 164 are connected to the inputs for the ULN2803s. The H output is connected to the data input of the next 74HC164 in line. So in essence, they built a 100-bit shift register by chaining a bunch of 8-bit registers together! The datasheet for the 74HC164 is here.

Wire them up with the wire wrap tool (See the schematic below)

Schematic.

Note that this is an Eagle schematic that shows the connections - the pullup resistor and bypass capacitor are on the Arduino board in our case.

Solder 22AWG wire to the data, clock, power, gnd, and 8 rows.

So the end result was that there were 8 wires corresponding to the 8 rows of LEDs, a data input, a clock input, a reset input (to instantly set all the shift registers to 0 (off) output), a power line for the 164’s, and a ground line for the 164’s and 2803’s. These can all be connected to outputs from an Arduino and driven by a sketch.

Connect to the Arduino

Arduino sketch.

Looking at the Arduino side, the clock is connected to pin 2, and data to pin 3. The row of LEDs corresponding to bit 0 is connected to pin 6, bit 1 to pin 7, etc. through pin 13.

Connect the Arduino to your computer via a standard USB cable. Then load the sketch (see the github link below), program the Arduino, and load the Processing Sketch.

Processing sketch.

There are 10 columns of LEDs. The trick is to light each one with the desired pattern, then go to the next one and light it, etc., quickly enough that your eyes are tricked into seeing a constant pattern. Since we have a 100-bit shift register, we can shift in a 1, then clock it 100 times, which will turn on each column from leftmost to rightmost in succession. If we can do all this at least 24 times per second, your eye won’t notice much flicker.

I wrote a Twitter bot that can run on your computer. It will continually scans for tweets with the string associated to your Twitter name and send them to the sign. I also handled scrolling text that was bigger than the display could fit by sending substrings and waiting the appropriate intervals. I added smooth scrolling to the sign to make that look better.

The source code for the Arduino sketch and the Twitter bot can be found on my Github repository. Please feel free to fork and send pull requests!

Go!

Now you have a functional LED board that will display your incoming tweets! Have fun with it, and be sure to mount it in a prominent place so that everyone can see what a Twitter star you are.

If you want to play with the board, here's a quick rundown of the commands the Arduino will accept:

Arduino Firmware Commands
Lnnn Scroll the display nnn pixels to the left
Rnnn Scroll the display nnn pixels to the right
Sssss... Display a string. End with a newline
C Clears the display buffer
Bxx.. Append binary data (as hex digits) to the buffer. This is for writing bitmap data to the display. Terminate with a non-hex character.
Pnnn Set the position of the index to nnn
Fn Set flip mode - n=1 will turn the letters upside down
Mnnn Set the margin. The margin is the first position in the buffer that is visible on the display. The buffer is always 1024 bytes.
K Toggle auto scroll mode.
V Save the current buffer to EEPROM. The display will show the EEPROM contents on startup.
O Manually load the buffer from EEPROM.

The way the sketch works is I store all the display data in a 1024 byte buffer. The Margin determines the position that will actually be visible on the display. There is an internal index, set by the Position command, that determines where display data is written to the buffer.

Note that the L and R commands actually scroll the buffer! This means you may scroll your data out of the buffer. Use the Margin command to change the display position without affecting the buffer.

So for example, to display "Romeo ? Juliet" and have it scroll continuously, enter the following commands:

Command sequence
C Clear the display
M16 Set the margin to the 16th byte in the buffer
P16 Set the index position to 16 also
SRomeo Display "Romeo"
B3844422142443800 The heart bitmap
SJuliet The string "Juliet"
K Start scrolling

This page was last modified 17:30, 5 August 2011 by rmd6502. Based on work by howto_admin.
 
Schematic.


Navigation

Welcome to the Wired How-To Wiki, a collaborative site dedicated to the burgeoning DIY culture. Here you'll find all kinds of projects, hacks, tricks and tips on how to make each day better than the last. Anyone can contribute new items or edit an existing item.

Create an Article
Build an LED Display Board That Tweets - Wired How-To Wiki

Authors:

French (Fr)English (United Kingdom)

Parmi nos clients

mobileporn