Utilities
resOURce Smart Studio System - Prototype 2
Made by Melanie Swartz, Stefanie Owens, Stephen Krotseng, hlgraffeo, Alex Surasky-Ysasi, gwilson, Jeremy Jiang, Ethan Krokonko, jhjenkin and Christopher Holliday
Made by Melanie Swartz, Stefanie Owens, Stephen Krotseng, hlgraffeo, Alex Surasky-Ysasi, gwilson, Jeremy Jiang, Ethan Krokonko, jhjenkin and Christopher Holliday
Tools like wire strippers, pliers, X-acto knives, or soldering irons are often purchased by a university, but their tendency to disappear or not be around when students need them can lead to tension and an inability to finish projects in the timely manner desired. Utilities addresses this issue by putting bluetooth tags on these objects so that they can be checked out of the utility cabinet and the knowledge of who has what tools becomes clear.
Created: March 2nd, 2015
The core idea for this cabinet was a way to figure out who had what tools within the studio, rather than having to constantly search and ask where tools are. The concept was that the tool cabinet would be unlocked using a finger print scanner and then the tools could be tracked using Bluetooth beacons, so the system would know when they were removed and could help locate them within the studio space. The system also displays who has checked out a particular type of tool. There was also further discussion that perhaps some ambient display could be created to help students track down tools in the studio space if they needed something that was checked out.
The team started with idea of some sort of check out system for tools that are often used, but not always needed by all individuals (hence not all students by their own). Then we developed a storyboard of use case scenario to understand the type of interactions that the system would need to provide and this can be seen below.
We then explained our idea to our professor and he suggested we use Bluetooth communication and that we just track individual tools rather than rolls of tools, which we had been saying we would verify were complete using pressure sensors. These sensors can be sensitive to uneven weight distribution and can be tricky to make work. Rather the focus for this concept is on the core concepts of verifying users and the system having knowledge of what tools have been removed.
To that end we went ahead and ordered a few special components including the following:
-Adafruit Fingerprint Sensor
-Bluetooth LE Breakout - nrf8001 (BLE 4.0)
-Spark Battery Shield
Beyond this we also planned to leverage some Estimote beacons that the lab already on hand in order to do the Bluetooth tracking of tools.
We then attempted to prototype with these times, but ran into some issues with the fingerprint sensor and the Bluetooth breakout. The fingerprint sensor was originally designed to work with an Arduino board, but it should have been possible to port it over to the Spark core, which is the system were were prototyping with. After extensive experimentation there seemed to an issue with the serial communication. At this point we transitioned to using a pin code access system. Ideally we think a biometric system would be best because ID cards get lost and pin codes get forgotten.
To create the pin code system we used a combination of push buttons that have to be pressed in a particular order to match internal pre-programmed codes that are particular to each student. There is also a reset button to start over at any point in the process. The code is complete and shown below along with a diagram of the circuit.
In terms of the code to work with the nrf8001, there was Github code that had been posted by trond-snekvik, which had all the libraries needed. The code ran once any files that were not .h, .cpp or .ino were removed from the folder with the code and #include "nrf8001-ble-uart-spark-io.h" was uncommented. At that point the sample code ran, but with further investigation from our professor that this piece of hardware was actually not the correct one for the functionality we were looking for. We believe that the Red Bear Lab BLE Mini might be a good option going forward based on the documentation posted by krvarma on GitHub. For the purposes of the demonstration we used IFTTT and Yo, so that by hitting Yo when a tool is removed the cabinet the blue light turns on for the corresponding person.
Below is the parts list, circuit diagram and code from our final prototype is below.
//Create IDs
char melanie[3];
char stephen[3];
char alex[3];
char test[3];
//button inputs
int buttonPin1 = D3;
int buttonPin2 = D4;
int buttonPin3 = D5;
int buttonPin4 = D2;
//previous button state
int lastButtonState1 = HIGH;
int lastButtonState2 = HIGH;
int lastButtonState3 = HIGH;
int lastButtonState4 = HIGH;
//LED outputs
int ledPin1 = D6; //blue, melanie took a tool
int ledPin2 = D1; //red, incorrect code entered
int ledPin3 = A1; //green, melanie unlocked
int ledPin4 = A4; //green, alex unlocked
int ledPin5 = A5; //green, stephen unlocked
//number of code characters entered
int counter = 0;
int status = 0;
//simulating hammer removed from cabinet
int hammerRemove(String command);
void setup(){
//establishing pin codes for different individuals
melanie[0] = 'A';
melanie[1] = 'A';
melanie[2] = 'A';
stephen[0] = 'A';
stephen[1] = 'B';
stephen[2] = 'A';
alex[0] = 'C';
alex[1] = 'A';
alex[2] = 'B';
// set pins as input
pinMode(buttonPin1 , INPUT_PULLUP);
pinMode(buttonPin2 , INPUT_PULLUP);
pinMode(buttonPin3 , INPUT_PULLUP);
pinMode(buttonPin4 , INPUT_PULLUP);
//digital LED set up
pinMode(ledPin1, OUTPUT);
digitalWrite(ledPin1, LOW);
pinMode(ledPin2, OUTPUT);
digitalWrite( ledPin2, LOW);
//analog LED set up
pinMode(ledPin3, OUTPUT);
analogWrite( ledPin3, 0);
pinMode(ledPin4, OUTPUT);
analogWrite( ledPin4, 0);
pinMode(ledPin5, OUTPUT);
analogWrite( ledPin5, 0);
//create cloud variables for variables as needed
//Spark.variable("melanie", &melanie, STRING);
//Spark.variable("stephen", &stephen, STRING);
//Spark.variable("alex", &alex, STRING);
Spark.variable("test", &test, STRING);
//create function to trigger using Yo and IFTTT simulating bluetooth
Spark.function("hammer", hammerRemove);
}
void loop(){
//read button states
int buttonState1 = digitalRead(buttonPin1);
int buttonState2 = digitalRead(buttonPin2);
int buttonState3 = digitalRead(buttonPin3);
int buttonState4 = digitalRead(buttonPin4);
//check to see if button states have changed since the loop last ran
if( buttonState1 != lastButtonState1 or buttonState2 != lastButtonState2
or buttonState3 != lastButtonState3 or buttonState4 != lastButtonState4)
{
//set of if statements to input pin codes as buttons are pressed or to
//reset if the red button is pressed
if(buttonState1==LOW){
test[counter] = 'A';
counter++;
delay( 1000 );
}else if(buttonState2 == LOW){
test[counter] = 'B';
counter++;
delay( 1000 );
}else if(buttonState3 == LOW){
test[counter] = 'C';
counter++;
delay( 1000 );
}else if(buttonState4 == LOW){
counter = 0;
//if reset button is repressed, then go back to beginning in entering
//code and turn off any lights that are on
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
analogWrite(ledPin3, 0);
analogWrite(ledPin4, 0);
analogWrite(ledPin5, 0);
delay( 1000 );
}
}
//once three digits have been entered as the pin then that pin is compared to
//the ID codes, if it matches then that person's green light turns on
//if none of the codes match then the red light turns on
if( counter >= 3 ){
if( doCompare( test, melanie ) )
status = 1;
if( doCompare( test, alex ) )
status = 2;
if( doCompare( test, stephen ) )
status = 3;
//operate LEDs based on status
if(status == 1){
analogWrite(ledPin3, 255);
}else if(status==2){
analogWrite(ledPin4, 255);
}else if(status==3){
analogWrite(ledPin5, 255);
}else{
digitalWrite(ledPin2, HIGH);
}
//reset the counter to zero so a new code can be entered
counter = 0;
}
//save current button state so it can be compared to the new button state the
//next time the loops runs
lastButtonState1 = buttonState1;
lastButtonState2 = buttonState2;
lastButtonState3 = buttonState3;
lastButtonState4 = buttonState4;
delay( 50 );
}
//this function iterates through the two different character arrays to see
//if they match
boolean doCompare( char array1[], char array2[] )
{
boolean doesMatch = true;
for( int i =0 ; i < 3; i++ )
{
if( array1[i] != array2[i] )
doesMatch = false;
}
return doesMatch;
}
//
int hammerRemove(String command){
digitalWrite( ledPin1, HIGH);
}
Click to Expand
Tools like wire strippers, pliers, X-acto knives, or soldering irons are often purchased by a university, but their tendency to disappear or not be around when students need them can lead to tension and an inability to finish projects in the timely manner desired. Utilities addresses this issue by putting bluetooth tags on these objects so that they can be checked out of the utility cabinet and the knowledge of who has what tools becomes clear.