Summary of Wireless Locker Control Unit with ATmega328 and Secure Authentication
This article details the system-level design of a secure Wireless Locker Control Unit for Iowa State University students. It outlines requirements for ID card and keyboard access, remote administration, and battery monitoring. The project utilizes an ATmega328 microcontroller for individual lockers and a Raspberry Pi as the central controller, connected via XBee modules for wireless communication. The design ensures secure data transmission, physical durability, and user-friendly interfaces through LCD displays and LED indicators.
Parts used in the Wireless Locker Control Unit:
- ATmega328 Microcontroller
- Raspberry Pi Model B
- XBee Module (XL-70)
- Parallax Standard Servo (#900-00005)
- Master Lock 1714
- Bi-color LED (160-1057-ND)
- 1.5V AA Batteries
- Magnetic-strip Card Reader
- QWERTY Keyboard
- LCD Display
- Transistor
- Converter Chip
- 16 GB Micro-SD Card
System Level Design
System Requirements
Delineates the core functionalities required for the project, which is to establish a secure and user-friendly locker access system. The fundamental purpose is to provide controlled access to lockers for students and robust management capabilities for administrators. Its applications include a Wireless Locker Control Unit.
- Reading student ISU ID cards for quick, single-swipe access.
- Offering a keyboard fallback for students without ID cards.
- Enabling comprehensive local and remote administrative functions, such as altering access lists and overriding operations.
- Ensuring the LCU is battery-powered with a two-semester minimum lifespan.
- Displaying low locker battery alerts on the MCU’s LCD.
- Guaranteeing secure wireless data transmission for locker access.
- Ensuring the LCU only opens with a valid MCU signal.
- Storing and easily managing user data on the MCU remotely.
- Controlling lockers across an entire room’s distance.
- Securing the MCU against unauthorized user alterations or access.
This project benefits users by offering multiple convenient access methods and ensuring the security and longevity of the locker units. Administrators benefit from streamlined, secure, and remote management tools, including critical battery status monitoring and robust data security, which collectively enhance operational efficiency and user safety.
Operating Environment
Defines the operational context of the locker system, meant for secure indoor environments like classrooms or workplaces. The system offers automated lockers accessed via ID card swipe or manual entry, with credentials managed by an in-room LCU. It assumes a stable indoor setting (64–84°F) with basic physical security, eliminating the need for extra casing. The locker measures 4′ x 5.5′ x 17”, and the system design must account for room obstacles that affect layout and signal strength.
Intended Users and Uses
Defines the primary users and security goals of the project. The locker system is mainly for ECPE Senior Design students at Iowa State University to store belongings, with secondary access for management staff to administer accounts and battery units. Lockers are designed to be “Bolt-Cutter safe,” ensuring strong physical protection. Combined with robust digital security, the system protects user belongings from unauthorized access.
Block Diagrams of the Concept
Detailed Implementation
I/O Specification
Details the specific mechanisms through which the locker system interacts with users and provides information. The basic purpose of the project’s input/output system is to facilitate user access and provide status updates. Its uses include:
Output:
-
Displaying username/password information and locker access success/failure on the MCU’s LCD.
-
Specifically indicating LCUs with critical battery levels on the MCU’s LCD.
-
The physical unlocking mechanism of the lockers.
Input:
-
A magnetic-strip card reader for ISU ID cards, extracting information from the magnetic strip.
-
A full QWERTY-style keyboard for manual username/password entry.
This input/output design benefits users by offering multiple convenient ways to access lockers (ID card or manual entry) and provides clear, immediate feedback on access attempts and system status, particularly regarding battery levels, which aids in maintenance and ensures continuous service.
Interface Specifications
Focuses on user-centric hardware design to ensure the locker system is intuitive and easy to use. The Wireless Locker Control Unit simplifies locker unlocking and features a typable keyboard with a large-font LCD. The interface uses two textboxes for entering a username and a password and provides clear indications of success or failure. These improvements have the potential to reduce user effort, speed up access, and improve access and user satisfaction overall.
Circuit Specifications
Power Circuit and Design
Specifies the power setup for the Wireless Locker Control Unit (LCU), a key part of the system’s functionality. Each LCU uses 1.5V AA batteries to power essential components like the ATmega328 microcontroller, servo motor, and Xbee module. This choice simplifies maintenance, supports wireless autonomy, and ensures reliable long-term operation of each locker unit.
Atmega to Servo Circuit Specification
Described are the control and power management for the wireless locker control unit (LCU) servo, where the ATmega328 microcontroller provides signals to the servos, and a transistor enables power delivery from the batteries to the servos from a battery perspective (for battery efficiency). This arrangement will save battery power, with the result being extended locker uptime in addition to making the locking / unlocking process possible in a battery-driven solution.

Atmega to Visual Output Specification
The Wireless Locker Control Unit uses an LED powered by AA batteries and controlled by the ATmega328 to show status signals. This gives users clear visual feedback for access success or errors.

Atmega to XBee Circuit Specification

Describes the wiring and power connection details needed for communication with the ATmega328 and XL-70 Xbee module in the Wireless Locker Control Unit. Serial data transmission is done via PD0 (RXD) going to the Xbee Dout and PD1 (TXD) going to the Xbee Din. The ATmega328 operates at 5V while the Xbee uses a 3.3V Vcc. This configuration not only ensures reliable wireless communication with the Main Control Unit but also allows for secure locker access and remote management.
Pi to XBee Circuit Specification
Describes the connection between the Raspberry Pi and the Xbee module to enable wireless communication between the Main Control Unit and each Wireless Locker Control Unit. A converter chip allows direct Xbee interfacing with Raspberry Pi data pins: pin 1 connects to Xbee’s DOUT, and pin 2 to DIN. The Pi also supplies power to the Xbee. This setup supports efficient wireless data exchange for secure remote locker access and management.
Pi to Display Connection Specification
Details the LCD setup for visual output from the Main Control Unit (MCU), powered by a Raspberry Pi. Video signals are transmitted via RCA cable, while the LCD receives power through a wall outlet converter. This setup ensures a clear, reliable display of access status and battery levels, enhancing the Wireless Locker Control Unit system’s usability.
XBee to XBee Specification
Presents an introduction to XBee wireless modules, highlighting their technical specifications and the most common setup difficulties. In general, these modules are used to establish reliable and secure wireless connections based on the IEEE 802.15.4 protocol. A good choice for applications needing low power, low-cost solutions, these modules support reliable, low-latency communication to multiple endpoints and peer-to-peer wireless connections.
XBee modules benefit the Wireless Locker Control Unit project by:
-
Enabling low-power wireless communication.
-
Utilizing the user-friendly UART interface.
-
Supporting communication up to 300ft.
-
Operating efficiently on 3.3V at 50mA.
-
Featuring 6 10-bit ADC input pins and 8 digital I/O pins, offering flexibility for various sensor inputs or controls.
-
Providing secure data transmission through 128-bit encryption.
Also highlights critical configuration problems encountered during setup:
-
XBees are not on the same network.
-
Discrepancies in encryption settings (one encrypted, one not, or different keys).
By becoming aware of these potential issues, the project can be enriched by addressing the common problems with wireless communication setup before discovering them, ensuring correct functionality and the safe transfer of data.

Delineates the XBee module’s flexible pin configuration capable of providing strong wireless communication. ADC-capable I/O pins support use with various analog sensors (ex., temperature or light sensors). UART pins allow for serial data transfer with other microcontrollers or PCs. PWM pins allow for controlling variable-output devices (like LEDs or motors). This makes the XBee module a flexible, hub-like platform in wireless IoT and embedded systems.
USB Connection Specification
Outlines the input system, highlighting the keyboard and card reader. The QWERTY keyboard allows users to manually enter their ISU ID and password for locker access. Though the card reader is USB-connected to the Raspberry Pi, its role isn’t deeply detailed. This familiar setup enables secure, user-friendly data input for authentication.
Hardware Specifications
Locking Unit Specification
Servo Motor
Describes the Parallax Standard Servo (#900-00005) used to control the locker’s lock. It operates on 4–6V and uses PWM for precise 0–180° positioning, essential for engaging/disengaging the mechanism. With 38 oz-in torque at 6VDC, it provides enough force for secure operation. Its specs support reliable, efficient locking, making it ideal for this application.

Explains the control and power strategy for the servo motor. The ATmega328 controls the servo via a transistor, which switches power from an independent battery. This prevents current spikes from affecting the microcontroller, ensuring smooth and reliable servo movement for locking and unlocking. The setup improves overall system stability and safety.
Lock
The device includes a lock system that can be linked with the servo motor for use in automating lock operations. The Master Lock 1714 is a key-operated 5-pin tumbler unit that will default to locked. The lock uses a spring-loaded mechanism to remain locked. The lock actuator, or servo, pulls the lock to unlock it using metal fasteners. The servo then actuates to release the lock after a defined time, so that it can spring back to the locked position. This system has the capability for secure, hands-free locking and unlocking for better user convenience and safety.

LED (160-1057-ND)
Describes the mechanism of a bi-color LED for giving user feedback in the locker system. A green light indicates successful unlocking, while a red light indicates low battery status. The ATMEGA328 (5mm, 5V) drives the LED, providing immediate visual feedback, improving user experience, and informing users when critical maintenance is needed.

MCU Mount Specification
Describes the housing and mounting design for the MCU, where the housing protects components from damage and the mounting secures the MCU to the locker and provides a 60-degree angle for the keyboard. This design will provide durability and ergonomics, which improve comfort for the user and usability of the system.
Pi Controller Specification
Describes the processing and storage components in use in the system. The central processing unit is a Raspberry Pi Model B, with 512 MB RAM, many I/O ports, which provides our computation needs, as well as the ability to expand in the future. Data storage will be on a 16 GB micro-SD card. The Raspberry Pi will connect using a USB splitter to support multiple important peripherals that are always connected, including the keyboard, XBee, and card reader. Our processing, data storage, and new peripherals will give us reliable computation, processing, and expandability.
Atmega Microcontroller Specification
This outlines specifications for the ATmega328 microcontroller, which is the primary control unit in the system. The microcontroller has flash memory of 32KB, EEPROM of 1KB, SRAM of 2KB, and is organized with 28 pins—14 of which are digital I/O pins (6 of which support PWM)—and 6 of which are analog input. This allows the microcontroller to control components (servo motor) and sensors. The performance and memory features make it suitable for reliable and efficient control of the operation of the locker system.
Details the ATmega328’s pin functions and power scheme, featuring 20 configurable I/O pins (14 digital, 6 PWM, 6 analog), crystal oscillator pins for timing, and low power use (1.8–5.5V). ADC pins enable accurate sensor readings, and a RESET pin allows restarts. This setup ensures efficient control and communication for the Wireless Locker Control Unit, supporting reliable locker management and enhanced system security in the Wireless Locker Control Unit project.
Software Specifications
Atmega Microcontroller Software Specification
Outlines the ATmega328’s programming ease and memory structure, key to the Wireless Locker Control Unit. It’s built-in bootloader allows code uploads without external hardware, using the Arduino board and open-source environment on Windows, Mac, or Linux. It includes 32KB of In-System Reprogrammable Flash memory, organized as 16K x 16 for 32-bit AVR instructions. The Flash is divided into Boot Loader and Application sections, ensuring secure and structured code storage, preventing accidental overwrites, and improving system reliability.
Pi Controller Software Specification
Simulations and Modeling
Implementation
The core purpose of this initial simulation phase is to test the fundamental hardware components and their intercommunication. It verifies the servo motor’s precise control for smooth and accurate locking/unlocking, checks basic LED indicator functionality, and confirms reliable wireless communication between the Raspberry Pi and ATmega328 for student ID-based locker access (via magnetic strip or keyboard input). The simulation also ensures the LCD accurately displays user and battery status. These tests establish the foundational reliability and responsiveness of the system’s electromechanical and display elements.
Issues/Challenges
This section outlines key simulation issues: unstable servo behavior, battery selection, and power regulation. Ensuring reliable locking, long battery life, and stable voltage for the Xbee and ATmega328 is essential for system reliability and performance.
Testing Procedures and Specifications
Electrical Component Testing/Procedures/Specifications
A phased testing approach verifies the ATmega, Xbee, and servo on a breadboard before PCB integration. This ensures correct voltage supply, reliable performance, and easy troubleshooting. Xbee is tested for stable wireless data transfer. The process reduces errors and supports a dependable final system.
Hardware Components Testing/Procedures/Specifications
Hardware tests verify that the servo and LEDs function precisely as intended. The ATmega sends control signals to check the servo’s accurate angular movement for locking, and verifies LED color responses (red, green, or off). These checks ensure reliable visual feedback and mechanical performance for consistent locker operation.
Software Components Testing/Procedures/Specifications
Emphasis on thorough software testing to ensure system security and secure data transfer. The testing process is meant to guarantee unauthorized access is prevented and protect against outside threats. The testing process validates the encrypted communications to minimize data interception or alteration. This provides user assurance that their information, including locker access and personal details, is well safeguarded.
Additional Information
Atmega328 Datasheet
This section gives a brief technical description of the ATmega microcontroller and XBee RF module and their important roles in our project design.
ATmega Microcontroller: The ATmega48PA/88PA/168PA/328P is a low-power, 8-bit AVR microcontroller which uses an enhanced RISC architecture. An instruction that can execute in one clock cycle may achieve as much as 1 MIPS per MHz. Therefore, energy is well managed by the system and can be efficient if one considers battery-powered applications like this project in which they are used.
XBee RF Module: The XBee module has various supported network topologies (of which ZigBee and Mesh are examples) and utilizes either 2.4 GHz or 900 MHz. It has a standard footprint, which allows toggling modules from one model to the other as the needs of the application change at no additional cost. This flexibility of development reduces overall integration risks while providing scalable wireless connections for the overall system.
Read more: Wireless Locker Control Unit with ATmega328 and Secure Authentication
- How does the system allow access without an ID card?
The system offers a keyboard fallback for manual username and password entry. - What power source is used for the Wireless Locker Control Unit?
Each LCU uses 1.5V AA batteries to power its components. - Does the system ensure secure wireless data transmission?
Yes, the XBee modules provide secure data transmission through 128-bit encryption. - What indicates low battery status on the unit?
A red light on the bi-color LED indicates low battery status. - Can the system control lockers across an entire room?
Yes, the design allows for controlling lockers across an entire room's distance. - What operating system runs on the main controller?
The Raspberry Pi uses the Raspbian OS for software functionality. - How is the servo motor powered to prevent current spikes?
A transistor enables power delivery from the batteries to the servos independently. - What protocol do the XBee modules use for communication?
The modules establish connections based on the IEEE 802.15.4 protocol. - What is the minimum lifespan required for the locker battery?
The LCU must be battery-powered with a two-semester minimum lifespan.
