LED Array Jacket

From NYC Resistor Wiki

Jump to: navigation, search

Jacket.png


Contents

[edit] About

This starts out as an LED Array Integrated into an old Jacket I have. The driver IC is a max6952. The LED Array itself is pretty straightforward. Arduino will be used to control the output, as well as integrate future hardware.

See it here:

http://www.nycresistor.com/2008/05/19/led-jacket-test/

[edit] Status

* LED Arrays Completed.
* LED Arrays wired to driver IC.
* Arduino was wired to the driver IC, until the TSA decided to unwire it.
* Rewired again, could use some cleanup.
* Rebuilt Left Array due to LED burnout as result of defective resistor on current ref.
* Bluetooth module has been acquired, but I have not had time to work with it yet.
> Working on Scrolling Code for Display

[edit] Test Code for MAX6952 on Arduino

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

[edit] Creator

Matt Joyce Thanks to all of NYC resistor for support.

Web Analytics