Wi­Fi Connected Locker Access System

Problem Statement


Senior Design teams at Iowa State store their projects in the Senior Design lab in lockers
secured by padlocks. These locks are reused semester after semester and previous students
may remember their locker combination for the sake of tampering with current student’s
projects. Additionally, administrators have the maintenance overhead of manually assigning
lockers to students. This is unacceptable, as students spend hundreds of hours and hundreds
of dollars on their projects, and the senior design lockers must be as secure as possible.

Solution Statement


The solution, which is extensible, reliable, and affordable, reprises the current system to
utilize electronic lockers, complete with remote management. These lockers are battery
powered and access is provided using current student’s ISU ID cards. Groups may also be
assigned a username and password to access their lockers under the case that individual
students forget their ID card.
This solves the aforementioned issues by securing the lockers to the point where previous
students cannot access current lockers, and administrators can easily install or alter lockers,
saving both time and money.

System Level Design


System Requirements


Functional Requirements
● System shall read student’s ISU ID Card, providing access on a single swipe
● System shall have a keyboard failback, such that students without ID Cards may still
access the system
● System shall allow administrative functionality, both local and remote, including
altering access lists and overriding functionality
● Wireless transmitters should securely transmit data, ensuring only secure access to
lockers
● LCU (“Locker Control Unit”) shall be secure, in that only a valid signal from the MCU
(“Main Control Unit”) will open the lock
● The MCU must store usernames/passwords/groups of users, and be easy to remotely
manage to alter information
● The MCU must be “locked­down”, such that non­administrative users cannot alter or
access any information
Non­Functional Requirements
● LCU shall be battery­powered and last a minimum of two full semesters
● The LCU batteries should supply at least 4 volts of power until shutdown event
● The LCD display on the MCU shall display when locker batteries are below 20% and
are in need of replacement
● The LCU, low­power, red LED shall illuminate every 5 seconds when batteries are
below 10% power
● The servo should be able to hold open the lock for at least 10 seconds
● The locker shall re­lock 10 seconds after it has been unlocked.
● The LCU green LED shall illuminate when the locker has been unlocked.
● The MCU must connect to Iowa State public Wi­Fi, and must automatically connect
after a reboot
● The MCU must allow incoming SSH connections
● The MCU must reject foreign input
● The MCU must display a status report on valid administrative SSH login
● The MCU must be able to control lockers a maximum of the distance of the room
● The LCU shall have a physical key that will manually unlock the lockers for cases in
which batteries have died

Operating Environment


The current solution assumes a standard environment of a classroom or workplace, where
general secure access is assumed. Users would be able to safely store personal items in a
designated locker with an automated lock. This lock is controlled by the swipe of an id card.
The user would be able to either swipe their personal card or type their group
username/password into a designated keyboard. This control of access to the lockers is
determined by the credentials stored on the MCU located in the room. Additionally, it is
assumed that the lockers are stored in a stable operating environment in a
temperature­controller room. As general secure access is also assumed, no physical security
shall be implemented to the controlling units beyond a standard casing unit and lock.
Additionally, it is assumed that the environment is weather­controlled and is not be exposed to
the elements.
In more detail, the following environmental conditions are assumed:
● Temperature ranging from 65 degrees fahrenheit to 75 degrees fahrenheit
● Locker dimensions 4’ x 5.5’ x 17’’
● Room dimensions 44’ x 28’
● Several room obstacles, hindrances, and blockages of varying materials that obstruct
wireless signals


Intended Users and Uses


The intended users for this product are students enrolled into Senior Design for the
ECPE department at Iowa State University. Additionally users include management staff, who
will remote into the MCU (“Main Control Unit”) to manage the system by adding/removing user
accounts to lockers, and managing battery supply units.

The lockers themselves are “Bolt­Cutter safe”, in that they are designed around the
same difficulty as bringing a pair of bolt cutters into the room and cutting the doors off
manually. As such, the lockers are intended to be secure from most standard means of digital
cracking, and they shall also be physically safe from all but the persistent in physical damage

Block Diagrams of the Concept

Figure 1, Concept Block Diagram of Project

All components to the left of “WIRELESS” are considered parts of the LCU and all components to the right of
“WIRELESS” are considered parts of the MCU

Figure 2, Block Diagram of Project with interconnections

All components to the left of “WIRELESS” are considered parts of the LCU and all components to the right of
“WIRELESS” are considered parts of the MCU


Detailed Implementation


I/O Specification


The input and output shall be as follow:
Output:
● LCD display on the MCU (“Main Control Unit”) shall render username/password
information, and display success/fail on opening a locker
● LCD display on the MCU shall render, specifically, which LCU’s have critical battery
levels
● When the LCU receives a correct signal from the MCU, the corresponding locker
should unlock for 10 seconds and a green LED should illuminate during this time to
indicate that the locker can be opened
● When battery power is at 10% a red LED shall illuminate, every five seconds, on the
LCU to indicate that batteries are critically low and need to be replaced.
Input:
● Magnetic­strip card reader
○ Reads ISU ID Card, providing information on magnetic strip
● Full qwerty­style keyboard for username/password entry
● Remote­SSH management input

Circuit Specifications

Power Circuit and Design

The power sources for the LCU (“Locker Control Unit”) are batteries. The project will be using
four 1.5 volt ‘Energizer max AA’ batteries to power the ATMEGA328, servo, and Xbee units.
From the current draw calculation it was calculated the required milliamp hours needed to
keep the system running, as seen below. The results were then compared with three different
types of batteries: Energizer ultimate lithium, Energizer Max, and Energizer rechargeable. The
Energizer max provided the best cost/performance ratio with the minimum capacity, which is
why it was chosen to power the system.

The battery chosen has a 7 year shelf life at 21 degrees celsius. The typical weight is 23
grams, and typical volume is 8.1 cubic centimeters. It can operate at 0 degrees F to 130
degrees F. Below are the battery dimensions taken from the data sheet:

Atmega to Servo Circuit Specification

The I/O of the servo is controlled by the ATMEGA328. The servo is powered from the
batteries, through a transistor, to conserve power. When the ATMEGA receives the command
to move the servo, it sends a signal out pin 15, which is a PWM pin, on the ATMEGA328. The
ATMEGA is programmed to rotate the servo to the desired location depending on the width of
the pulse the ATMEGA sends out of pin 15. Furthermore, when the servo receives the
command to move, a 5V signal is sent out of pin 14 to switch on the transistor. When the
servo is not sent a signal to move, pin 14 is left floating and the 10k pull up resistor pulls the
NPN base voltage up to 6V, which turns the transistor off. This causes the servo to only be
powered when instructed to move, saving power.

Figure 3, Atmega to Servo Circuit Schematic

Atmega to Visual Output Specification


The visual output (Bi­LED) is controlled by pins 18 and 19 of the ATMEGA328. When the
ATMEGA receives the signal to illuminate the green LED it sends a signal out of pin 18.
Alternatively, when the ATMEGA receives the signal to illuminate the red LED it sends a
signal out pin 19

Figure 4, Atmega to Visual Output Circuit

Atmega to Xbee Circuit Specification

Figure 5, Atmega to Xbee pin layout

There are only two pins of ATMEGA328 connected to the two pins of the Xbee. The pins of
ATMEGA328 are PD0 (RXD) and PD1 (TXD) whereas the pins of the Xbee are ‘Dout’ and
‘Din’. The ATMEGA328 and Xbee are connected to the 5V (‘Pin’ VCC) and 3.3V (‘Pin’ VDD)
voltage supply respectively.

Pi to Xbee Circuit Specification

The Raspberry Pi and the Xbee unit are connected to each other with a single micro­usb
cable. The Raspberry Pi operating system then autodetects a new serial device, and registers
it to a default port (typically ‘/dev/ttyUSB0’, however USB1 and USB2 are also common). The
Raspberry Pi server is configured to accept only input on /dev/ttyUSB0. For this reason, the
Raspberry Pi must reboot if no valid port is detected.

Pi to Display Connection Specification

The Raspberry Pi and the LCD Display module connect using a series of cables linking the
Raspberry Pi HDMI port to the Display’s RCA port. The RCA display was chosen for the
cost/quality reasons.

Alternative displays may be hot­swapped as necessary, so long as they can be registered by
the Rasbian operating system and over the HDMI interface.

Xbee to Xbee Specification

Xbee modules are embedded solutions providing wireless endpoint connectivity to devices.
These modules use the IEEE 802.15.4 networking protocol for fast point­to­multipoint or
peer­to­peer networking.They are designed for high­throughput applications requiring low
latency and predictable communication timing. Xbee modules are ideal for low­power,
low­cost applications.
Xbee units can be used for wireless communication with low power consumption. It
communicates with well known UART interfaces and makes it easy to use. It is simple and
straightforward if you only use 2 Xbee units for communication. Xbee units can communicate
up to 300ft and operate on 3.3 volts @ 50 milliamps. The board contains 6 ten­bit ADC input
pins and 8 digital I/O pins. Xbee also allows for 128­bit encryption.

Figure 6/7, Xbee pin layout diagram

Xbee units consists of 20 pins. Eight digital I/O pins that allow the device to function with both
input or output, set by software. Of these digital pins six can function to give the ADC input.
One pin is designated for digital output only. Two pins, VCC and GND, provide power to the
device. One pin also allows for voltage reference; while the other eight pins allow the Xbee to
perform further functionality. Two pins allow for UART data in and UART data out. Two pins
can function to allow PWM output. Three pins are set to either control sleep or reset, one of
which allows for a sleep indicator. And the final pin is reserved.

Xbee Communication Protocol

Communication between the LCU and MCU is through the Xbee interface. No explicit Xbee encoding is used. The commands are as follow: (MCU sending, LCU receiving) open (LCU sending, MCU receiving) ackt batt Where is the lockerId of the designated locker, and is the battery level of the locker that wishes to update it’s recorded battery level in the database. All data sent is automatically encrypted by the Xbees.

USB Connection Specification

The keyboard and card reader are connected to the Pi using USB connection. The keyboard
used is a qwerty keyboard normally used for desktops and laptops. The keyboard gives input
of alphanumeric characters (ISU ID number and Password of the locker) to the Pi in order to
be processed and then to send the appropriate information to open the respective locker.

Hardware Specifications

Locking Unit Specification

Servo Motor

The motor being used to control the locking and unlocking of the lock is a sub micro servo ­
GWS NARO HP BB. This servo has the capability to interface with PWM compatible devices
and can hold any position from 0 to 180 degrees. The servo can apply 19.4 oz­in torque at

6VDC and can operate in the range of 4­6V. The servo also has a maximum current draw of
140+/­50mA at 6VDC and draws 15mA under static conditions.

Figure 8, Sub Micro Servo – GWS NARO HP BB

The I/O of the servo motor is connected to the ATMEGA328 via transistor. When the
ATMEGA sends a signal to move the position of the servo, the increase in voltage causes the
transistor to power the servo and move it to its desired location. When the servo does not
receive a signal from the ATMEGA, it stays at its current location and operates under static
current conditions. The servo is independently powered from the battery source in order to
avoid current spikes and unnecessary power draw.

Lock

The lock being used is a Master Lock (1714) that is commonly used in athletic locker room
lockers. The lock contains a 5­pin tumbler cylinder for supreme security and is key operated.
The lock is spring loaded with its resting position in the locked position. The lock is controlled
by the servo motor, which is connected to the lock via metal fasteners. When the servo
moves, it pulls the lock into the unlocked position and then moves the lock back into the
locked position once the unlocking time has expired. The spring loading capabilities of the
lock make it so the lock can be in the locked position when the locker is open, then when one
wants to close the locker, the lock is compressed to fit back in the locker and then expanded
once fully in the locker.

Figure 9, Master Lock

Bi­LED (160­1057­ND)

A bi­colored (red/green) LED is used to provide user feedback of the status of the locker. A
green light indicates that the locker has been unlocked. A red light indicates that the battery in
the locker needs to be replaced. The LED is 5mm and operates on a 5V power source from
the ATMEGA328.

Figure 10, Bi-LED

ATMEGA328 Microcontroller Specification

The ATMEGA328 is a microcontroller chip produced by Atmel. It is an 8­bit microcontroller
that has 32KB of flash memory, 1KB of EEPROM, and 2KB of internal SRAM. The
ATMEGA328 has 28 pins. It has 14 digital I/O pins, of which 6 can be used as PWM outputs
and 6 analog input pins. These I/O pins account for 20 of the pins.

Figure 11/12, Atmega Pin Diagram

These i/o pins can function as an input to the circuit or as output, set by software. 14 of the
pins are digital pins, of which 6 can function to give PWM output. Six of the pins are for analog
input/output. Two of the pins are for the crystal oscillator, providing a clock pulse for the
Atmega chip. A clock pulse is used to synchronize the communication between the
microcontroller and the device(s) it is connected to. Two of the pins, Vcc and GND, provide
power to the microcontroller. The ATMEGA328 is a low­power chip, so it only needs 1.8­5.5
volts to operate. The ADC has 3 pins set aside for it to function: AVCC, AREF, and GND.
AVCC is the power supply, positive voltage, that is for the ADC. GND is the power supply
ground. AREF is the reference voltage that the ADC uses to convert an analog signal to its
corresponding digital value. The last pin is the RESET pin.

Locker Control Unit ­ Bill of Materials

MCU Mount Specification


The MCU does not require any specialized mounting, as all of the external hardware
components are hot­swappable.
The Raspberry Pi is encased in a generic case, where the Xbee unit also sits inside for safety.
This case has sufficient airflow to provide sufficient cooling for day­to­day operation.


Pi Controller Specification


The Raspberry Pi model used is the Model 2B+, which comes with 1 GB of ram, 4 USB ports,
an ethernet port, HDMI video, and sufficient GPIO pins for any modern use. It is powered by a
900 Mhz ARM­CortexA7 CPU quad­core, which supplies more than enough processing power
for this application and any reasonable expansions upon it’s use.

Additionally, a 16 GB micro­sd card will be used to store relevant data and the operating
system itself.


Main Control Unit ­ Bill of Materials

Software Specifications


Atmega Microcontroller Software Specification
The ATMEGA328 is loaded with a bootloader that allows for the user to upload new code
without the use of an external hardware programmer. The user can load the ATMEGA328 on
an Arduino board and while using the open­source Arduino environment can easily write and
upload code on to the microprocessor. The Arduino environment runs on windows, Mac OSX,
and Linux. The environment is written in Java and based on processing, avr­gcc, and other
open source software.
The ATMEGA328 contains 32 KB On­chip In­System Reprogrammable Flash memory for
program storage. Since all AVR instructions are 32 bits wide, the Flash is organized as 16KB
x 16. For software security, the Flash Program memory space is divided into two sections: the
Boot Loader Section and the Application Program.

LCU Specifications


The LCU is controlled by the Atmega Microcontroller. This Microcontroller imports several
libraries and runs several functions for the LCU to function correctly.


Software Libraries

avr\Sleep.h


Use of the SLEEP instruction can allow an application to reduce its power consumption
considerably. AVR devices can be put into different sleep modes. This macro automatically
sets the sleep enable bit, goes to sleep, and clears the sleep enable bit.

avr\Power.h

Many AVRs contain Power Reduction Register or Registers that allow you to reduce power
consumption by disabling or enabling various on­board peripherals as needed. There are
many macros in this header file that provide an easy interface to enable or disable on­board
peripheral to reduce power.

Source: Wi­Fi Connected Locker Access System


About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top