Anonymous

LED tiles: Difference between revisions

From London Hackspace Wiki
2,295 bytes added ,  7 February 2016
Added Getting Started section with information and sample Arduino code
m (Added link to Greg Akins technical info page)
(Added Getting Started section with information and sample Arduino code)
Line 113: Line 113:


Glen Akins has some extremely good technical detail here: http://bikerglen.com/projects/lighting/led-panel-1up/
Glen Akins has some extremely good technical detail here: http://bikerglen.com/projects/lighting/led-panel-1up/
== Getting Started ==
Some key information and pointers for anyone getting started with a tile and a basic microcontroller like the Arduino (we used a Mega 2560), Raspberry Pi, BeagleBone etc.
The OE (Output Enable) pin is misleadingly named as it's really Output Inhibit or Blanking, having to be pulled low to enable the LEDs.  All other inputs are active high.
The panel is organised as six row groups that are interlaced both vertically and horizontally (see illustration) to minimise flicker.  Each group contains 288 pixels organised in a shift register so new data shifts along the row group in the order shown.
[[File:Hackspace LED Tile addressing.png|thumbnail|48 x 36 LED Tile Addressing Scheme]]
As someone has explained elsewhere the panel displays one row group at a time, so it's necessary to cycle them in equal proportions to get a full image.  The row addressing performs two functions, to select the row group that's both energised and into which data will be clocked.  Note that it appears that you can select a row and clock data into it, but that data is held but  not transferred to the display until you toggle the latch input even if you change to a different row group.  In this way it seems possible (though not yet tried) to build up in the shift register the next image to be displayed a small amount at a time to maintain a good refresh rate, and then transfer it to the display by latching.
Simple Arduino code example:
<code>
digitalWrite(pinOE, LOW);
// select first row
digitalWrite(pinA, LOW);
digitalWrite(pinB, LOW);
digitalWrite(pinC, LOW);
For(int i=0; i<288; i++)
{
  // set high or low value for each pixel
  digitalWrite(pinR1, R);
  digitalWrite(pinG1, G);
  digitalWrite(pinB1, B);
  // pulse the clock line to move this data into the shift register
  digitalWrite(pinCLK, HIGH);
  digitalWrite(pinCLK, LOW);
}
// pulse the latch line to transfer the new data to the display
  digitalWrite(pinLAT, HIGH;
  digitalWrite(pinLAT, LOW);
</code>
The pixel writing could be made much faster using direct port operations, particularly with a port dedicated to the tile interface - one write with clock low to set the R G B values and the next holding the values with clock high - probably of the order of 50 times faster than the code above.
51

edits