Data, Ecology, Art

Code Blog

RFID Reading

rfid_screenshot

Taking Attendance with RFID via WaveID and Processing (02/19/20)

WaveId pcProx RFID readers deliver a simple key entry string to processing. We figure out how many digits the RFID card produces, capture the entry once that character length is reached, and then do our database (or .csv file) operations to take attendance from students or do whatever else can be counted with RFID.

void keyPressed() {
  if (key == 's') 
    
   else {
    keySequence = keySequence+str(key); 
    println("k length" + keySequence.length());
    if (keySequence.length() == 6) {
      int subInt = int(keySequence.substring(0, 5)); 
      println("gotkeySequence = "+subInt);
      for (int i = 0; i < IDtable.getRowCount(); i++) {
        if (subInt == IDtable.getInt(i, "id")) {
          output = "Hello,\n"+IDtable.getString(i, "name");
          println("Hello, "+keySequence);
          int today = IDtable.getInt(i, "last");
          if (today != day()){
            IDtable.setInt(i, "last", day());
            int count = IDtable.getInt(i, "count"); 
            IDtable.setInt(i, "count", count+1);
          }
          keySequence = ""; 
          println("cleared keySequence length = " +keySequence.length());
        }
      }
    }
  }
}

The “saveRecord();” function simply writes the updated csv file to the data directory when we press the “s” key. Note that we have to get the pairing of the RFID number and the student name manually, once. Of course, many more cool stats, animations, and data manifestations are possible.

The full code is available here: RFID03

Greg Niemeyer