OVERVIEW

In an effort to save money, I created a difficult wallet to bombard you with guilt-inducing questions and will only unlock if you’ve proven your desperation and need.

 

 

Process
Discussion

While the double transducer gave me the opportunity to test sensors and different technologies, I was glad this project allowed me to explore more aspects of the physical structure. In the critique, there was a positive response to the design of my case. I received comments such as, “Very finished design!” and “Clean and smooth. I want to actually use this in my everyday life.” I’m happy that all the work I put into the final box paid off and that people appreciated the design. While I ideally would have covered the wires with an interior casing instead of zip-tying them under the lid, I’m satisfied with how it looks and enjoyed experimenting with latches and living hinges.

During the process, I was excited work with laser cutting in a way I had never considered and had fun testing how different cuts, dimensions, and materials affected the living hinges. One mistake I kept making, however, was underestimating how much space I needed in the box for all my electrical components. After spending hours trying to figure out how I could fit everything into the tiny box I had already cut, I finally gave in and created a larger case. In addition, from learning how to use the LCD screen with just internet resources, I feel a lot more confident in my ability to teach myself more about the Arduino and it’s capabilities for future projects.

If I had a chance to make another iteration, I believe I could get more complex with the coding of the questions. Instead of asking the same 5 questions every time and counting the “yes” responses to open the box, I think it would be more exciting if the responses affected the questions being asked (i.e., “Is this food related?” [Y]> “This isn’t another late night Chipotle run, is it?”). I’d also like to address the issue of my box locking me out due to technical failures. During my demonstration, my reset button came unpinned and prevented me from reopening the box. While my first thought was to solder everything to keep wires from coming loose, I received some interesting suggestions for an “emergency latch to bypass the lock.” Although it would probably still be helpful to solder my wires, I think the emergency latch would be an exciting and helpful solution to this common problem. In spite of all these alterations I would like to make, I enjoyed this project for giving me the opportunity to explore different making techniques and their relationship to physical computing.

SCHEMATIC

code
// Reluctant Wallet
// Eliza Pratt

//Description: This project asks a user questions about their potential spending on an LCD
//and keeps a counter of the "yes" and "no" responses that are input through buttons. 
//Depending on the user's responses, a servo will rotate to "open the wallet". 

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

LiquidCrystal_I2C screen(0x27, 16, 2);
Servo myservo;

const int YESBUTTON = 2;
const int NOBUTTON = 3;
const int SWITCH = 4;

bool yOn = false; 
bool nOn = false;
bool off = false;

int yCount = 0; // yes counter
int nCount = 0; // no counter 
int qCount = 0; // number of questions asked

int pos = 75; // "locked" servo position

//Questions are split into two arrays so all text will display on the LCD without scrolling
String question[ ] = { "Do you even want this?", "Is it on sale?", 
  "Will you regret not buying this?", "Will this make", 
  "Would you save  it from a fire?" };

String question2[ ] = { "this?", "", 
  "not buying this?", "your life better?", 
  "it from a fire?" };
  
void setup() {
  Serial.begin(9600);
  pinMode(YESBUTTON, INPUT);
  pinMode(NOBUTTON, INPUT);
  pinMode(SWITCH, INPUT);

  myservo.attach(9);

  //at setup, light up LCD and print first question
  screen.init();
  screen.backlight();
  screen.home();
  screen.print(question[qCount]);
  myservo.write(pos);

}

void loop() {
  int yes = digitalRead(YESBUTTON);
  int no = digitalRead(NOBUTTON);
  int on = digitalRead(SWITCH);

  Serial.println(on);
  screen.home();
  
  //ASKING QUESTIONS
  //display current question on LCD
  if (qCount < 5) {
    screen.print(question[qCount]);
    screen.setCursor(0, 1);
    screen.print(question2[qCount]);
  }
  
  //AFTER 5 QUESTIONS
  else { 
    screen.clear();
    //if at least four responses were "yes," rotate servo to let them in
    if (yCount > 3 && !off) {
      screen.print("Fine.");
      screen.setCursor(0, 1);
      screen.print("you can come in.");
      myservo.write(20);

    }
    //With less than 4 "yes"s, display sorry message and turn off device
    else {
      screen.print("Sorry.");
      screen.setCursor(0, 1);
      screen.print("Not this time.");
      delay(5000);
      turnOff();
    }
  }
  
  //if "yes" button is pressed
  if (yes == 0 && !yOn) {
    Serial.println("YES");
    screen.clear();
    yOn = true;
    yCount++;
    qCount++;
  }
  //if "no" button is pressed
  else if (no == 0 && !nOn) { 
    Serial.println("NO");
    screen.clear();
    nOn = true;
    nCount++;
    qCount++;
    
  }

  // reads buttons as "off" when unpressed
  if (yes == 1) yOn = false;
  if (no == 1) nOn = false; 

  //if both buttons are pressed, close latch and turn off screen
  if (yes == 0 && no == 0) turnOff();
  delay(50);
}


///when "turned off", turn off LCD display and reset servo position
void turnOff() {
  off = true;
  screen.clear();
  screen.noDisplay();
  screen.noBacklight();
  myservo.write(pos);
  delay(500);
  
}