terça-feira, 12 de junho de 2012

Apresentação Final

Linha do Tempo

Fotos desde o início da montagem até o final



Primeiros passos, montagem do cubo 2x2x2 e 3x3x3

Cubo 2x2x2

Cubo 3x3x3


Soldando camadas do cubo 7x7x7

Camada do cubo 7x7x7

Soldando entre si, as camadas do cubo 7x7x7




Cubo 7x7x7 


Testando todos os 343 LEDs

Foi necessário testar várias vezes TODOS os LEDs


Soldando os fios nas colunas do cubo 7x7x7

Cortando e descascando os fios

Testando novamente os LEDs




Ligando os fios do cubo 7x7x7

Acredite, atrás dessa floresta de fios, está o cubo 7x7x7




Circuito melhorado com a diminuição do volume dos fios

Cortando madeira para a caixa

Colando a caixa




Fazendo caixa de acetato para proteger o cubo








Testando cubo 7x7x7


O pouco do material que sobrou

Protótipo da versão do programa criador de frames de um cubo 7x7x7





segunda-feira, 11 de junho de 2012

Flip-flop

Material

Material usado no projeto:


- 70 LEDs para a montagem dos cubos pequenos (2x2x2 e 3x3x3) para teste (Santa Efigênia) 
R$10,00

- 343 LEDs para a montagem do cubo 7x7x7 (Santa Efigênia) 
R$68,40

- 6 Transistors 
R$1,20

- 1 Decodificador
R$2,50

- 6 Flip-flop
R$9,00

- 69 Resistores
R$6,90

- 3 Estanho
R$13,50 

- Acetato 
R$7,90

- Sugador

R$15,00

- 20m Fios
R$30,00

- Arduino (Laboratório de Garagem - Rua Berta, 60 - Vila Mariana  São Paulo, 04120-040)
R$ 89,00

- Protoboard 3220 pontos/furos (Santa Efigênia)
R$ 66,60

- Madeira

- ‎Ferro de solda 30W

- Alicates

- Fonte externa

Código do Cubo


#include <avr/pgmspace.h>        // allows use of PROGMEM to store patterns in flash

#define CUBESIZE 7
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333          // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 20          // multiplies DisplayTime to get ms - why not =100?

prog_uchar PROGMEM PatternTable[] = {
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,
B1111111, B0000000, B1000001, B1100011, B1010101, B1001001, B0000000,10,


 
};

/*
** Defining pins in array makes it easier to rearrange how cube is wired
 ** Adjust numbers here until LEDs flash in order - L to R, T to B
 ** Note that analog inputs 0-5 are also digital outputs 14-19!
 ** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps
 */


//int LEDPin[] = {16, 3, 1, 15, 4, 6, 14, 5, 7};
int LEDPin[] = {0,1,2,3,4,5,6};

//int PlanePin[] = {19, 18, 17};
int PlanePin[] = {12,13,14,15,16,17,18};

int decodificador[]={8,9,10};

// initialization


void downClock(int valor){

  int binario[3], j=0, i=0, resto=0;

  for(j=2; j>=0;j--){
    resto=valor%2;
    valor=valor/2;
    printf("%d\n",resto);
    binario[j]=resto;
  }

  for(i=0; i<3;i++){  
    digitalWrite(decodificador[i],binario[i]);
  }

}

void upClock(){
  digitalWrite(16,HIGH);
  digitalWrite(17,HIGH);
  digitalWrite(18,HIGH);
}


void limpaFlip(){

  int i=0;

  for(int j=1;j<=7;j++){
    digitalWrite(PlanePin[j],LOW);

    for(i=0; i<7;i++){
      digitalWrite(LEDPin[i],LOW);

    }
    upClock();
    downClock(j);
   
   
  }
 


}

void setup()
{
  int pin;      // loop counter
  // set up LED pins as output (active HIGH)
  for (pin=0; pin<PLANESIZE; pin++) {
    pinMode( LEDPin[pin], OUTPUT );

  }
  // set up plane pins as outputs (active LOW)
  for (pin=0; pin<CUBESIZE; pin++) {
    pinMode( PlanePin[pin], OUTPUT );
  }
}

// display pattern in table until DisplayTime is zero (then repeat)
void loop()
{
  // declare variables
  byte PatternBuf[ PLANESIZE ];      // saves current pattern from PatternTable
  int PatternIdx;
  byte DisplayTime;        // time*100ms to display pattern
  unsigned long EndTime;
  int plane;      // loop counter for cube refresh
  int patbufidx;   // indexes which byte from pattern buffer
  int ledrow;    // counts LEDs in refresh loop
  int ledcol;    // counts LEDs in refresh loop
  int ledpin;    // counts LEDs in refresh loop

  // Initialize PatternIdx to beginning of pattern table
  PatternIdx = 0;
  // loop over entries in pattern table - while DisplayTime>0
  //limpaFlip();



  do {


    memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );

    PatternIdx += PLANESIZE;


    DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ );  

    EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;


    // loop while DisplayTime>0 and current time < EndTime
    while ( millis() < EndTime ) {

      patbufidx = 0;    // reset index counter to beginning of buffer
      // loop over planes

      for (plane=1; plane<=CUBESIZE; plane++) {

        digitalWrite( PlanePin[plane], HIGH );
        // load current plane pattern data into ports
        ledpin = 0;

        for (ledrow=0; ledrow<CUBESIZE; ledrow++) {



          for (ledcol=0; ledcol<CUBESIZE; ledcol++) {
            ledpin=+1;

            digitalWrite( LEDPin[ledpin], PatternBuf[patbufidx] & (1 << ledcol) );
         
          }
         
          downClock(ledrow);
          upClock();        
         
          ledpin=0;
          patbufidx++;
        }
       
        // turn current plane on
        digitalWrite( PlanePin[plane], LOW);
        // delay PLANETIME us
        delay(10000);
        delayMicroseconds( PLANETIME );

      }    // for plane
    }    // while <EndTime
  }

  while (DisplayTime > 0);
 
//limpaFlip();
}


Site

Site que tem um tutorial de um cubo 8x8x8

http://www.instructables.com/id/Led-Cube-8x8x8/