Tuesday, November 26, 2013

The Cube So Far

Here are a few pictures of the construction of the LED cube.

       Soldering each level of the cube using cardboard to hold the LEDs in the specific layout.

The first two levels soldered together.

Completed cube soldered.

Cube soldered to circuit board.



Thursday, November 21, 2013

First Draft of Solid Models

Draft of acrylic cube solid model, made so that our circuit board snaps in place as the bottom of the cube.  Following this model is a front view of the acrylic cube with the LEDs laid out in the proper shape.  For the LEDS, files for red and yellow LED drawings were found on GrabCad and used.





The following solid models were created for the servo-motion-mechanism. A solid model of a servo was downloaded from  GrabCad . The following are images of a bracket that will hold a servo motor, and the corresponding platform that will hold either another servo or the LED cube.



This is a link to a google drive folder with the solid models.


This is a video of the assembly in motion. There were technical difficulties getting the second motor to produce motion of the top bracket. Solidworks outputted an error message of " Simulation cannot continue" We hope to have this problem solved soon and have a proper assembly motion analysis done.



These are very rough solid models and will need to be furthur refined.

Wednesday, November 20, 2013


Post # 5

Third Team Meeting
11/21/2013
Wednesday 2pm, Perry 311
All team members present

Summary:

The parts that we'll be using are:

                                  2 decent servo motors that have 180 degree turning radius
                                  27 LED light
                                  2 PIC16F690-E/P
                                  1 ATmega328 microcontroller
A code was generated for the two servo control with separate potentiometer:

#include <Servo.h>
Servo myservo; // create servo object to control a servo
Servo myservo1; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int potpin1 = 1; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
int valu;
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo1.attach(6); // attaches the servo on pin 9 to the servo object
}
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
valu = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179);
valu = map(valu, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
myservo1.write(valu); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
view raw gistfile1.txt hosted with ❤ by GitHub

Thursday, November 14, 2013

Post#4


Post # 4

Third Team Meeting
11/14/2013
Thursday 2pm, Perry 311
All team members present

Summary:
We discuss today in our meeting couple important section in our final project. We did start looking on the detail of the 3X3X3 LED box but taking what we will need to accomplish this task. First, we need to figure out the hardware needed for this part. Second, how we will control the LED with Arduino and how we will setup 27 LED combine controlled with singular Arduino board or multiples boards. the challenges on this part is the limitation of pins  in the  Arduino board.

Parts Required:
  • 1x Arduino Board
  • 27x LED’s
  • 1x Stripboard
  • 3x 22k ohm Resistors
  • 9x 220 ohm Resistors
  • 3x NPN Transistors (for example: 2N2222, BC547, 2N3904)
  • Wire

Schematics:



Arduino code for 3x3x3 LED :







/*******************************************************************************************
3 X 3 X 3 Single Color LED Cube
cube built by Hassan Ali
Started on June 26 2012
www.islandByte.com
Cube built for multiplexing - using 3 pins and 3 transistors to contorl the rows 1-3
And using 9 pins to control the Coloums 1-9
This gives Arduino control of 27 LEDS by using only 12 pins.
*******************************************************************************************/
/*
Layout for the 3x3x3 cube
Row 1 = Top layer, 9 LEDs
Row 2 = Middle Layer, 9 LEDs
Row 3 = Bottom layer, 9 LEDs
Col 1 = Front Left 3 LEDS 1 top, 2 middle, 3 bottom
Col 2 = Front Middle 3 LEDS 4 top, 5 middle, 6 bottom
Col 3 = Front Right 3 LEDS 7 top, 8 middle, 9 bottom
****need to complete this documentation
Col 4 = Middle Right 3 LEDS - 8 top, 9 middle, 10 bottom
Col 3 = Front Right 3 LEDS 7 top, 8 middle, 9 bottom
Col 3 = Front Right 3 LEDS 7 top, 8 middle, 9 bottom
Col 3 = Front Right 3 LEDS 7 top, 8 middle, 9 bottom
Col 3 = Front Right 3 LEDS 7 top, 8 middle, 9 bottom
Col 3 = Front Right 3 LEDS 7 top, 8 middle, 9 bottom
*/
// Row control
int ledRow1 = 13; //Row 1
int ledRow2 = 12; //Row 2
int ledRow3 = 11; //Row 3
//Cols 1,2,3 + Rows can control LEDS 1-9
int ledCol1 = 9;
int ledCol2 = 8;
int ledCol3 = 7;
//Cols 4,5,6 + Rows can control LEDS 10-12
int ledCol4 = 6;
int ledCol5 = 5;
int ledCol6 = 4;
//Cols 4,5,6 + Rows can control LEDS 10-12
int ledCol7 = 3;
int ledCol8 = 2;
int ledCol9 = 1;
//define the LED cube size
int rowmax = 3;
int colmax = 9;
//making an array
int ledCol[9];
int ledRow[3];
// the setup routine runs once when you press reset:
void setup() {
//used for random value
//Serial.begin(9600);
// initialize the digital pin as an output.
//3 rows
pinMode(ledRow1, OUTPUT); //Top
pinMode(ledRow2, OUTPUT); //Middle
pinMode(ledRow3, OUTPUT); //Bottom
//9 Columns
pinMode(ledCol1, OUTPUT); //Left
pinMode(ledCol2, OUTPUT); //Middle
pinMode(ledCol3, OUTPUT); //Right
pinMode(ledCol4, OUTPUT); //Left
pinMode(ledCol5, OUTPUT); //Middle
pinMode(ledCol6, OUTPUT); //Right
pinMode(ledCol7, OUTPUT); //Left
pinMode(ledCol8, OUTPUT); //Middle
pinMode(ledCol9, OUTPUT); //Right
//fill array
ledCol[0] = ledCol1;
ledCol[1] = ledCol2;
ledCol[2] = ledCol3;
ledCol[3] = ledCol4;
ledCol[4] = ledCol5;
ledCol[5] = ledCol6;
ledCol[6] = ledCol7;
ledCol[7] = ledCol8;
ledCol[8] = ledCol9;
ledRow[0] = ledRow1;
ledRow[1] = ledRow2;
ledRow[2] = ledRow3;
testAllLEDs(); //checks all the LEDS make sure they can all light.
}
// the loop routine runs over and over again forever:
void loop() {
frontPaneFigure8();
rightPaneFigure8();
backPaneFigure8();
leftPaneFigure8();
middleUpDown();
antiClockwise(50);
antiClockwise(60);
antiClockwise(70);
clockwise(70);
clockwise(60);
clockwise(50);
frontToBackPane();
rightToLeftPane();
backToFrontPane();
leftToRightPane();
//bottomToTopPanel();
topToBottomPanel();
panelRotateCW();
panelRotateCW();
panelRotateCW();
panelRotateCW();
panelRotateCW();
panelRotateCW();
panelRotateCW();
panelRotateAntiCW();
panelRotateAntiCW();
panelRotateAntiCW();
panelRotateAntiCW();
panelRotateAntiCW();
panelRotateAntiCW();
panelRotateAntiCW();
delay(100);
paneFTR();
paneRTB();
paneBTL();
paneLTF();
paneFTR();
paneRTB();
paneBTL();
paneLTF();
paneFTR();
paneRTB();
paneBTL();
paneLTF();
paneFTR();
paneRTB();
paneBTL();
paneLTF();
paneFTR();
paneRTB();
paneBTL();
paneLTF();
delay(100);
rainLight();
lightning();
rainMed();
lightning();
rainHeavy();
delay(300);
}
//end main loop
//All helper functions used to create designs and patters throughout the loop
//LED movements
//flashes both top and bottom panes
void lightning(){
topPaneOn();
bottomPaneOn();
delay(25);
topPaneOff();
bottomPaneOff();
delay(100);
topPaneOn();
bottomPaneOn();
delay(25);
topPaneOff();
bottomPaneOff();
topPaneOn();
bottomPaneOn();
delay(25);
topPaneOff();
bottomPaneOff();
delay(100);
}
//animate
void rndUpDown(){
randomSeed(analogRead(0)%100);
int row = random(0,100);
}
//animate
//Heavy rain
void rainHeavy(){
int del = 80;
int del2 = 60;
randomSeed(analogRead(0)%10);
//Serial.println("Analog input"); //testing
//Serial.println(analogRead(0)%10); //testing
for(int x= 0; x<50; x++){
int stCol = random(0,colmax);
int stCol2 = random(0,colmax);
int stCol3 = random(0,colmax);
int stCol4 = random(0,colmax);
int dropNum = random(0,9);
//Serial.println(dropNum); //testing
for(int y=rowmax-1;y>-1;y--){
if(y==rowmax-1) del2 = 80; //if first row
onLED(ledRow[y], ledCol[stCol]);
if(dropNum>=4){
onLED(ledRow[y], ledCol[stCol2]);
}
if(dropNum>=7){
onLED(ledRow[y], ledCol[stCol3]);
}
if(dropNum>=8){
onLED(ledRow[y], ledCol[stCol4]);
}
delay(del2);
//turn off all even if they wern't turned on.
offLED(ledRow[y], ledCol[stCol]);
offLED(ledRow[y], ledCol[stCol2]);
offLED(ledRow[y], ledCol[stCol3]);
offLED(ledRow[y], ledCol[stCol4]);
del2=30;
}
delay(del);
}
}
//animate
//light rain
void rainLight(){
int del = 170;
int del2 = 70;
for(int x= 0; x<20; x++){
int stCol = random(0,colmax);
for(int y=rowmax-1;y>-1;y--){
if(y==rowmax-1) del2 = 110;
onLED(ledRow[y], ledCol[stCol]);
delay(del2);
offLED(ledRow[y], ledCol[stCol]);
del2=70;
}
delay(del);
}
}
//animate
//Medium rain
void rainMed(){
int del = 70;
int del2 = 35;
for(int x= 0; x<25; x++){
int stCol = random(0,colmax);
for(int y=rowmax-1;y>-1;y--){
if(y==rowmax-1) del2 = 85;
onLED(ledRow[y], ledCol[stCol]);
delay(del2);
offLED(ledRow[y], ledCol[stCol]);
del2=35;
}
delay(del);
}
}
//animate
//light rain
void rain(){
int del = 150;
int del2 = 50;
for(int x= 0; x<40; x++){
int stCol = random(0,colmax);
for(int y=rowmax-1;y>-1;y--){
if(y==rowmax-1) del2 = 90;
onLED(ledRow[y], ledCol[stCol]);
delay(del2);
offLED(ledRow[y], ledCol[stCol]);
del2=50;
}
delay(del);
}
}
//animate
void paneLTF(){
int del = 100;
leftPaneOn();
delay(del);
leftPaneOff();
diagonalFTBPaneOn();
delay(del);
diagonalFTBPaneOff();
frontPaneOn();
delay(del);
frontPaneOff();
}
//animate
void paneBTL(){
int del = 100;
backPaneOn();
delay(del);
backPaneOff();
diagonalBTFPaneOn();
delay(del);
diagonalBTFPaneOff();
leftPaneOn();
delay(del);
leftPaneOff();
}
//animate
void paneRTB(){
int del = 100;
rightPaneOn();
delay(del);
rightPaneOff();
diagonalFTBPaneOn();
delay(del);
diagonalFTBPaneOff();
backPaneOn();
delay(del);
backPaneOff();
}
//animate
void paneFTR(){
int del = 100;
frontPaneOn();
delay(del);
frontPaneOff();
diagonalBTFPaneOn();
delay(del);
diagonalBTFPaneOff();
rightPaneOn();
delay(del);
rightPaneOff();
}
void panelRotateCW(){
int del = 80;
middlePaneOn();
delay(del);
middlePaneOff();
diagonalBTFPaneOn();
delay(del);
diagonalBTFPaneOff();
middleLRPaneOn();
delay(del);
middleLRPaneOff();
diagonalFTBPaneOn();
delay(del);
diagonalFTBPaneOff();
//back to start.
//middlePaneOn();
//delay(del);
//middlePaneOff();
}
void panelRotateAntiCW(){
int del = 80;
middlePaneOn();
delay(del);
middlePaneOff();
diagonalFTBPaneOn();
delay(del);
diagonalFTBPaneOff();
middleLRPaneOn();
delay(del);
middleLRPaneOff();
diagonalBTFPaneOn();
delay(del);
diagonalBTFPaneOff();
//back to start.
//middlePaneOn();
//delay(del);
//middlePaneOff();
}
void diagonalBTFPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol7, HIGH);
digitalWrite(ledCol9, HIGH);
digitalWrite(ledCol3, HIGH);
}
void diagonalBTFPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol3, LOW);
digitalWrite(ledCol9, LOW);
digitalWrite(ledCol7, LOW);
}
void diagonalFTBPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol1, HIGH);
digitalWrite(ledCol9, HIGH);
digitalWrite(ledCol5, HIGH);
}
void diagonalFTBPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol5, LOW);
digitalWrite(ledCol9, LOW);
digitalWrite(ledCol1, LOW);
}
void frontToBackPane(){
int del = 250;
frontPaneOn();
delay(del);
frontPaneOff();
middlePaneOn();
delay(del);
middlePaneOff();
backPaneOn();
delay(del);
backPaneOff();
middlePaneOn();
delay(del);
middlePaneOff();
frontPaneOn();
delay(del);
frontPaneOff();
}
//animation
void rightToLeftPane(){
int del = 250;
rightPaneOn();
delay(del);
rightPaneOff();
middleLRPaneOn();
delay(del);
middleLRPaneOff();
leftPaneOn();
delay(del);
leftPaneOff();
middleLRPaneOn();
delay(del);
middleLRPaneOff();
rightPaneOn();
delay(del);
rightPaneOff();
}
//animation
void backToFrontPane(){
int del = 250;
backPaneOn();
delay(del);
backPaneOff();
middlePaneOn();
delay(del);
middlePaneOff();
frontPaneOn();
delay(del);
frontPaneOff();
middlePaneOn();
delay(del);
middlePaneOff();
backPaneOn();
delay(del);
backPaneOff();
}
//animation
void leftToRightPane(){
int del = 250;
leftPaneOn();
delay(del);
leftPaneOff();
middleLRPaneOn();
delay(del);
middleLRPaneOff();
rightPaneOn();
delay(del);
rightPaneOff();
middleLRPaneOn();
delay(del);
middleLRPaneOff();
leftPaneOn();
delay(del);
leftPaneOff();
}
//animation
void topToBottomPanel(){
int del = 250;
topPaneOn();
delay(del);
topPaneOff();
middleTBPaneOn();
delay(del);
middleTBPaneOff();
bottomPaneOn();
delay(del);
bottomPaneOff();
middleTBPaneOn();
delay(del);
middleTBPaneOff();
topPaneOn();
delay(del);
topPaneOff();
}
//animation
void bottomToTopPanel(){
int del = 250;
bottomPaneOn();
delay(del);
bottomPaneOff();
middleTBPaneOn();
delay(del);
middleTBPaneOff();
topPaneOn();
delay(del);
topPaneOff();
middleTBPaneOn();
delay(del);
middleTBPaneOff();
bottomPaneOn();
delay(del);
bottomPaneOff();
}
//static
void topPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledCol1, HIGH);
digitalWrite(ledCol2, HIGH);
digitalWrite(ledCol3, HIGH);
digitalWrite(ledCol4, HIGH);
digitalWrite(ledCol5, HIGH);
digitalWrite(ledCol6, HIGH);
digitalWrite(ledCol7, HIGH);
digitalWrite(ledCol8, HIGH);
digitalWrite(ledCol9, HIGH);
}
void topPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledCol1, LOW);
digitalWrite(ledCol2, LOW);
digitalWrite(ledCol3, LOW);
digitalWrite(ledCol4, LOW);
digitalWrite(ledCol5, LOW);
digitalWrite(ledCol6, LOW);
digitalWrite(ledCol7, LOW);
digitalWrite(ledCol8, LOW);
digitalWrite(ledCol9, LOW);
}
//static
void middleTBPaneOn(){
digitalWrite(ledRow2, HIGH);
digitalWrite(ledCol1, HIGH);
digitalWrite(ledCol2, HIGH);
digitalWrite(ledCol3, HIGH);
digitalWrite(ledCol4, HIGH);
digitalWrite(ledCol5, HIGH);
digitalWrite(ledCol6, HIGH);
digitalWrite(ledCol7, HIGH);
digitalWrite(ledCol8, HIGH);
digitalWrite(ledCol9, HIGH);
}
void middleTBPaneOff(){
digitalWrite(ledRow2, LOW);
digitalWrite(ledCol1, LOW);
digitalWrite(ledCol2, LOW);
digitalWrite(ledCol3, LOW);
digitalWrite(ledCol4, LOW);
digitalWrite(ledCol5, LOW);
digitalWrite(ledCol6, LOW);
digitalWrite(ledCol7, LOW);
digitalWrite(ledCol8, LOW);
digitalWrite(ledCol9, LOW);
}
void bottomPaneOn(){
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol1, HIGH);
digitalWrite(ledCol2, HIGH);
digitalWrite(ledCol3, HIGH);
digitalWrite(ledCol4, HIGH);
digitalWrite(ledCol5, HIGH);
digitalWrite(ledCol6, HIGH);
digitalWrite(ledCol7, HIGH);
digitalWrite(ledCol8, HIGH);
digitalWrite(ledCol9, HIGH);
}
void bottomPaneOff(){
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol1, LOW);
digitalWrite(ledCol2, LOW);
digitalWrite(ledCol3, LOW);
digitalWrite(ledCol4, LOW);
digitalWrite(ledCol5, LOW);
digitalWrite(ledCol6, LOW);
digitalWrite(ledCol7, LOW);
digitalWrite(ledCol8, LOW);
digitalWrite(ledCol9, LOW);
}
void rightPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol3, HIGH);
digitalWrite(ledCol4, HIGH);
digitalWrite(ledCol5, HIGH);
}
void rightPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol3, LOW);
digitalWrite(ledCol4, LOW);
digitalWrite(ledCol5, LOW);
}
void middleLRPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol2, HIGH);
digitalWrite(ledCol9, HIGH);
digitalWrite(ledCol6, HIGH);
}
void middleLRPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol2, LOW);
digitalWrite(ledCol9, LOW);
digitalWrite(ledCol6, LOW);
}
void leftPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol7, HIGH);
digitalWrite(ledCol8, HIGH);
digitalWrite(ledCol1, HIGH);
}
void leftPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol7, LOW);
digitalWrite(ledCol8, LOW);
digitalWrite(ledCol1, LOW);
}
void backPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol5, HIGH);
digitalWrite(ledCol6, HIGH);
digitalWrite(ledCol7, HIGH);
}
void backPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol5, LOW);
digitalWrite(ledCol6, LOW);
digitalWrite(ledCol7, LOW);
}
//-------------------------------
void middlePaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol4, HIGH);
digitalWrite(ledCol8, HIGH);
digitalWrite(ledCol9, HIGH);
}
void middlePaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol4, LOW);
digitalWrite(ledCol8, LOW);
digitalWrite(ledCol9, LOW);
}
void frontPaneOn(){
digitalWrite(ledRow1, HIGH);
digitalWrite(ledRow2, HIGH);
digitalWrite(ledRow3, HIGH);
digitalWrite(ledCol1, HIGH);
digitalWrite(ledCol2, HIGH);
digitalWrite(ledCol3, HIGH);
}
void frontPaneOff(){
digitalWrite(ledRow1, LOW);
digitalWrite(ledRow2, LOW);
digitalWrite(ledRow3, LOW);
digitalWrite(ledCol1, LOW);
digitalWrite(ledCol2, LOW);
digitalWrite(ledCol3, LOW);
}
void antiClockwise(int movSpeed){
int delVal = movSpeed;
for(int x=0; x<3; x++){
for(int y=0; y<8; y++){
onLED(ledRow[x],ledCol[y]);
delay(delVal);
offLED(ledRow[x],ledCol[y]);
}
}
}
void clockwise(int movSpeed){
int delVal = movSpeed;
for(int x=2; x>-1; x--){
for(int y=7; y>-1; y--){
onLED(ledRow[x],ledCol[y]);
delay(delVal);
offLED(ledRow[x],ledCol[y]);
}
}
}
//snake movement on front pane only
void frontPaneFigure8(){
int delVal = 130;
for(int y=0;y<3;y++){
onLED(ledRow[0],ledCol[y]);
delay(delVal);
offLED(ledRow[0],ledCol[y]);
}
for(int y=2;y>-1;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
for(int y=0;y<3;y++){
onLED(ledRow[2],ledCol[y]);
delay(delVal);
offLED(ledRow[2],ledCol[y]);
}
for(int y=2;y>-1;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
}
void rightPaneFigure8(){
int delVal = 130;
for(int y=2;y<5;y++){
onLED(ledRow[0],ledCol[y]);
delay(delVal);
offLED(ledRow[0],ledCol[y]);
}
for(int y=4;y>1;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
for(int y=2;y<5;y++){
onLED(ledRow[2],ledCol[y]);
delay(delVal);
offLED(ledRow[2],ledCol[y]);
}
for(int y=4;y>1;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
}
void backPaneFigure8(){
int delVal = 130;
for(int y=4;y<7;y++){
onLED(ledRow[0],ledCol[y]);
delay(delVal);
offLED(ledRow[0],ledCol[y]);
}
for(int y=6;y>3;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
for(int y=4;y<7;y++){
onLED(ledRow[2],ledCol[y]);
delay(delVal);
offLED(ledRow[2],ledCol[y]);
}
for(int y=6;y>3;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
}
void leftPaneFigure8(){
int delVal = 130;
for(int y=6;y<8;y++){
onLED(ledRow[0],ledCol[y]);
delay(delVal);
offLED(ledRow[0],ledCol[y]);
}
//back to first
onLED(ledRow[0],ledCol[0]);
delay(delVal);
offLED(ledRow[0],ledCol[0]);
//back to first
onLED(ledRow[1],ledCol[0]);
delay(delVal);
offLED(ledRow[1],ledCol[0]);
for(int y=7;y>5;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
for(int y=6;y<8;y++){
onLED(ledRow[2],ledCol[y]);
delay(delVal);
offLED(ledRow[2],ledCol[y]);
}
//back to first
onLED(ledRow[2],ledCol[0]);
delay(delVal);
offLED(ledRow[2],ledCol[0]);
//back to first
onLED(ledRow[1],ledCol[0]);
delay(delVal);
offLED(ledRow[1],ledCol[0]);
for(int y=6;y>5;y--){
onLED(ledRow[1],ledCol[y]);
delay(delVal);
offLED(ledRow[1],ledCol[y]);
}
}
void middleUpDown(){
int delVal = 130;
onLED(ledRow[0],ledCol[8]);
delay(delVal);
offLED(ledRow[0],ledCol[8]);
onLED(ledRow[1],ledCol[8]);
delay(delVal);
offLED(ledRow[1],ledCol[8]);
onLED(ledRow[2],ledCol[8]);
delay(delVal);
offLED(ledRow[2],ledCol[8]);
onLED(ledRow[1],ledCol[8]);
delay(delVal);
offLED(ledRow[1],ledCol[8]);
onLED(ledRow[0],ledCol[8]);
delay(delVal);
offLED(ledRow[0],ledCol[8]);
}
//turn on all LEDs one by one.
void testAllLEDs(){
int delVal = 500;
for(int x=0;x<3;x++){
for(int y=0;y<9;y++){
//Serial.print(x + " " + y);
onLED(ledRow[x],ledCol[y]);
delay(delVal);
offLED(ledRow[x],ledCol[y]);
delay(200);
}
}
}
//turn on LED based on row number and column number
void onLED(int row, int col){
digitalWrite(row, HIGH); //turn on row
digitalWrite(col, HIGH); //turn on col
}
//overload funtion - used to turn LED on with certain intensity
void onLED(int row, int col, int value){
digitalWrite(row, HIGH); //turn on row
analogWrite(col, value); //turn on col
}
//turn off LED based on row number and column number
void offLED(int row, int col){
digitalWrite(row, LOW); //turn on row
digitalWrite(col, LOW); //turn on col
}
view raw gistfile1.txt hosted with ❤ by GitHub



















Reference:
http://randomnerdtutorials.com/arduino-led-cube-3x3x3

Thursday, November 7, 2013

Week of November 4 Project Update

Post # 3

Second Team Meeting
11/7/2013
Thursday 2pm, Perry 311
All team members present

Summary:

Building off what was discussed is the first meeting the overall project idea was finalized.
A 3 X 3 LED cube will be mounted on top of a motion mechanism. This mechanism will
consist of two servo motors connected in a vertical configuration, with mounting platforms
in between them. This motion mechanism will be mounted to a base. The input to the LED
cube will be data that is mapped from a microphone. The microphone could also be used to control the servo motors. There will be an option to control the servo motors with two
potentiometers. This option will be activated by a pushbutton.

The following was researchd for the project.

Script to use microphone input
/*
microphone sketch
SparkFun breakout board for Electret Microphone is connected to analog pin 0
*/
const int ledPin = 13; //the code will flash the LED in pin 13
const int middleValue = 512; //the middle of the range of analog values
const int numberOfSamples = 128; //how many readings will be taken each time
int sample; //the value read from microphone each time
long signal; //the reading once you have removed DC offset
long averageReading; //the average of that loop of readings
long runningAverage=0; //the running average of calculated values
const int averagedOver= 16; //how quickly new values affect running average
//bigger numbers mean slower
const int threshold=400; //at what level the light turns on
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
long sumOfSquares = 0;
for (int i=0; i<numberOfSamples; i++) { //take many readings and average them
sample = analogRead(0); //take a reading
signal = (sample - middleValue); //work out its offset from the center
signal *= signal; //square it to make all values positive
sumOfSquares += signal; //add to the total
}
averageReading = sumOfSquares/numberOfSamples; //calculate running average
runningAverage=(((averagedOver-1)*runningAverage)+averageReading)/averagedOver;
if (runningAverage>threshold){ //is average more than the threshold ?
digitalWrite(ledPin, HIGH); //if it is turn on the LED
}else{
digitalWrite(ledPin, LOW); //if it isn't turn the LED off
}
Serial.println(runningAverage); //print the value so you can check it
}
view raw gistfile1.txt hosted with ❤ by GitHub
Wiring schematic for microphone input



Going Forward:

Break down of project components:

- Base
    * Material: acrylic or Lego parts
- Motion Mechanism
    * 2 servo motors
    * Platforms/brackets that attach to each servo
    * Write code for servo motor control using either microphone or potentiometer
    * Create the solid models for this mechanism
    * Material: ABS plastic. This part will be 3-D printed
- LED Cube
    * Assembly/ wiring of 3 X 3 LED structure
    * Mounting to motion mechanism
    * Write code for visualizer display
- Sensors/Controls
    * 2 potentiometers
    * 1 microphone (analog input)
    * 1 pushbutton
    * Write code for pushbutton option and organize layout.


All team members contributed equally.
Total hours for this week per individual: 3.5 hours

Tuesday, November 5, 2013

Post #2

First Team Meeting:
11/5/13
Tuesday 2pm, Perry 311
All team members present

Summary:

Discussion and brainstorming continued of project ideas. The idea of a music visualizer was chosen as a key part of the overall design. A microphone will be used as the input sensor to control a LED array and possibly motor speed. A solid model will be 3D printed and controlled by a motor to provide further visual entertainment.

The following two YouTube videos were used as starting points in brainstorming. The idea of a 3D LED cube seemed very appealing while the pen movement mechanism provided a practical solution to the project requirement of having motion options.







The following image is a rough schematic of the project idea.

 
 


For next meeting come up with potential ideas for solid model to be controlled by motor.


Post#1:

11/05/2013                                                                                       Perry 311

Team member:

Samir Meskinaoui
Jennifer Droke
Matthew Popelka


Meeting schedule :




Time


Place


Tuesday at 2 PM


Perry 311


Thursday at 2 PM


Perry 311

 
 
Summary:
During lab section on Tuesday 5, 2013:
1.       Filled out a team contract and submited it to instructor.
2.       Chose specific meeting times each week.
3.       Designated a name and created a blog for the project.