Hi There,

This is Tahir Ul Haq, bringing you another exciting and innovative Tiva Micro-controller based project. This is the third instructables in the Series. Hope you will like it.

This time it is Bar-code Based Complete Security and Enrollment System.

The project focuses on a bar-code based security and enrollment system. In this project, a Bluetooth Module, an LCD screen, an IR sensor and an Android application are interfaced with the micro-controller to achieve the desired purpose. An LCD screen is used to display a ‘Welcome’ message which is changed to ‘Swipe Card’ as soon as the IR sensor detects the presence of the user. The user then swipes his/her card. In case the user is already enrolled in the system, an LED is switched on and the Servo Motor starts running which opens the door. In the opposite scenario, an error message is displayed and a buzzer is sounded. The user is given the option to get themselves enrolled in the system in the presence of an Administrator by first swiping the master card and then enrolling a bar-code not already enrolled.

The idea behind the project was to security systems easier for the authorized personals by relieving them from entering any password.

Step 1: Design and Requirements:

The design is very simple and is discussed below:


A wooden prototype for the door was built, and all the hardware components were fitted inside the wooden door to present a real life picture of the working of the project. A sliding gate was placed at the front and a mechanical system was designed to slide it open and close using a servo motor. The roof of the box presents the LCD and the buzzer. The IR sensor was fixed in the front to detect the presence of a person.


The basic requirement of the project was to use Tiva TM4C123H6PM as the microcontroller. The Tiva Launchpad has a number of built in pins, which can be used as GPIO pins or as alternate functionality pins, in which case, various output peripheral devices can be interfaced with the microcontroller. In the alternate functionality selection, the pins were configured for the UART and Timer modules in order to operate the LCD Screen, Bluetooth Module and the IR sensor, as well as the Servo Motor. All of these hardware components were operated separately and then interfaced with the microcontroller to achieve a fully functional project.

Step 2: Hardware and Components:

Following is the list of components you will need for this project:

 Wooden Box with a Sliding Gate

 Tiva Launchpad (TM4C123)

 Bluetooth Module (H6-06)

 Servo Motor

 16 × 2 LCD Display

 Infrared Sensor Module

 Buzzer

A. Tiva Launchpad:
The Tiva Launchpad (TM4C123GH6PM) was used as the microcontroller in the project. The microcontroller has a 64 pin package. Out of these 64 pins, 43 pins are available for the purpose of GPIO pins. These GPIO pins are grouped into six ports labelled Port A to Port F. Port A to D are 8 pin ports, while port E is 6 pin and Port F is 5 pin. Each of the pins on these ports can be configured as GPIO. Some of the port pins also have special peripheral functionalities multiplexed along with GPIO functionality and can be configured for that purpose as well. For the sake of alternate functionality, some of these GPIO pins can be configured as timers, UART, CAN, SPI,?2? etc.

B. Bluetooth module:
The Bluetooth module is a data transmitting module which transmits data through Bluetooth. It’s actually a Bluetooth to Serial interface. It has 4 pins VCC, GND, Rx and Tx. The Rx is connected to the Tx of the Tiva Launchpad and the Tx is connected to the Rx of the Launchpad to enable full duplex communication between the module and the Tiva board

C. Servo Motor:
A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors. Servo motors are used in applications such as robotics, CNC machinery or automated manufacturing.

D. 16 × 2 LCD Display:
A liquid-crystal display (LCD) is a flat-panel display or other electronically modulated optical device that uses the light-modulating properties of liquid crystals. Small LCD screens are common in portable consumer devices such as digital cameras, watches, calculators, and mobile telephones, including smartphones. LCD screens are available in a wider range of screen sizes than CRT and plasma displays, with LCD screens available in sizes ranging from tiny digital watches to huge, big-screen television sets. 16×2 LCD is named so because it has 16 Columns and 2 Rows

E. Infrared Sensor Module:
IR Sensors work by using a specific light sensor to detect a select light wavelength in the Infra-Red (IR) spectrum. By using an LED which produces light at the same wavelength as what the sensor is looking for, you can look at the intensity of the received light. When an object is close to the sensor, the light from the LED bounces off the object and into the light sensor. This results in a large jump in the intensity, which we already know can be detected using a threshold.

F. Buzzer:
A buzzer or beeper is an audio signaling device, which may be mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers, and confirmation of user input such as a mouse click or keystroke.

Step 3: Flowchart and Explanation:

A barcode is sent by the Android Application to the Tiva Launchpad via the Bluetooth Module, in the form of corresponding strings. The Tiva board is connected in turn to the servomotor which opens the door on barcode match. An IR sensor is also connected to the Tiva Launchpad and is used for person detection. The Port B of the Tiva is configured for the basic timer module, T0 to T3, which is operated in the PWM mode and is responsible for controlling the angle of rotation by varying the duty cycle.

The Port C is configured for UART Rx and Tx in order to receive the strings corresponding to barcode via the Bluetooth Module. Port F is configured for GPIO to interface the LCD, Buzzer and IR Sensor.
When a person approaches the door, the LCD displays “Scan Card” at a meter distance. When the person scans his card through his android phone, the strings are matched in the database built in Tiva. If the barcode does not match, the LCD displays “Wrong password, Sorry” and the buzzer buzzes. But if the barcode matches, the person is welcomed by the LCD Display and the servomotor opens the door for him. An administrator card was also designed which can enroll barcodes in the database. When an administrator card is scanned, the LCD asks for the barcode to be enrolled. Then the barcode to be enrolled is scanned and becomes a part of the family

Step 4: Code and Project Video:

The project code has been coded in Keil Microvision 4 which can easily be downloaded from the website of Keil 4.

To know the details of various registers and codes of lines used you can refer to http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf

For the Project video here is the link.


Step 5: Thanks:

Special thanks to the Project group members for sharing the details.

Abdullah Tariq Sipra , Junaid Rafique , Hamza Saeed and Muhammad Abdullah

UET Lahore Pakistan



Take care till i am back with some more cool projects :)


Tahir Ul Haq(UET Lahore)

About This Instructable




Bio: Electrical Engineering student from University of Engineering and Technology Lahore. Science enthusiast, aspirant to contribute to the world of science by publishing projects related to ... More »
More by tahirulhaq:Weather Monitoring System Using TIVA Barcode Based Complete Security and Enrollment System Using Tiva BT Based Voice\ Remote Controlled Car Using TIVA MC 
Add instructable to: