LED Array Card

From NYC Resistor Wiki
Jump to: navigation, search

LED Array Card[edit]

Arraycard.jpg

Description[edit]

This was a project I did for my brother's wedding. I wanted to give him something cool instead of a cheesy card you'd buy at a hood arse walgreens or some garbage. So this is an LED array card. Pretty cheap in terms of parts chosen... but downright pretty results. Enjoy!

Hardware[edit]

 * LED array consists of 280 red 3mm LEDs bought at MPJA.com 500 for 5 bucks effectively.
 * MCU is a Boarduino.  Arduino compatibly available from adafruit for 15 bucks roughly.
 * The board is a ratshack throughhole board.  Probably a couple bucks.
 * Various Caps and Resistors... cost negligible.  
 * Array Controllers are 2 MAX6952 LED array controller PDIP chips ( Samples )  
 * Faceplate is laser cut 1/16 acrylic clear.

Source Code[edit]

 0 // Max 6952 Example Code For Arduino
 1 // Tested on Boarduino
 2 // Matt Joyce @ NYC Resistor
 3 
 4 #define DATAOUT 11//MOSI
 5 #define DATAIN 12//MISO - not used, but part of builtin SPI
 6 #define SPICLOCK  13//sck
 7 #define SLAVESELECT 10//ss
 8 
 9 char spi_transfer(volatile char data)
10 {
11   SPDR = data;
12   // Start the transmission
13   while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
14   {
15   };
16   return SPDR;                    // return the received byte
17 }
18 
19 void setup()
20 {
21   byte i;
22   byte clr;
23   pinMode(DATAOUT, OUTPUT);
24   pinMode(DATAIN, INPUT);
25   pinMode(SPICLOCK,OUTPUT);
26   pinMode(SLAVESELECT,OUTPUT);
27   digitalWrite(SLAVESELECT,HIGH); //disable device
28   // SPCR = 01010000
29   //interrupt disabled,spi enabled,msb 1st,master,clk low when idle,
30   //sample on leading edge of clk,system clock/4 (fastest)
31   SPCR = 0b01010010;  
32   clr=SPDR;
33   delay(32);
34      // Configure Register
35      write_led_twice(0x04,0x01);
36      // Intensity Pane 1 and Pane 2
37      write_led_twice(0x01,0xFF);
38      write_led_twice(0x02,0xFF);
39      // Scan Limit
40      write_led_twice(0x03,0x01);
41      
42 }
43 
44 byte write_led(int address, int value)
45 {
46   digitalWrite(SLAVESELECT,LOW);
47   //2 byte opcode
48   spi_transfer(address);
49   spi_transfer(value);
50   
51   delay(36);
52   digitalWrite(SLAVESELECT,HIGH); //release chip, signal end transfer
53 }
54 
55 // Write n times for n chips daisy chained.
56 byte write_led_twice(int address, int value)
57 {
58   digitalWrite(SLAVESELECT,LOW);
59   //2 byte opcode
60   spi_transfer(address);
61   spi_transfer(value);
62   spi_transfer(address);
63   spi_transfer(value);
64   delay(36);
65   digitalWrite(SLAVESELECT,HIGH); //release chip, signal end transfer
66 }
67 
68 void loop()
69 {
70      // Testing ROM Character Set
71      write_led_twice(0x20,0x5e);
72      write_led_twice(0x21,0x5e);
73      write_led_twice(0x22,0x5e);
74      write_led_twice(0x23,0x5e);
75      delay(4000);
76      // Testing Programmable RAM Space
77      write_led_twice(0x05,0x80);
78      write_led_twice(0x05,0x42);
79      write_led_twice(0x05,0x61);
80      write_led_twice(0x05,0x51);
81      write_led_twice(0x05,0x49);
82      write_led_twice(0x05,0x46);
83      write_led_twice(0x20,0x80);
84      write_led_twice(0x21,0x80);
85      write_led_twice(0x22,0x80);
86      write_led_twice(0x23,0x80);
87      delay(4000);
88      // Gred Test Register Call
89      write_led_twice(0x07,0x01);
90      
91      delay(1000);     
92      // Turn off Test Register
93      write_led_twice(0x07,0x00);
94 }

References[edit]

 * http://www.thingiverse.com/thing:45
 * http://blip.tv/file/1504611
 * http://datasheets.maxim-ic.com/en/ds/MAX6952.pdf
 * http://www.arduino.cc/

Creator[edit]

Matt Joyce Thanks to all of NYC resistor for support.