The document describes an ARM-based 4-bit coded locker system with an electric shield. The system uses an ARM7 microcontroller and has controlling and locking units. The controlling unit includes an LCD, keyboard, and audio output. It checks entered codes against a stored code and controls the locking unit. The locking unit has a geared motor, relay circuit, and shock circuit to open/close the locker drawer and provide electric protection when incorrect codes are entered.
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Â
ARM BASED 4bit coded locker
1. ARM BASED 4 – BIT CODED LOCKER WITH ELECTRIC SHIELD
A project report submitted in partial fulfilment of the requirements for
the award of the degree of
BACHELOR OF TECHNOLOGY
In
ELECTRONICS & COMMUNICATION ENGINEERING
By
B.V.S.ALEKHYA 10521A04A1
SHUBHAM KUMAR 10521A0487
D.V.Y.V.SUBBA RAO 11525A0403
ROHIT SOURABH 10521A0484
V.BHANU CHAITANYA 10521A04A4
Under the guidance of
Asst. Prof.
Depatment of Electronics & Communication Engineering
VITAM College of Engineering
(Affiliated to JNTU, Kakinada, A.P)
Visakhapatnam – 531173
2010 - 2014
2. VISWANADHA INSTITUTE OF TECHNOLOGYAND MANAGEMENT
(Affiliated to JNTU-Kakinada)
MINDIVANIPALEM, VISAKHAPATNAM - 531173
BONAFIDE CERTIFICATE
This is to certify that this project work entitled: “ARM BASED 4-BIT CODED LOCKER
WITH ELECTRIC SHIELD” is the bonafide work of B.V.S.ALEKHYA (10521A04A1),
SHUBHAM KUMAR(10521A0487), D.V.Y.V.SUBBA RAO (11525A0403), ROHIT
SOURABH(10521A0484) and V.BHANU CHAITANYA (10521A04A4) of final year B.Tech.
ECE which they have submitted in partial fulfilment of the requirements for the award of
Bachelor of Technology in ELECTRONICS AND COMMUNICATION ENGINEERING
during the academic period of 2013-2014.
PROJECT GUIDE HEAD OF THE DEPARTMENT
A.V.N.CHANDRA SEKHAR
Assistant professor Associative professor B.E, M.Tech.,(Ph.D )
INTERNAL EXMINER EXTERNAL EXAMINER
3. DECLARATION
I declare that this project entitled “ARM BASED 4-BIT CODED LOCKER
WITH ELECTRIC SHIELD” has been carried out by me and contents have been
presented in the form of dissertation in partial fulfilment of the requirements for the award of the
degree of Bachelor of Technology in ELECTRONICS AND COMMUNICATION
ENGINEERING.
Submitted By
B.V.S. ALEKHYA (10521A04A1)
SHUBHAM KUMAR (10521A0487)
D.V.Y.V. SUBBA RAO (11525A0403)
ROHIT SOURABH (10521A0484)
V. BHANU CHAITANYA (10521A04A4)
4. ACKNOWLEDGEMENT
We express our deep sense of gratitude to Smt. K. RAJA RAJESWARI madam, B.E,
M.E., Ph.D., Principal of VISWANADHA INSTITUTE OF TECHNOLOGY AND
MANAGEMENT, Visakhapatnam for permitting us to carry out this project work.
It is a pleasure to thank Sri. A.V.N.Chandra Shekhar, HOD, Associative Professor,
Viswanadha Institute of Technology and Management for permitting us to carry out this project
work and for guiding us throughout this endeavour and also helping us to take crucial decisions
at various stages.
We express our sincere thanks to Sri ravi , Assistant professor, VITAM
College, for his intelligent advices and his perpetual encouragement.
We pay homage to our parents, for the financial support and also for the moral support
they have given us throughout this project.
Finally, we are thankful to all the teaching and non – teaching staff of Department of ECE
for their constant co-operation throughout the project.
B.V.S. ALEKHYA (10521A04A1)
SHUBHAM KUMAR (10521A0487)
D.V.Y.V. SUBBA RAO (11525A0403)
ROHIT SOURABH (10521A0484)
V. BHANU CHAITANYA (10521A04A4)
7. CHAPTER-1
INTRODUCTION
The aim of this project is to provide effective security measures for the users. Here the
users can open their respective lockers by the specified user id and password. The main
disadvantage of bulky, mechanical systems is their cost. This disadvantage of conventional
lockers can be overcome by using electronic locker with electric shield. This locker is mainly
designed for use in banks where the requirement of security for customer’s valuables is
prominent.
If the user wants to access their locker, they should enter the valid 4 digit alphanumeric
code. If the entered code matches the actual code, the lock opens resulting in the slow opening of
the drawer. If the entered password is wrong, buzzer buzzes alerting the user for retyping the
password.If the user is not able to type the correct password in their 3rd
attempt,then an Audio
Signal will be generated which can be obtained on a speaker.This audio signal will last for
around 15 seconds , thus alerting the security personnel at a distance.The Locker will remain
inactive for 30 more seconds after the Audio Signal stops, thus adding a high level of security in
the whole system. After this period, the user can again try to enter their password, and the whole
process repeats.If the burglar goes a step forward in breaking the locker then he will be subjected
to shock.
The basic units for this locker are:
1. Controlling unit
2. Locking unit
Controlling unit:
The controlling unit of the locker system plays the most important role in the operation of the
locker system. It is heart and brain of the system. The control unit consists of ARM processor,
crystal oscillator circuit, LCD display, PS2 connector and Audio Output Jack. All these
components are available on a single board, “Blue Board-LPC2148”.
Blue board:
BlueBoard-LPC214X is an evaluation board for LPC2148 ARM7TMDI(-S) based
microcontroller. The LPC2148 microcontroller has 512KB of internal flash and
32+8K RAM. Following are the salient features of the board:
8. Power:
On-board linear regulators generate +3.3V/500mA and +5v/500mA from power
supply.
USB connector ( as alternate power source).
Connectors:
Extension headers for all microcontroller pins.
RS232 (2 ports),VGA ,PS/2,Audio Jack,JTAG,
SD/MMC,USB B-type with Link-LED,
All peripheral configurable via jumpers.
Other Peripherals:
Audio power amplifier.
2 line X 16 character LCD with back light control(using 10K POT).
Configurable for manual and automatic program download(ISP) via serial port.
8 controllable LEDs on SPI using 74HC595,Buzzer,10K POT connected to ADC line
1 user input button connected to interrupt line.
The LPC2141/2/4/6/8 microcontrollers are based on a 32/16 bit ARM7TDMI-S CPU with
real-time emulation and embedded trace support, that combines the microcontroller with
embedded high speed flash memory ranging from 32 kB to 512 kB. A 128-bit wide
memory interface and a unique accelerator architecture enable 32-bit code execution at
the maximum clock rate. For critical code size applications, the alternative 16-bit Thumb
mode reduces code by more than 30 % with minimal performance penalty.
10. Microcontroller NXP LPC 2148 Pin diagram:
The complete IC Layout with other peripherals involved in the project:
11.
12.
13. ARM7TDMI(-S) Registers Involved in the Project:
DACR
-(Digital-Analog Conversion)
IODIR
-(Data Direction Register for various Pins)
IOSET
-(Register to set Pin HIGH)
IOCLR
-(Register to set Pin LOW)
IOPIN
-(Register to check the status of the Pin)
PINSEL
-(To define the function of a Pin for a relevant task)
14. EXTMODE
-(The External Interrupt Mode Register controls whether each pin is edge- or level sensitive)
EXTPOLAR
-(The External Interrupt Polarity Register controls which level or edge on each pin will cause an
Interrupt)
EXTINT
-(The External Interrupt Flag Register contains interrupt flags for EINT0, EINT1, EINT2 and EINT3)
VICIntSelect
-(Interrupt Select Register. This register classifies each of the 32 interrupt requests as contributing to FIQ
or IRQ)
VICVectAddr
-(Vector Address Register. When an IRQ interrupt occurs, the IRQ service routine can read this register
and jump to the value read)
VICVectCntl
-(vectorControl Registers 0-15 each control one of the 16 vectoredIRQ slots. Slot 0 has the highest priority
and slot 15 the lowest)
Pins Involved:
There are 48 GPIO (General Purpose Input Output) Pins available in this microcontroller.
There are 2 ports in ARM7TDMI(-S) core viz., Port 0 and Port 1.
There are 32 GPIO pins in Port 0 from P0.0 to P0.31 and 16 pins in Port 1 from P1.16 to P1.31.
These pins can be used for various input and output functions like Keyboard interfacing, LCD interfacing,
Buzzer Connectivity, LED Connectivity, driving Relay, etc.
Due to the availability of large number of pins, various Lockers can be connected to a single Blueboard
NXP LPC 2148 microcontroller module like this.
15. Locking unit:
Locking unit of the locker controls the closing and opening of the drawer. The locking unit
consists of a geared motor, relay circuit, and shock circuit (whose terminals are further connected
to an LED circuit which indicates the safety of usage for the locker).
The geared motor is used in locking system to push the drawer open at the mention of valid
password and it also pulls the drawer inward to lock state also after the mention of correct
password. The geared motor gets the supply from the supply circuit connected against it.
The relay circuit is used as a switch between shock mode and open/close mode of locker. The
relay circuit is driven from one of the GPIO pins of the microcontroller. The relay used in this
case also has SPDT switch which ensures the opening and closing of drawer.
The shock circuit is also connected to relay and it is placed inside the walls of the drawer and it
is insulated. The shock circuit’s main purpose is to subject anyone,who tries to break into the
locker without giving the valid password, to shock. The shock circuit typically can subject a man
to a shock of 230volts. However, due to the potential damage it causes, we have used only 12
volts shock.
Operation Of the Microcontroller Module:
Peripherals Needed:
•An External QWERTY Keyboard attached to the PS2 port of the microcontroller
•A 2X 16 character LCD pre-attached with the BlueBoard
•A speaker connected to the Audio Jack of the BlueBoard
16. Operation:
There is a pre-stored 4-bit alphanumeric password in the ROM of the
microcontroller. This password is used to open/close the Lock in this project. When
the user enters a password using the Keyboard attached to the Blueboard, then the
logic built in the Embedded C program checks it with the pre-stored password.
If both the passwords match, then the LCD displays the “ Correct Password”
message and after 2 seconds instructs the user to toggle up/down the Red Switch
connected to the relay by displaying a message “Toggle Red Switch”. The Up
toggling ensures the Locker comes out and the Down toggling ensures that it goes
in. After toggling the Red Switch ,the Pin 0.8 gives a HIGH voltage of 3.3 V for
the next 50 seconds. The Locker requires this much amount of time for
opening/closing. After 50 seconds, the LCD displays the message as “Operation
Over”.The user needs to do the same set of actions for the reverse operation also.
If the password entered by the user is wrong, then the LCD will display the
message as “Password Wrong, Try Again” by alarming with a buzzer attached to
the Blueboard and gives the user 2 more chances of entering the correct password.
If the user still fails to type the correct password in their 3rd
attempt,then the LCD
displays the message as “Security Alarm” and the microcontroller will send a
Security alarm signal by generating an audio signal for 15 seconds which will be
played on the speaker. This audio signal will be of very high volume and can be
heard from a very long distance, thus enabling the Security Personnel to take some
actions and check the Locker for security measures. After the security alarm, the
LCD displays the message as “Maximum Attempts Made, Try after 30 seconds”
and the Buzzer sounds repeatedly for the next 30 seconds and the Microcontroller
deactivates the Keyboard Peripheral for this much amount of time. After 30
seconds the Keyboard console gets reactivated, the user can try to enter the
Password again, and the whole process goes on like this.
Visual Outputs:
25. RELAY CIRCUIT:
A relay is an electrically operated switch. Current flowing through the coil of the relay
creates a magnetic field which attracts a lever and changes the switch contacts. The coil current
can be on or off so relays have two switch positions and they are double throw (changeover)
switches.
There are 5 Pins in a relay. Two pins A and B are two ends of a coil that are kept inside the relay.
The coil is wound on a small rod that gets magnetized whenever current passes through it.
COM/POLE is always connected to NC(Normally connected) pin. As current is passed through
the coil A, B, the pole gets connected to NO(Normally Open) pin of the relay.
Electronic lock:
26. The electronic lock is made by using a geared motor.We have used the actuator technology for
improvising the locking system and designed a special structure. As per the correct password, the
locking system will work. If the correct password is entered the drawer will get automatically
opened. In case of wrong password, it will give 2 more chances.If the user is not able to type the
correct password in the next 2 chances,then an alarming audio signal will be generated which
lasts for 15 seconds and the system will be deactivated for the next 30 seconds after the
completion of the Alarm Audio signal . After this time is elapsed, the whole process begins
again.
27. Geared motor:
Geared motors are complete motive force systems consisting of an electric motor and a reduction
gear train integrated into one easy-to-mount and –configure package. This greatly reduces the
complexity and cost of designing and constructing power tools, machines and appliances calling
for high torque at relatively low shaft speed or RPM. The gear assembly helps in increasing the
torque and reducing the speed. Using the correct combination of gears in a gear motor, its speed
28. can be reduced to any desirable figure. This concept where gears reduce the speed of the vehicle
but increase its torque is known as gear reduction.
Operation principle:
Most synchronous AC electric motors have output ranges of from 1,200 to 3,600 revolutions per
minute. They also have both normal speed and stall-speed torque specifications. The reduction
gear trains used in gear motors are designed to reduce the output speed while increasing the
torque. The increase in torque is inversely proportional to the reduction in speed. Reduction
gearing allows small electric motors to move large driven loads, although more slowly than
larger electric motors. Reduction gears consist of a small gear driving a larger gear. There may be
several sets of these reduction gear sets in a reduction gear box.
Applications of gear motors:
Garage door openers, stair lifts, timer cycle knobs on washing machines, power drills,
electromechanical clocks. These all use various integrations of gear motors to drive a large force
from a relatively small electric motor at a manageable speed. In industry, gear motor
applications in jacks, cranes, lifts, clamping, robotics, conveyance and mixing are too numerous
to count.
Dpdt switch:
we used this dpdt switch for opening and closing of the locker, if we want the drawer to come
out it should be toggled to upwards for going inside it should be toggled downwards. The
29. internal connections will be shown as given below:
The model view of dpdt toggle switch
Electric shield:
The most exciting feature that which we are adding in this locking system is
electric shield which protects the valuables in the locker, the electric field will be passed in the
conductor which is placed inside the walls of the drawer, this will be on all the time but during
the correct password is given the shock will goes off and drawer gets opened automatically, the
danger light indication will be shown by using LED light indication circuit which is in red color.
30. Power supply:
The total system works under 12v dc supply so we have attained the subsequent voltage by using
following circuit
Circuit:
Components required: Quantity
ď‚· Transformer(230 to12)v step down 1
ď‚· Bridge rectifier 1A 1
ď‚· IC1 7812 1
ď‚· IC2 7805 1
ď‚· Resistor 4.7k 1
ď‚· Capacitor0.1uf 3
ď‚· Electrolyte capacitor2200uf 1
ď‚· Electrolyte capacitor10uf 1
ď‚· LED 1
31. ď‚· Buzzer 1
ď‚· Speaker 1
Softwares Required:
1. Keil uVision 4.6 IDE (For writing and compiling the program in Embedded C)
2. Flash Magic (For flashing the microcontroller with Bootloader)
Programs in Embedded C:
(main.c)
#include "lcd.h"
#include "ps2kbd.h"
#include <lpc21xx.h>
int main (void)
{
init_lcd();
init_keyboard();
while (1)
{
if(keyhit())
{
init3_lcd();
init_keyboard();
}
}
}
46. (Keyboard.c)
//This Program is for connecting the PS2 Keyboard and contains logic for the operation of work to be
done when the password is right/wrong
#include "ps2kbd.h"
#include "lpc_vic.h"
#include "scancodes.h"
#include <LPC214x.H> /* LPC214x definitions */
#include "utils.h"
/**
*****************************************************************************
Function Name : extISR1()
******************************************************************************
*/
void extISR0(void) __irq;
U8 keyBuf[KBUFFSIZE]; //KBUFFSIZE=4.....PS2 Keyboard buffer, the register to store
characters key in
U8 keyIn; //Index into PS/2 key buf where next scan code will be inserted
U8 keyOut; //Index into PS/2 key buf where next scan code will be removed
U8 keyRead; //Number of keys read from the PS/2 keyboard
U8 bitcount; // 0 = neg. 1 = pos.
unsigned char key[11];
/**
*****************************************************************************
Function Name : init_keyboard()
48. /**
*****************************************************************************
Function Name : decode()
******************************************************************************
*/
void decode(U8 sc)
{
static unsigned char is_up=0, shift = 0; //, mode = 0;
unsigned char i;
if (!is_up) /* Last data received was the up-key identifier */
{
switch (sc)
{
case BREAKCHAR : /* The up-key identifier */
is_up = 1;
break;
case NONUMCODE :
break;
case LEFTSHIFT :
shift = 1;
break;
case RIGHTSHIFT:
shift = 1;
break;
default:
if (!shift) /* If shift not pressed */
49. {
// do a table look-up
for (i = 0; unshifted[i][0]!=sc && unshifted[i][0]; i++);
if (unshifted[i][0] == sc)
{
putkeybuf((unshifted[i][1]));
}
}
else
{
/* look-up */
for (i = 0; shifted[i][0]!=sc && shifted[i][0]; i++);
if (shifted[i][0] == sc)
{
putkeybuf((shifted[i][1]));
}
}
break;
}
}
else
{
is_up = 0;
switch (sc)
{
case LEFTSHIFT :
case RIGHTSHIFT:
shift = 0;
50. break;
}
}
}
/**
*****************************************************************************
Function Name : putkeybuf()
******************************************************************************
*/
void putkeybuf (U8 key)
{
if (keyRead <8) //KBUFFSIZE=4..make sure that we don't overflow the buffer
{
keyRead++; //Increment the number of keys read
keyBuf[keyIn++] = key; //Store the scan code into the buffer
if (keyIn >=8) //KBUFFSIZE..Adjust index to the next scan code to put
in buffer
{
keyIn = 0;
}
}
if(keyBuf[0]=='a' && keyBuf[1]=='b' && keyBuf[2]=='1' && keyBuf[3]=='2')
{
init2_lcd();
init4_lcd();
}
}
51. /*
*****************************************************************************
Function Name : keyhit()
******************************************************************************
*/
U8 keyhit(void)
{
unsigned char hit;
hit = (unsigned char)(keyRead >4)? 1 : 0;
return(hit);
}
/**
*****************************************************************************
Function Name : xgetkey()
******************************************************************************
*/
char xgetkey(void)
{
unsigned char key=0;
if (keyRead > 0)
{
keyRead--; /* Decrement the number of keys in the buffer */
key = keyBuf[keyOut]; /* Get scan code from the buffer */
keyOut++;
53. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#include <LPC214x.H> /* LPC214x definitions */
#include "type.h"
#include "string.h"
typedef void (*IAP)(unsigned int [],unsigned int[]);
//----------------------------------------------------------------------------
void * s_memset(void * dst, int ch, int length)
{
register char *ptr = (char *)dst - 1;
while(length--)
*++ptr = ch;
return dst;
}
//----------------------------------------------------------------------------
void * s_memcpy(void * s1, const void *s2, int n)
56. break;
}
}
return retval;
}
int divide(int a, int b)
{
int result = 0;
int temp = b;
while (temp >= b)
{
temp = a - b * result++;
}
return result-1;
}
void reverse(char s[])
{
int c, i, j;
for (i = 0, j = strlen(s)-1; i<j; i++, j--) {
c = s[i];
57. s[i] = s[j];
s[j] = c;
}
}
void u_itoa( int n, char s[] )
{
int i, sign;
if(( sign = n ) < 0 )
n = -n;
i = 0;
do
{
s[i++] = n % 10 + '0';
} while(( n /= 10 ) > 0 );
if( sign < 0 )
s[i++] = '-';
s[i] = '0';
reverse( s );
}
/**
**************************************************************************
****1111
58. Function Name : delay()
Description :This function suspends the tasks for specified ticks.
Input : ticks:no of ticks in multiple of 1 usec
task: task to be suspended
Output : void
*******************************************************************************
*/
void delay(int count)
{
int j=0,i=0;
for(j=0;j<count;j++)
{
/* At 60Mhz, the below loop introduces
delay of 10 us */
for(i=0;i<35;i++);
}
}
void delayy(unsigned int t)
{
int i,j;
for(j=0;j<t;j++)
for(i=0;i<50000;i++);
}
59. (extISR.C)
//This program contains the instruction sets for the hardware
interrupts required when a keyhit is made from the keyboard.
#include <LPC214x.H> /* LPC214x definitions */
#include "ps2kbd.h"
#include "utils.h"
#define kbDAT (IO1PIN & (KB_DAT))
#define kbCLK (IO0PIN & (KB_CLK))
#define K_STARTBIT 1
#define K_PARITYBIT 10
#define K_STOPBIT 11
extern unsigned char bitcount;
/**
*****************************************************************************
Function Name : extISR0()
******************************************************************************
*/
void extISR0(void) __irq
{
static U8 key_data; // Holds the received scan code
U32 clkstat;
60. U32 datstat;
U32 paritystat;
clkstat = IO0PIN & (IO0PIN & 0x00010000); //kbCLK=(IO0PIN &
BIT16=0x00010000)=>P0.4=1.....check CLK pin state;
datstat = kbDAT; //kbDAT=(IO1PIN & (KB_DAT))...P1.16=>PS2 data..check DAT pin state;
bitcount++;
if (bitcount==1) //K_STARTBIT
{
if (datstat || clkstat) bitcount=0;
key_data=0;
paritystat=0;
}
else if (bitcount==10) //K_PARITYBIT
{
paritystat = datstat;
}
else if (bitcount==11) //K_STOPBIT
{
decode (key_data);
bitcount=0;
}
else
{
// For all bits from 2, 3...9 (total 8-bit)
key_data= key_data >> 1;
61. if (datstat)
{
key_data = key_data | 0x80;
}
}
EXTINT = 0x01; //clear interrupt
VICVectAddr = 0;
}//extISR
Steps to be performed for typing the complete program in Keil uVision 4.6
IDE:
1. Go to Project-> New uVision Project.
2. Save the project in some folder with the extension *.uVproj
3. Then Select the Microcontroller being used. In our Project, we have selected
NXP LPC 2148.
4. Add all the files to the Project after writing programs in separate files.
5. Now go to Flash->Configure Flash Tools,then go to the Target tab and
select the on-chip I-ROM 1 area address from 0x2000. It has been done so
because the flashed Bootloader program occupies the area upto 0x2000
address.
6. Under the User tab tick the check box Run #1 and type in the box the
following: fromelf --bin .ObjPS2KBD_LCD.axf -o .Obja.bin
This is done in order to create a .Bin Object file from .C file.
AXF refers to Arm Executable Format. It changes the format from .axf to
.bin which can then be saved into the ROM of the microcontroller using the
Bootloader functionality where the microcontroller can just behave like a
62. removable mass storage device and we can copy and paste the generated .bin
file into the mass storage device.
7. Now click on Project->Rebuild All Target Files. The Program will get
compiled and .bin file will be created inside the Obj folder as mentioned
above. .Bin file will be created only when there are no errors in the program.
Advantages involved in the project:
• Highly Secure due to the presence of multilevel security
• The development board requires just 3.3 V of power supply and hence
power consumption and dissipation are very low.
• Security alarm with the help of DAC is possible,thus alerting the
security personnel if any unauthorized repeated access is made more
than thrice.
• Inability for any unauthorized user to access the locker due to the
presence of all-time electric shock.
• One-minute blocking of the whole system if any unauthorized access
is made more than thrice.
• Made on a low budget of Rs. 4200 which is quite low as compared to
the similar type of system available in the market ranging from Rs.
15,000- Rs. 20,000.