Skip to content

Commit

Permalink
[LEDx16Module] notes after fab and build
Browse files Browse the repository at this point in the history
  • Loading branch information
tardate committed May 22, 2016
1 parent 862c3b5 commit ac09001
Show file tree
Hide file tree
Showing 27 changed files with 1,516 additions and 969 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
*.mp4
wip
venv
_autosave*
120 changes: 120 additions & 0 deletions playground/LEDx16Module/LEDx16Module.ino
@@ -0,0 +1,120 @@
/*
LEDx16Module
For info and circuit diagrams see https://github.com/tardate/LittleArduinoProjects/tree/master/playground/LEDx16Module
*/

// use hardware SPI, MSB first
#include <SPI.h>
SPISettings spiSettings(1800000, MSBFIRST, SPI_MODE0);

// Standard SPI pins are used used for clock and data, but slave select can be any free pin
const int ST_CP_LATCH_PIN = 4;

#define SHORT_DELAY 50
#define STEP_DELAY 100
#define LONG_DELAY 500

void setup() {
SPI.begin();
pinMode(ST_CP_LATCH_PIN, OUTPUT);
SPI.beginTransaction(spiSettings);
}


void loop() {
clear();
fourBlocks();
clear();
chequers();
clear();
chaser(false);
chaser(false);
chaser(true);
chaser(true);
chaser(false);
clear();
}

void chaser(bool clockwise) {
/*
move a single LED around the board
*/
uint16_t data;
for(byte position=0; position<16; position++) {
if(clockwise) {
data = 0xFFFF ^ (1 << (16 - position));
} else {
data = 0xFFFF ^ (1 << position);
}
writeData16(data);
delay(SHORT_DELAY);
}
}

void chequers() {
/*
on off
off on
on off
off on
on off
off on
on off
off on
*/
byte pattern = 0b10101010;
byte pattern_reversed = 0b01010101;

for(int r=0; r<10; r++) {
writeData(pattern, pattern);
delay(STEP_DELAY);
writeData(pattern_reversed, pattern_reversed);
delay(STEP_DELAY);
}
}

void fourBlocks() {
/*
on off
on off
on off
on off
off on
off on
off on
off on
*/
byte pattern = 0b11110000;
byte pattern_reversed = 0b00001111;

for(int r=0; r<10; r++) {
writeData(pattern, pattern);
delay(STEP_DELAY);
writeData(pattern_reversed, pattern_reversed);
delay(STEP_DELAY);
}
}

void clear() {
writeData(0xFF, 0xFF);
delay(LONG_DELAY);
}


// Command: send left and right bytes
void writeData(byte left, byte right) {
digitalWrite(ST_CP_LATCH_PIN, LOW);
SPI.transfer(left);
SPI.transfer(right);
digitalWrite(ST_CP_LATCH_PIN, HIGH);
}

// Command: write 16 bits to the module
void writeData16(uint16_t data) {
digitalWrite(ST_CP_LATCH_PIN, LOW);
SPI.transfer16(data);
digitalWrite(ST_CP_LATCH_PIN, HIGH);
}
Binary file added playground/LEDx16Module/LEDx16Module_demo.fzz
Binary file not shown.
17 changes: 14 additions & 3 deletions playground/LEDx16Module/README.md
Expand Up @@ -13,9 +13,12 @@ of an array of 16 LEDs with current-limiting resistors.

The PCB design was done with [KiCad](http://kicad-pcb.org/).

I haven;t sent the boards for production yet - first sourcing and verifying the SMD components.
I haven't sent the boards for production yet - first sourcing and verifying the SMD components.
When I've built and tested the board, I'll update and share the OSH Park project and Arduino code.

I sent these off for production at [OSH Park](https://oshpark.com/shared_projects/E2aHiqP5), and they turned out quite well.
I think I could have picked a footprint for the SOP16 ships with longer pads to make them easier to solder by hand.

## Construction

See the [KiCad project](./kicad_project/LEDx16Module.pro) for all the details. Here's the result:
Expand All @@ -32,11 +35,19 @@ See the [KiCad project](./kicad_project/LEDx16Module.pro) for all the details. H
* [220µF 16V 6x7mm SMD](http://www.aliexpress.com/item/Free-shiping-10pcs-16V-220UF-SMD-6x7mm-chip-Aluminum-Electrolytic-Capacitor/1173598774.html)
* [0805 LEDs (5 colours)](http://www.aliexpress.com/item/Free-Shipping-100PCS-0805-Ultra-Bright-SMD-R-G-B-W-Y-LEDs-yellow-blue-White/859788444.html)

## Demo

The [LEDx16Module.ino](./LEDx16Module.ino) sketch runs a simple demo sequence on the board from an Aurduino using hardware SPI.

![LEDx16Module_demo_bb](./assets/LEDx16Module_demo_bb.jpg?raw=true)

![LEDx16Module_demo_schematic](./assets/LEDx16Module_demo_schematic.jpg?raw=true)

![LEDx16Module_build](./assets/LEDx16Module_build.jpg?raw=true)

## Credits and References
* [KiCad like a Pro](http://txplore.tv/courses/kicad-pro) - course materials
* [KiCad](http://kicad-pcb.org/)
* [gerblook](http://gerblook.org/) - nice tool for testing a set of gerber files
* [OSH Park](https://oshpark.com/)
* [HARDWARE HANGOUT with James "Laen" Neal from OSH Park!](https://www.youtube.com/watch?v=XssjD97-xGM) - where I first learned of OSH Park


Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified playground/LEDx16Module/assets/LEDx16Module_pcb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified playground/LEDx16Module/assets/LEDx16Module_pcb_render.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified playground/LEDx16Module/assets/LEDx16Module_schematic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added playground/LEDx16Module/assets/spi_trace.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ac09001

Please sign in to comment.