My friend has always been the worst when it came to forgetting different things at different places. Forgetting her debit card at the malls, shops was getting her be limited to purchases, especially when her phone runs out of battery (apple pay would no longer be available lol). So I decided to make a switch that reminds her to put her credit card back in its place sometime out.

I started by placing a switch in the circuit and making it work using a normal push-button switch. once I finished the circuit I replaced one end of the switch with a wire connected to the credit card and the other end with a wire connected to a cardholder that is to be stuck to a phone.

I connected the wires to copper tape that I stuck on contacting sides of the card and the cardholder so that when the card is in place, the switch is closed.

IMG_1437.jpg

I used a green led light for the normal time, which indicates when the credit card is placed in its location. And when you remove the card from the cardholder, a timer starts, when the time span in the code ends, the red light starts to blink to remind you to put the credit card back in!

This is how my breadbord looks like:

IMG_1441.jpg

This is how my Arduino code looks like:

long mytime=500, timer = 0;
const int outs[] = {3, 4};
const int ins = A2;
int curr = 0, prev=0;
bool flip=false;
long blinkk=0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  for (int i = 0; i < 2; i++) {
    pinMode(outs[i], OUTPUT);
  }
  pinMode(ins, INPUT);
}

void loop() {
  curr = digitalRead(ins);// <500, <900, >900
  if (curr == 0) {
    Serial.print(timer);
    Serial.print(" ");
    Serial.println(mytime);
    if (mytime == timer) {
      if(blinkk<=millis()){
        flip=!flip;
        blinkk+=500;
      }
      digitalWrite(outs[0], flip);
      digitalWrite(outs[1], LOW);
    }
    else{
      timer+=1;
      digitalWrite(outs[0], LOW);
      digitalWrite(outs[1], LOW);
    }
  }
  else {
    {
      timer=0;
      digitalWrite(outs[1], HIGH);
      digitalWrite(outs[0], LOW);
      blinkk=millis();
    }
  }
  prev = digitalRead(ins);
}

Video DEMO:

IMG_1434.mov

IMG_1435.MOV