D6Dice
Published © GPL3+

Suitcase with Secrets

Make a suitcase that can open using the secret buttons.

EasyShowcase (no instructions)4
Suitcase with Secrets

Things used in this project

Hardware components

Arduino Mega 2560 & Genuino Mega 2560
Arduino Mega 2560 & Genuino Mega 2560
×1
Servo Module (Generic)
×1
Grove - Round Force Sensor (FSR402)
Seeed Grove - Round Force Sensor (FSR402)
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×1
Jumper wires (generic)
Jumper wires (generic)
×7
Male/Female Jumper Wires
Male/Female Jumper Wires
×2
Resistor 10k ohm
Resistor 10k ohm
×1

Hand tools and fabrication machines

Drill / Driver, Cordless
Drill / Driver, Cordless
Soldering iron (generic)
Soldering iron (generic)
Tape, Double Sided
Tape, Double Sided
Tape, Painters Tape
Tape, Painters Tape

Story

Read more

Schematics

circuit suitcase

this is how all the componets are routed

Code

Code suitcase

Arduino
/*

 by Marieke Groothuis
 This example code is in the public domain.
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

int pos = 0;    // variable to store the servo position
int pushButton = 2; //pushbutton is connected to pin 2
int fsrAnalogPin = 0; // FSR is connected to analog 0
int fsrReading;      // the analog reading from the FSR resistor divider

void setup()
{
  Serial.begin(9600);
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  pinMode(pushButton, INPUT_PULLUP);
}

void loop() {
  int buttonState = digitalRead(pushButton);
  int fsrReading = analogRead(fsrAnalogPin); 
  Serial.print("Analog reading = ");
  Serial.println(fsrReading); // prints the pressure on the FRS
  if (buttonState == 1 || fsrReading < 700) { //checks if the button isn't pressed or if the pressure on the FRS is lower than 700. if either of those are true, the servo moves to position 200
    pos = 200;
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(100);
  }
  else if (buttonState == 0 && fsrReading > 700 ) { //checks if the button is pressed and if the pressure on the FRS is higher than 700. if both of those are true, the servo moves to position 90
    pos = 90;
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(100);
  }
}

Credits

D6Dice

D6Dice

0 projects • 0 followers

Comments

Add projectSign up / Login