Tuesday, May 12, 2015

Week Seven

 The goals for this week are to finish the digital cricuit diagram using Fritzing's Schematic View, write a code to test a 2 by 3 LED matrix, begin soldering the key matrix, solidify the capacitive sensing details, and begin to combine codes for the different tasks.

On Tuesday, we also finalized the draft final report by shortening wordy paragraphs and fixing the IEEE citations. The report will be sent to our adviser for feedback and to the class advisor for confirmation of participation in the poster contest.

Mercedes began coding a 2 by 3 LED matrix which uses I/O pins and Serial communication to determine which LED turns on. However, we had a problem connecting to the Serial on Mercedes' laptop. Of course, electronics have their own minds and the issue resolved itself upon repowering.

Amy continued to learn about capacitive sensing and will add the circuits to the Fritzing diagram by the end of the week. This has since been completed

Gabrielle finished the rest of the circuit diagram, which can be seen below.

Entire Circuit Diagram (Updated)
Arduino Due and Pins

Capacitive Sensing (Yellow, Power; Blue, Ground)


LED Matrix (Red, Power; Black, Ground)

Switch Matrix (Green, Power, White (grey), Ground) (Updated)

Amy and Gabrielle plan to meet after our 10 o'clock class on Friday in Lebow to begin soldering the key matrix. While the team has met on Friday this week, the commencement of soldering has been delayed to the weekend. While we tried to solder on the weekend, it was found that the Excite Center is locked and soldering has again been delayed.

 On Friday, Gabrielle coded her own keyboard matrix using the Arduino Keyboard commands available for the Due and Leonardo. A video of the working matrix and the code can be seen below.

Working Key Matrix (2 by 3)
KEY MATRIX CODE:

// choose pins used for rows and collumns of key matrix
int rowPins[2] = {10,11};
int colPins[3] = {A0,A1,A2};

char Letters[2][3] = {
    {'A', 'G', 'M'},
    {'T', 'R', 'V'}
   };

void setup() {
  // make collumns inputs and turn on the
  // pullup resistor so they go high unless
  // switch is pressed, connecting them to
  // rows which are low outputs (ground):
  for (int a=0; a<3; a++){
    pinMode(colPins[a], INPUT_PULLUP);
  }
  for (int b=0; b<2; b++){
    pinMode(rowPins[b], OUTPUT);
    digitalWrite(rowPins[b],HIGH);
  }
  Keyboard.begin();
}

void loop() {
 
  // Turn each row to low one at a time to LOW
  // to cycle through the rows of the matrix
  for (int c=0; c<2; c++){
    digitalWrite(rowPins[c],LOW);
   
    //check for whether each key in the row is pressed
    //a key is pressed if it reads as LOW and not pressed
    //if it reads as HIGH
    //if a key is pressed, print out the character assigned to it
   
    for (int d=0; d<3; d++){
      if(digitalRead(colPins[d])== LOW){
        Keyboard.write(Letters[c][d]);
      }
      delay(50);
    }
    digitalWrite(rowPins[c],HIGH);
    delay(100);
  }
}

Mercedes similarly coded a LED matrix. A video and the code can also be found below.


The code models the LED response for the "qwe asd" section of the keyboard.

//2 by 3 LED array
//rows anodes (+ and long), columns cathodes (- and short)
//Imagine LEDs for qwe; asd
const int rowPins[2] = {43,45};
const int colPins[3] = {49,51,53};
char code;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  // initialize the I/O pins as outputs:
    // initialize the output pins:
  pinMode(colPins[0], OUTPUT);
  pinMode(rowPins[0], OUTPUT);
  pinMode(colPins[1], OUTPUT);
  pinMode(rowPins[1], OUTPUT);
  pinMode(colPins[2], OUTPUT);
 
  // take the col pins (i.e. the cathodes) high to ensure that
  // the LEDS are off:
  digitalWrite(colPins[0], HIGH);
  digitalWrite(rowPins[0], LOW);
  digitalWrite(colPins[1], HIGH);
  digitalWrite(rowPins[1], LOW);
  digitalWrite(colPins[2], HIGH);
}

void loop() {
  // take in a code and light up corresponding LED
  code = Serial.read();
  if (code == 'q'){
    digitalWrite(rowPins[0], HIGH);
    digitalWrite(colPins[0], LOW);
    delay(1000);
    digitalWrite(colPins[0], HIGH);
    digitalWrite(rowPins[0], LOW);
    digitalWrite(colPins[1], HIGH);
    digitalWrite(rowPins[1], LOW);
    digitalWrite(colPins[2], HIGH);
  }
  if (code == 'w'){
    digitalWrite(rowPins[0], HIGH);
    digitalWrite(colPins[1], LOW);
    delay(1000);
    digitalWrite(colPins[0], HIGH);
    digitalWrite(rowPins[0], LOW);
    digitalWrite(colPins[1], HIGH);
    digitalWrite(rowPins[1], LOW);
    digitalWrite(colPins[2], HIGH);
  }
  if (code == 'e'){
    digitalWrite(rowPins[0], HIGH);
    digitalWrite(colPins[2], LOW);
    delay(1000);
    digitalWrite(colPins[0], HIGH);
    digitalWrite(rowPins[0], LOW);
    digitalWrite(colPins[1], HIGH);
    digitalWrite(rowPins[1], LOW);
    digitalWrite(colPins[2], HIGH);
  }
  if (code == 'a'){
    digitalWrite(rowPins[1], HIGH);
    digitalWrite(colPins[0], LOW);
    delay(1000);
    digitalWrite(colPins[0], HIGH);
    digitalWrite(rowPins[0], LOW);
    digitalWrite(colPins[1], HIGH);
    digitalWrite(rowPins[1], LOW);
    digitalWrite(colPins[2], HIGH);
  }
  if (code == 's'){
    digitalWrite(rowPins[1], HIGH);
    digitalWrite(colPins[1], LOW);
    delay(1000);
    digitalWrite(colPins[0], HIGH);
    digitalWrite(rowPins[0], LOW);
    digitalWrite(colPins[1], HIGH);
    digitalWrite(rowPins[1], LOW);
    digitalWrite(colPins[2], HIGH);
  }
  if (code == 'd'){
    digitalWrite(rowPins[1], HIGH);
    digitalWrite(colPins[2], LOW);
    delay(1000);
    digitalWrite(colPins[0], HIGH);
    digitalWrite(rowPins[0], LOW);
    digitalWrite(colPins[1], HIGH);
    digitalWrite(rowPins[1], LOW);
    digitalWrite(colPins[2], HIGH);
  }
}


In addition to soldering, the group plans to begin condensing the test codes into one complex code and write complete matrices for the finished prototype.

No comments:

Post a Comment