Difference between revisions of "8X8X8 RGB LED Cube Shield"

From LinkSprite Playgound
Jump to: navigation, search
(Created page with " 600px")
 
(Schematics)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== Introduction ==
 +
 +
8*8*8 RGB Led cube is one of the stunning RGB light cubic module designed  by us,and poses the arduino compatible interface and use the SPI interface as the control interface.
 +
It has several color mode inside.
  
 
[[File:RGBLED shield 1.jpg | 600px]]
 
[[File:RGBLED shield 1.jpg | 600px]]
 +
 +
This shield is coming a kit as below, you need soldering the LEDs to a complete shield as the upper picture.
 +
 +
[[File:8x8x8 list.jpg | 600px]]
 +
 +
== Features ==
 +
 +
*Dimensions: 120×100×90mm
 +
*Net weight: 265g
 +
 +
== Schematics ==
 +
 +
*[https://s3.amazonaws.com/linksprite/Shields/8X8X8+LED+Cube/8x8x8led_cube_schematic.pdf 8x8x8led_cube_schematic]
 +
 +
== Usage ==
 +
 +
Below is a demo code to use 8*8*8 RGB Led cube with Arduino:
 +
 +
<syntaxhighlight lang="c">
 +
 +
#include <SPI.h>
 +
 +
#define STATUS_PIN 9
 +
#define CS_PIN 10
 +
#define MOSI_PIN 12
 +
#define MISO_PIN 11
 +
#define SCK_PIN 13
 +
 +
void SetDefaultTask(char task,long repeatTime)
 +
{
 +
  bool DeviceStatus;
 +
  unsigned short count;
 +
 +
  DeviceStatus = digitalRead(STATUS_PIN);
 +
  digitalWrite(CS_PIN,LOW);
 +
 +
  SPI.transfer(2);
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(task);//X
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//Y
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//Z
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(repeatTime & 0xff);//R
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((repeatTime>>8) & 0xff);//G
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((repeatTime>>16) & 0xff);//B
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((repeatTime>>24) & 0xff);//RSV
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  digitalWrite(CS_PIN,HIGH);
 +
}
 +
 +
void SetLedCubeColor(long color)
 +
{
 +
  bool DeviceStatus;
 +
  unsigned short count;
 +
 +
  DeviceStatus = digitalRead(STATUS_PIN);
 +
  digitalWrite(CS_PIN,LOW);
 +
 +
  SPI.transfer(1);
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//X
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//Y
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//Z
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(color & 0xff);//R
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((color>>8) & 0xff);//G
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((color>>16) & 0xff);//B
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((color>>24) & 0xff);//RSV
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  digitalWrite(CS_PIN,HIGH);
 +
}
 +
 +
void SetPonitColor(char x,char y,char z,long color)
 +
{
 +
  bool DeviceStatus;
 +
  unsigned short count;
 +
 +
  DeviceStatus = digitalRead(STATUS_PIN);
 +
  digitalWrite(CS_PIN,LOW);
 +
 +
  SPI.transfer(1);
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(x);//X
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(y);//Y
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(z);//Z
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(color & 0xff);//R
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((color>>8) & 0xff);//G
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((color>>16) & 0xff);//B
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer((color>>24) & 0xff);//RSV
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  digitalWrite(CS_PIN,HIGH);
 +
}
 +
 +
void SendImageData(void)
 +
{
 +
  unsigned short tmpShort;
 +
 +
  bool DeviceStatus;
 +
  unsigned short count;
 +
 +
  DeviceStatus = digitalRead(STATUS_PIN);
 +
  digitalWrite(CS_PIN,LOW);
 +
 +
  SPI.transfer(4);
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//X
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//Y
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//Z
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//R
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//G
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//B
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
  DeviceStatus = !DeviceStatus;
 +
  SPI.transfer(0);//RSV
 +
  while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
 +
  for(tmpShort =0;tmpShort < 512*3;tmpShort ++)
 +
  {
 +
    SPI.transfer((char)tmpShort);
 +
    while(digitalRead(STATUS_PIN) == DeviceStatus)
 +
    DeviceStatus = !DeviceStatus;
 +
  }
 +
  digitalWrite(CS_PIN,HIGH);
 +
}
 +
 +
void setup() {
 +
  // put your setup code here, to run once:
 +
  pinMode(STATUS_PIN, INPUT);
 +
  pinMode(CS_PIN, OUTPUT);
 +
  pinMode(MOSI_PIN, OUTPUT);
 +
  pinMode(MISO_PIN, INPUT);
 +
  pinMode(SCK_PIN, OUTPUT);
 +
  digitalWrite(CS_PIN,HIGH);
 +
  digitalWrite(STATUS_PIN,HIGH);
 +
  digitalWrite(SCK_PIN,LOW);
 +
 +
  SPI.setBitOrder(MSBFIRST);
 +
  SPI.setDataMode(SPI_MODE1);
 +
  SPI.setClockDivider(SPI_CLOCK_DIV16);
 +
  SPI.begin();
 +
  SetDefaultTask(0,15);
 +
  SendImageData();
 +
  delay(5000);
 +
 +
}
 +
 +
void loop() {
 +
  // put your main code here, to run repeatedly:
 +
  SetLedCubeColor(0x00ff0000);
 +
  delay(5000);
 +
  SetLedCubeColor(0x0000ff00);
 +
  delay(5000);
 +
  SetLedCubeColor(0x000000ff);
 +
  delay(5000);
 +
  SetDefaultTask(1,15);
 +
  delay(10000);
 +
  SetDefaultTask(2,15);
 +
  delay(10000);
 +
  SetDefaultTask(3,15);
 +
  delay(10000);
 +
}
 +
 +
</syntaxhighlight>
 +
 +
[[File:8x8x8 with arduino.jpg]]
 +
 +
== Resources ==
 +
 +
*[http://learn.linksprite.com/arduino/shields/use-888-rgb-led-cube-with-arduino/ Use 8*8*8 RGB Led cube with Arduino]
 +
*[http://learn.linksprite.com/pcduino/arduino-ish-program/gpio/use-888-rgb-led-cube-on-pcduino/ Use 8*8*8 RGB LED Cube on pcDuino]
 +
*[http://learn.linksprite.com/pcduino/use-8x8x8-rgb-led-cube-on-pcduino/ Video]

Latest revision as of 03:25, 11 November 2014

Introduction

8*8*8 RGB Led cube is one of the stunning RGB light cubic module designed by us,and poses the arduino compatible interface and use the SPI interface as the control interface. It has several color mode inside.

RGBLED shield 1.jpg

This shield is coming a kit as below, you need soldering the LEDs to a complete shield as the upper picture.

8x8x8 list.jpg

Features

  • Dimensions: 120×100×90mm
  • Net weight: 265g

Schematics

Usage

Below is a demo code to use 8*8*8 RGB Led cube with Arduino:

<syntaxhighlight lang="c">

  1. include <SPI.h>
  1. define STATUS_PIN 9
  2. define CS_PIN 10
  3. define MOSI_PIN 12
  4. define MISO_PIN 11
  5. define SCK_PIN 13

void SetDefaultTask(char task,long repeatTime) {

 bool DeviceStatus;
 unsigned short count;

 DeviceStatus = digitalRead(STATUS_PIN);
 digitalWrite(CS_PIN,LOW);

  SPI.transfer(2);
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(task);//X
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//Y
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//Z
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(repeatTime & 0xff);//R
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((repeatTime>>8) & 0xff);//G
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((repeatTime>>16) & 0xff);//B
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((repeatTime>>24) & 0xff);//RSV
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  digitalWrite(CS_PIN,HIGH);

}

void SetLedCubeColor(long color) {

 bool DeviceStatus;
 unsigned short count;

 DeviceStatus = digitalRead(STATUS_PIN);
 digitalWrite(CS_PIN,LOW);

  SPI.transfer(1);
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//X
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//Y
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//Z
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(color & 0xff);//R
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((color>>8) & 0xff);//G
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((color>>16) & 0xff);//B
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((color>>24) & 0xff);//RSV
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  digitalWrite(CS_PIN,HIGH);

}

void SetPonitColor(char x,char y,char z,long color) {

 bool DeviceStatus;
 unsigned short count;

 DeviceStatus = digitalRead(STATUS_PIN);
 digitalWrite(CS_PIN,LOW);

  SPI.transfer(1);
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(x);//X
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(y);//Y
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(z);//Z
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(color & 0xff);//R
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((color>>8) & 0xff);//G
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((color>>16) & 0xff);//B
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer((color>>24) & 0xff);//RSV
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  digitalWrite(CS_PIN,HIGH);

}

void SendImageData(void) {

 unsigned short tmpShort;

 bool DeviceStatus;
 unsigned short count;

 DeviceStatus = digitalRead(STATUS_PIN);
 digitalWrite(CS_PIN,LOW);

  SPI.transfer(4);
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//X
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//Y
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//Z
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//R
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//G
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//B
  while(digitalRead(STATUS_PIN) == DeviceStatus)
  DeviceStatus = !DeviceStatus;
  SPI.transfer(0);//RSV
  while(digitalRead(STATUS_PIN) == DeviceStatus)

 for(tmpShort =0;tmpShort < 512*3;tmpShort ++)
 {
   SPI.transfer((char)tmpShort);
   while(digitalRead(STATUS_PIN) == DeviceStatus)
   DeviceStatus = !DeviceStatus;
 }
 digitalWrite(CS_PIN,HIGH);

}

void setup() {

 // put your setup code here, to run once:
 pinMode(STATUS_PIN, INPUT); 
 pinMode(CS_PIN, OUTPUT); 
 pinMode(MOSI_PIN, OUTPUT); 
 pinMode(MISO_PIN, INPUT); 
 pinMode(SCK_PIN, OUTPUT); 
 digitalWrite(CS_PIN,HIGH);
 digitalWrite(STATUS_PIN,HIGH);
 digitalWrite(SCK_PIN,LOW);

 SPI.setBitOrder(MSBFIRST);
 SPI.setDataMode(SPI_MODE1);
 SPI.setClockDivider(SPI_CLOCK_DIV16);
 SPI.begin();
 SetDefaultTask(0,15);
 SendImageData();
 delay(5000);

}

void loop() {

 // put your main code here, to run repeatedly:
 SetLedCubeColor(0x00ff0000);
 delay(5000);
 SetLedCubeColor(0x0000ff00);
 delay(5000);
 SetLedCubeColor(0x000000ff);
 delay(5000);
 SetDefaultTask(1,15);
 delay(10000);
 SetDefaultTask(2,15);
 delay(10000);
  SetDefaultTask(3,15);
 delay(10000);

}

</syntaxhighlight>

8x8x8 with arduino.jpg

Resources