Locker Rental

Team Members

  • David Li
  • Kishore Nathan
  • Alfonso Olalla Santamarina
  • Mark Woodson

Description

The locker allows safe personal storage without bringing a lock with you. The locker allows deliveries and drop off without having to meet in person. A person comes to rent a locker and store the item inside, afterwards, they create a code to properly lock the locker. When a person wants to unlock a locker, they simply enter the code that was assigned for that designated locker.


Hardware

Required Parts

PartQuantity
/media/uploads/mwoodson7/mbed.gifMbed1
uLCDuLCD-144 board1
BluefruitBluefruit LE1
LEDLED's3
PushbuttonPushbutton1
RelayRelay2
AmplifierAmplifier2
Barrel JackBarrel Jack1
AC Adapter5VDC 2A AC adapter1
PhotocellPhotocell Light Sensor1
SpeakerSpeaker1
MagnetMagnet2

Pinouts

Mbed5VDC 2A AC adapterPushbuttonuLCDBluefruit LESpeakerPhotocell1,2Led1,2,3Relay 1,212V
GND-GNDCTS, GND--, -, --, -, --, -
Vout+
5V5VVin
p8+
p9RX
p10TX
p11Reset
p18, 19+, +
p20,21+, +in, in
p26+
p25-
p27TXO
p28RXI
+, +12 V

Schematic

Locker Rental Pin Scheme


Software

Mbed Program

Import programfinal_projec_4180

fianl project

Code Snippets

Locker

typedef struct Locker {
    int used;
    int code;
} Locker;

A locker structure which maintains information regarding availability and pass code of the locker, allowing scaleability in the future for more lockers.

int read_code() {
    char bnum=0;
    int ans = 0;
    int len = 0;
    uLCD.printf("\nEnter code\n");
    while(len < 8) {
        if (blue.getc()=='!') {
            if (blue.getc()=='B') { //button data packet
                bnum = blue.getc(); //button number
                myled = bnum - '0';
                len++;
                if (len % 2 == 1) {
                    ans = ans * 10 + (bnum - '0');
                    uLCD.printf("%d", bnum - '0');
                }
            }
        }
    }
    fill();
    wait(1);
    return ans;
}

reads in and print back the 4 digit code the user enters, for both setting codes or unlocking the locker

void open_used() {    
    int locker = read_which_locker();
    wait_loop();
    
    if (locker == 1 && l1.used == 0) {
        uLCD.printf("\nThe locker is empty");
        wait(1);
        return;
    }
    
    if (locker == 2 && l2.used == 0) {
        uLCD.printf("\nThe locker is empty");
        wait(1);
        return;
    }
    int code = read_code();
    fill();    
    if (locker == 1 && l1.code == code) {
        uLCD.printf("\nLocker 1 is now open");
        mag1 = 1;
        int lock = 0;
        while(light1.read() > .05 || lock == 0) {
            lock = lock | button.read();
        }
        mag1 = 0;
        l1.used = 0;
    } else if (locker == 2 && l2.code == code) {
        uLCD.printf("\nLocker 2 is now open");
        mag2 = 1;
        int lock = 0;
        while(light2.read() > .01 || lock == 0) {
            lock = lock | button.read();
        }
        mag2 = 0;
        l2.used = 0;
    } else {
        uLCD.printf("\nInvlaid locker and code combination");
        led = 1;
        speaker = .5;
        wait(.5);
        led = 0;
        speaker = 0;
        wait(.5);
        led = 1;
        speaker = .5;
        wait(.5);
        led = 0;
        speaker = 0;
        wait(.5);
        
    }    
}

determines if the locker chosen is actually in use and whether the code enters is correct

void rent_unused(){
    if (l1.used == 0) {
        uLCD.printf("\nPlease place item in locker 1, create a code, and close the door");
        mag1 = 1;    
        int code = read_code();
        l1.code = code;
        l1.used = 1;
        mag1 = 0;
        
    } else if (l2.used == 0) {
        uLCD.printf("\nPlease place item in locker 2, create a code, and close the door");
        mag2 = 1;    
        int code = read_code();
        l2.code = code;
        l2.used = 1;
        mag2 = 0;
        
    } else {
        uLCD.printf("\nSorry all lockers are taken");
        wait(1);
    }
}

determine if lockers are avalaible and which to allocate for the user


Video Demonstration


Please log in to post comments.