0% found this document useful (0 votes)
6 views91 pages

E&IOt Mini Project

The document outlines the record note for the Embedded Systems and IoT Design Lab at P.T. Lee Chengalvaraya Naicker College of Engineering & Technology. It includes a bonafide certificate, a list of experiments conducted using the 8051 microcontroller, and programming exercises for arithmetic and logical operations. The document also details the procedures and algorithms for various experiments, including generating square waveforms and interfacing components.

Uploaded by

Abitha Palani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views91 pages

E&IOt Mini Project

The document outlines the record note for the Embedded Systems and IoT Design Lab at P.T. Lee Chengalvaraya Naicker College of Engineering & Technology. It includes a bonafide certificate, a list of experiments conducted using the 8051 microcontroller, and programming exercises for arithmetic and logical operations. The document also details the procedures and algorithms for various experiments, including generating square waveforms and interfacing components.

Uploaded by

Abitha Palani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 91

P.T.Lee.

CHENGALVARAYA NAICKER COLLEGE OF


ENGINEERING &TECHNOLOGY
Oovery, Kanchipuram-631502

RECORDNOTE

Department of Electronics and Communication Engineering


ET3491- EMBEDDED SYSTEMS AND IOT DESIGN LAB

STUDENT NAME :

REGISTER NO :

SEMESTER :

YEAR :
P.T.Lee. CHENGALVARAYA NAICKER COLLEGE OF
ENGINEERING &TECHNOLOGY
Oovery,Kanchipuram-631502

BONAFIDECERTIFICATE
This is to certify that record work done by Mr/Ms _
(RegNo. )of year B.E-Department of
In the laboratory
During the academic year20 -20

Staff-in-charge Head of the Department

Submitted for the practical examination held on

Internal Examiner External Examiner


CONTENT
S.NO DATE PAGE MARK SIGN
NO
NAME OF THE EXPERIMENT

1. Arithmetic Operations & Logical operations using


8051 Kit

2. Generation of Square Waveform Using 8051

3. Programming using On-chip Ports in 8051

4. Programming using Serial Ports in 8051

5. Design of a Digital Clock Using Times/Counters in


8051

Experiments Using ARM

6. Interfacing ADC and DAC

7. Blinking of LEDs and LCD

8. Interfacing Keyboard and Stepper Motor

Mini Projects for IOT

9. Smart lock System


PROGRAM: ADDITION

ADDRESS OPCODE LABEL PROGRAM COMMENTS


4100 74 MOVA,#05 Loaddata1ina
4101 05 ccumulator.
4102 75 MOVB,#05 Loaddata2in B-register
4103 F0
4104 05
4105 35 ADDCA,B Add the contents
4106 F0 ofaccumulatorandB-
reg
withcarry.
4107 90, MOVDPTR,#4500H InitializeDPTRwith
4108 45, address4500H
4109 00
410A F0 MOVX@DPTR,A Storetheresult in4500H
410B 80 STOP: SJMPSTOP(410B) Stoptheprogram
410C FE

OUTPUT:
INPUT OUTPUT
Register Data Address Data
A-register
B-register

PROGRAM: SUBTRACTION

ADDRESS OPCODE LABEL PROGRAM COMMENTS


4100 74 MOVA,#05 Loaddata1in
4101 05 accumulator.
4102 75 MOVB,#04 Loaddata2in B-register
4103 F0
4104 04
4105 95 SUBBA,B Subtractthecontentsof
4106 F0 B-
regfromaccumulatorwithb
orrow.
4107 90 MOVDPTR,#4500H InitializeDPTRwithad
4108 45 dress4500H
4109 00
410A F0 MOVX@DPTR,A Storetheresult in4500H
410B 80 STOP: SJMPSTOP (410B) Stoptheprogram
410C FE
OUTPUT:
INPUT OUTPUT
Register Data Address Data

A-register 05 4500 01
B-register 04
EXP NO: 01 PROGRAMMING ARITHMETICAND LOGICAL
DATE: OPERATIONSUSING8051

AIM:

To write and execute on assembly language program for addition, subtraction, multiplication and

division.

APPARATUS:
1. 8051microcontrollerkit------1
2. Powercard-----1
3. Keyboard----1

ADDITION
ALGORITHM:
1. LoadtheFirstDatainA-register.
2. LoadtheSecondDatainB-register.
3. Addthetwodatawithcarry.
4. Storethesum inmemorylocation.
5. Stoptheprogram.

SUBTRACTION
ALGORITHM:
1. Load the First Data in A-register.
2. Load the Second Data in B-register.
3. Subtract the two data with borrow.
4. Store the sum in memorylocation.
5. Stop the program
PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS

4100 74 MOVA,#05 Loaddata1inaccumulator.


4102 05
4103 75 MOVB,#05 Loaddata2in B-register
4104 F0
4105 05
4106 A4 MULAB A*B, Higher byte of result
inB and lower byte of result
inA.
4107 90 MOVDPTR,#4500H InitializeDPTRwithaddress4
4108 45 500H
4109 00
410A F0 MOVX@DPTR,A Storethe LSBin4500H
410B A3 INCDPTR IncrementDatapointer
410C E5 MOVA,B Copythe contentof B-
410D F0 regtoA-register.
410E F0 MOVX@DPTR,A StoretheMSBin 4501H
410F 80 STOP: SJMP Stoptheprogram
410G FE STOP(410E
)

OUTPUT:

INPUT OUTPUT
REGISTER DATA ADDRESS DATA
A 05 4500 19
B 05
PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 74 MOVA,#07 Loaddata1inaccumulator.
4101 data1
4102 75 MOVB,#02 Loaddata2in B-register
4103 data2
4104 84 DIVAB Divide.RemainderinAandquo
tientin B
4105 90 MOVDPTR,#4500H InitializeDPTRwithaddress450
4106 45 0H
4107 00
4108 F0 MOVX@DPTR,A StoretheRemainderin45
00H
4109 A3 INCDPTR IncrementDatapointer
410A E5,F0 MOVA,B CopythecontentofB-regtoA-
register.
410C F0 MOVX@DPTR,A Storethequotient in 4501H
410D 80,FE STOP: SJMP STOP(410D) Stoptheprogram
MULTIPLICATION
ALGORITHM:
1. Getthemultiplierintheaccumulator.
2. GetthemultiplicandintheBregister.
3. MultiplyAwith B.
4. Storetheproductinmemorylocation.
5. Stoptheprogram.

DIVISIONALGORITHM:
1. GettheDividendintheaccumulator.
2. GettheDivisorintheBregister.
3. DivideAbyB.
4. StoretheQuotientandRemainderinmemory.
5. Stoptheprogram.
OUTPUT:

INPUT OUTPUT
REGISTER DATA ADDRESS DATA
A-Register 07 4500 01(quotient)
B-Register 02 4501 03(remainder)

PROGRAM:
AND OPERATION

ADDRESS OPCODE LABEL PROGRAM COMMENTS


4100 78 MOVR0,#14 Loaddata1inR0-reg.
4101 14
4102 74 MOVA,#12 Loaddata2inA-register
4103 12
4104 58 ANLA,R0 LogicalANDthecontents
ofA-regwithR0-register.
4105 90 MOVDPTR,#4500H InitializeDPTRwith
4106 45 address4500H
4107 00
4108 F0 MOVX@DPTR,A Storetheresult in4500H
4109 80 STOP: SJMPSTOP(4109) Stoptheprogram
410A FE
OUTPUT:

INPUT OUTPUT
REGISTER DATA ADDRESS DATA
R0-Register 14 4500 10
A-Register 12

PROGRAM:
OROPERATION

ADDRESS OPCODE LABEL PROGRAM COMMENTS

4100 78 MOVR0,#14 Loaddata1inR0-reg.


4101 14
4102 74 MOVA,#12 Loaddata2inA-register
4103 12
4104 58 ORLA,R0 Logical OR the
contentsofA-regwithR0-
register.
4105 90 MOVDPTR,#4500H InitializeDPTRwitha
4106 45 ddress4500H
4107 00
4108 F0 MOVX@DPTR,A Storetheresult in4500H
4109 80 STOP: SJMPSTOP(4109) Stoptheprogram
410A FE
EXP NO: LOGICAL OPERATIONS USING 8051
DATE:

AIM:

To write and Executed on assembly language program to performed logical operation using 8051

APPARATUS:
1. 8051microcontrollerkit------1
2. Powercard-----1
3. Keyboard----1

ALGORITHM:
1. GettheData1intheR0-register.
2. GettheData2intheAregister.
3. LogicalAND, OR,XORAwithR0.
4. Storetheresultinmemory.
5. Stoptheprogram.
OUTPUT:

INPUT OUTPUT
REGISTER DATA ADDRESS DATA
R0-Register 85 4500 9B
A-Register 99
PROGRAM:XOROPERATION

ADDRESS OPCODE LABEL PROGRAM COMMENTS

4100 78 MOVR0,#DATA1 Loaddata1inR0-reg.


4101 14
4102 74 MOVA,#DATA2 Loaddata2inA-register
4103 12
4104 68 XRLA,R0 Logical EX-OR
thecontentsofA-
regwithR0-register.
4105 90 MOVDPTR,#4500H InitializeDPTRwithad
4106 45 dress4500H
4107 00
4108 F0 MOVX@DPTR,A Storetheresult in4500H
4109 80 STOP: SJMPSTOP Stoptheprogram
FE

OUTPUT:

INPUT OUTPUT
REGISTER DATA ADDRESS DATA
R0-Register 4500
A-Register
RESULT:
Thus assembly language program for programming using Arithmetic and logical using 8051 was
executed successfully.
PROGRAM:SQUAREOFANUMBER

ADDRESS OPCODE LABEL PROGRAM COMMENTS

4100 90 MOVDPTR,# Initializedatapointerwitha


4101 45 4200H ddress4200H
4102 00
4103 E0 MOVXA,@DPTR Copythecontentofdatafromaddres
s 4200Htoaccumulator
4104 F8 MOVR0,A CopythecontentofdatafromR0
-regto accumulator
4105 F5 MOVB,A CopythecontentofdatafromA-
4106 F0 regtoB-register.
4107 A4 MULAB MultiplyAB
4108 A3 INCDPTR Incrementdatapointertostoreth
eresult
4109 F0 MOVX@DPTR,A Storetheresult in4500H
410A E5 MOVA,B CopythecontentofdatafromB-
410B F0 regtoA-register.
410C A3 INCDPTR Incrementdatapointertostoreth
eresult
410D F0 MOVX@ Storetheresult in4501H
DPTR,A
410E 80 STOP: SJMP STOP(410E) Stoptheprogram
410F FE

OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 FF 4201 01
4202 FE
EXP.NO: 02 Generation of Square Waveform Using 8051
Date:

AIM:

To write and Executed on assembly language program to performed Generation of Square Waveform Using

8051

APPARATUS:

1. 8051microcontrollerkit------1
2. Powercard-----1
3. Keyboard----1

SQUARE OF A NUMBER
ALGORITHM:
1. GettheDataintheR0-register.
2. GetthesameDataintheBregister.
3. MultiplyAandB.
4. Storetheresultinmemory.
5. Stoptheprogram.

RESULT:

Thus assembly language program for programming Generation of Square Waveform Using 8051 was executed
successfully.
EXP.NO:03 Programming using On-chip Ports in 8051
Date:

AIM:
To write and Executed on assembly language program to performed Programming using On-chip Ports
in 8051

APPARATUS:

1. 8051microcontrollerkit------1
2. Powercard-----1
3. Keyboard----1

PROCEDURE:
The 8051 microcontroller has 40 pins, comprising four I/O ports. The microcontroller uses 8 pins for
specific purposes, while 32 pins are configurable as input and output pins to connect the
microcontroller with peripheral devices. Each port consists of 8 bits, which we can define as an input
or an output.
8051 GPIO Ports details
A port is usually a set of eight pins, and we call them I/O because we can configure them as input or
output. 8051s has four GPIO ports, and each port has eight pins; each pin may have one or more than
one function

which is an open-drain bi-directional I/O port. Open drain simply means a transistor that connects to
the Ground, while bi-directional refers to the fact that this PORT is configurable as an input or an
output. We can use the P0 register to access PORT 0. This register is a bit accessible. Bit accessible
means that we can access individual bits of the register. For example, writing 1 to some bit of the P0
register will configure the corresponding pin as input, while writing 0 will configure that pin as
output. By default, the microcontroller configures every pin as input when it turns on.

P0 Register Pins

P0 includes pins (32–39). It is an I/O port with some alternative functions.

 When a microcontroller utilizes external memory, it must communicate with this memory using
special pins and send a lower address byte to the external memory using P0 pins. If no external
memory is connected, the microcontroller can use all P0 pins for I/O tasks.
 P0 pins don’t have a built-in pull-up resistor.
 If we configure p0 as an input, it behaves as if it is “floating”. This means its input resistance
is very high, and its potential becomes uncertain because it is not actively driven by any
source.
 When we set the P0 pin of the microcontroller as output, it behaves like an “open drain”. If
we set the logic to 0, the pin connects to the ground (0 V). But if we provide the P0 pin with
logic 1, it behaves as “floating”. In order to keep a stable logic voltage of 5 V, we need to
connect an external pull-up resistor.

GPIO Pins 8051 Microcontroller

Configure Port 1 and 2 of 8051

Now we are going to see Port 1 and Port 2 with interesting and simple examples. We will make a simple
program that will configure Port 1 as input and Port 2 as output, and whatever input we apply to Port 1 will be
sent to Port 2. Let’s try to code this example. We can write 0xFF to Port 1 to configure it as input, and we can
also skip this step as the microcontroller already configures Port 1 as input by default as it powers on. We can
also configure Port 2 as an output by writing 0 to it.

void main()
{
P1 = 0xFF;
P2 = 0x00;

while (1) {
P2 = P1;
}
}
In this code, we have set Port 1 as input by writing P1 = 0xFF, and then we have set Port 2 as output using
0x00. In the last part, we want to send Port 1’s input to Port 2, so we can simply put Port 2 equal to Port 1.

PORT 3 of 8051 Microcontroller


P3 includes pins (10–17). It is an I/O port with an alternative function. For using the alternative functions, a
logic one (1) must be applied to the appropriate bit of the P3 register. In terms of hardware, this port is similar
to P0, but it contains a built-in pull-up resistor, which is not present in P0.

Pin Configuration Setting – Input/output Ports 8051 Microcontroller


The pin configurations are shown in the table below:

Pin configuration Working

Input Pin needs to be configured as 1 for input.

Output Pin needs to be configured as 0 for output.

Result:

Thus assembly language program for programming using On-chip port using 8051 was executed successfully.
….
EXP.NO:04 Programming using Serial Ports in 8051

Date:

AIM:
To write and Executed on assembly language program to performed Programming using Serial
Ports in 8051.

APPARATUS:

1. 8051microcontrollerkit------1
2. Powercard-----1
3. Keyboard----1

Program:
CHECK TRANSMISSION AND RECEPTION OF CHARACTER:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
4100 74 MOV A,#36
4101 36
4102 90 MOV DPTR,#FFCE
4103 FF
4104 CE
4105 F0 MOVX @DPTR,A
4106 74 MOV A,#12 ;To get an output
4107 0A
4108 90 MOV DPTR,#FFC8 ;frequency of 150KHZ at
4109 FF
410A C8
410B F0 MOVX @DPTR,A ;channel 0,so as to get A
410C 74 MOV A,#00 ;band rate of 150KHz at
410D 00
410E F0 MOV @DPTR,A ;channel 0
410F 74 MOVX A,#4E
410G 4E
4111 90 MOV DPTR,#FFC2
4112 FF
4113 C2
4114 F0 MOVX @DPTR,A
4115 74 37 MOV A,#37
4117 F0 MOV @DPTR,A
4118 74 MOVX A,#41
4119 41
411A 90 MOVX DPTR,#FFC0
411B FF
411C C0
411D F0 MOV @DPTR,A
411E E0 MOVX A,@DPTR

411F 90 HERE:SJMP DPTR,#4200


411G 42
4121 00
4122 F0 MOV @DPTR,A
4123 80 FE MOV HERE

Output:

A,#41 Value was stored the address 411F


RESULT:

Thus assembly language program for programming using Serial port using 8051 was executed
successfully.

PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS


1000 E875 00 CALLCONVERT Callsubroutineforconversion
1003 E862 00 CALLDISPLAY CallsubroutineforDisplay
1006 C6 C0 80 DELAY: MOVAL,0B0H Copythe data 0B0H toAL-reg
1009 E616 OUT16H,AL Configureoutputport
100B 16 C0 C7 MOVCL,07H Copythedata 07H toAL-reg
100E 66 C0 88 S2: MOVAL,88H Copy88H toAL-register
1011 E6C4 OUT14H,AL Configureoutputport
1013 C6 10 80 MOVAL,80H Copythedata 80H toAL-reg
1016 C6 14 OUT14H,AL Configureoutputport
1018 C6 10 80 S1: NOP Nooperation
1019 E616 NOP Nooperation
101A 90 NOP Nooperation
101B 90 NOP Nooperation
101C 90 INAL,14H Copy14HtoAL-reg
101E 90 MOVDL,AL CopytheContent ofALregtoDL-
reg.
1020 E414 INAL,14H Copy14HtoAL-reg
1022 88 C2 ORAL,DL ORthecontentsofALwithDL

1024 E414 JNZS1 Jump on nozero to S1


1026 88 10 DECCL DecrementCL-register
1028 E414 JNZS2 Jump on nozero to S2
102A 08 10 MOVSI,1500H CopySI-regwithdata1500H
102E 75ED MOVAL,[SI] CopythecontentofSI-regtoAL

1030 C7 C6 00 15 INCAL IncrementAL-register


1032 B404 MOV[SI],AL Copythecontent ofALregtoSI-
reg
1034 C6 7EC0 CMPAL,3CH CompareALwith3CH
1037 EA04 JNZSTART Jumpon nozero to start
1039 7E10 MOVAL,00H CopyALwithdata 00H
103C 88 04 MOV[SI],AL CopythecontentofAltoSI-reg

103E C6 C0 16 INCSI IncrementSI-register


103F C8 04 MOVAL,[SI] CopythecontentofSI-regtoAL

1041 46 INCAL IncrementAL-register

EXP.NO:05 Design of a Digital Clock Using Times/Counters in 8051


Date:

AIM:
To write and Executed on assembly language program to performed Programming using Design of a
Digital Clock Using Times/Counters in 8051

APPARATUS:
1. 8086microprocessorkit-----1
2. TrafficLightControllerInterfaceboard-------1
3. Powercard-----1
4. Keyboard----1

104A 88 MOVAL,0 CopyALwithdata 00H


404B F8
104C 75 MOV[SI],AL Copythe contentof ALregto
104D B SI-reg
104E C6 INCSI IncrementSI-register
104F 10
104G 00
1050 88 MOVAL,[SI] Copythecontent of SI-regto
1051 04 AL
1052 46 INCAL IncrementAL-register
1054 8A MOV[SI],AL Copythe contentof ALregto
1055 04 SI-reg
1056 FE CMPAL,18H CompareALwith18H
1056 C0
1057 88 JNZSTART Jumpon nozero to start
1058 04
1059 FF MOVAL,0 CopyALwithdata 00H
105A C0
105B 88 MOV[SI],AL Copythe contentof ALregto
105C 04 SI-reg
1060 88 JMPSTART Jumptostart
1061 FB
1062 1B
1063 75 DISPLAY: MOVAH,06H Copy06HtoAH-register
1064 10
1065 C6 MOVDX,1600H Copy1600H toDX-register
1066 10
1067 00
1068 C7 MOVCH,01H Copy01HtoCH-register
1069 20
106A 06
106B C0 MOVCL,0H Copy00HtoCL-register
106C 15
106D 01
1070 C6 INT5 CallInterrupt
1071 C5
1072 00
1073 C0 RET Returnfromsubroutine
1074 05
1075 C3 CONVERT: MOVSI,1500H Copy1500H toSI-register
1077 C6 MOVBX,1608H Copy1608H toBX-register
1078 11
1079 00
107A C0 MOVAL,24H Copy24H toAL-register
107B 05
107C C3 MOV[BX],AL CopythecontentofAL-regtoBX

1080 C7 MOVAL,[SI] Copythecontent of SI-regto


1081 C8100A AL
1082 C7 MOVAH,0 CopyALwithdata 00H
1083 C6
1084 00 16
1085 C0 MOVDH,0AH Copythe data 0AH toDH-
1086 10 register
1087 24
1088 3A DIVDH Divide DH-regbyAHreg
1089 10
108A C6 ADDAH,30H Addthedata30HwithAH-reg
108B C4
108C 10
108D C6 DECBX DecrementBX-register
108C 60
108E 0A
108F C6 MOV[BX],AH Copythe datafromAH to
108G C6 DH-reg
108H 0A
1090 F6 DECBX DecrementBX-register
1091 F6
1092 4B ADDAL,30H Addthedata30HwithAL-reg
1093 80 MOV[BX],AL Copythedatafrom ALtoBX-reg
1094 21
1095 4B DECBX DecrementBX-register
1096 80 MOVAL,3AH Copythe 3AH toAL-reg
1096 C0
1097 30
109A 86 MOV[BX],AL CopythedatafromALtoBX-
109B 07 reg
109C 4B DECBX DecrementBX-register
109D C6 INC SI Increment SI-register
109E C0
109F 37
109G 88 MOV AL,[SI] Copy the content of SI-reg to
109H 07 AL
10A0 4B MOV AH,0 Copy the data 0 to AH-reg
10A3 46 MOV DH,0AH Copy the data 0AH to DH-
register
10A6 BA DIV DH Divide DH-reg by AH reg
10A7 10
10A8 C6 ADD AH,30H Add the data 30H with AH-reg
10A9 C4
10AA 00
10AB C6 MOV [BX],AH Copy the data from AH to BX-
10AC C0 reg
10AD 04
10AD F DEC BX Decrement BX-register
10AE F6
10AF P0 ADD AL,30H Add the data 30H with AL-reg
10AG C4
10AH 30
10B1 88 MOV [BX],AL Copy the data from AL to BX-
10B2 27 reg
10B3 4B DEC BX Decrement BX-register
10B4 30 MOV AL,3AH Copy the 3AH to AL-reg
10B5 30
10B6 03
10B7 30 MOV [BX],AL Copy the data from AL to BX-
10B8 07 reg
10B9 4B DEC BX Decrement BX-register
10BA 46 INC SI Increment SI-register
10BB 4B MOV AL,[SI] Copy the content of SI-reg to
AL
10BD 8A MOV AH,0 Copy the data 0 to AH-reg
10BE 04
10C0 C6 MOV DH,0AH Copy the data 0AH to DH-
10C1 C4 register
10C2 00
10C3 F6 DIV DH Divide DH-reg by AH reg
10C4 F6
10C5 80 ADD AH,30H Add the data 30H with AH-reg
10C6 C4
10C7 B6
10C8 88 MOV [BX],AH Copy the data from AH to BX-
10C9 27 reg
10CA 4B DEC BX Decrement BX-register
10CB 20 ADD AL,30H Add the data 30H with AL-reg
10CC C0
10CD 30
10CE 28 MOV [BX],AL Copy the data from AL to BX-
10CF 07 reg
10D0 80 RET Return from subroutine
10D1 F8
10D2 F0
10D3 80 GETC: IN AL,02H Copy 02H to AL-reg
10D4 C4
10D5 B6
10D6 88 AND AL,0FFH AND data AL with 0FFH
10D7 27
10D6 80 CMP AL,0F0H Compare AL with 0F0H
10D7 F8
10D8 F0
10D9 JHECHTE JNE GETC If no zero jump to getc

OUTPUT:
1500-00 SECONDS
1501-00 MINUTES
1502-09 HOURS
RESULT:
Thus the Programming Design of a Digital Clock Using Times/Counters in 8051 was
executed.
…..
EXP NO: 06(a)
A/D INTERFACE WITH 8051

DATE:
AIM:
Towrite anassemblylanguageprogramforinterfacingofADCwith8051.

ALGORITHM:-

(i) Starttheprogram
(ii) MakeCS=0andsendalowtohighpulsetoWRpintostarttheconversion.
(iii) NowkeepcheckingtheINTRpin.INTRwillbe1ifconversionisnotfinishedandINTR
willbe0 if conversion is finished.
(iv) If conversion is not finished(INTR=1),poll until it is finished.
(v) Ifconversionisfinished(INTR=0),gotothenextstep.
(vi) MakeCS=0andsendahightolowpulsetoRDpintoreadthedatafromtheADC
(vii) Stoptheprogram
PROCEDURE:

(i) PlacejumperJ2inCposition
(ii) PlacejumperJ5inAposition
(iii) Enterandexecutetheprogram
(iv) Varytheanaloginput(using
trimpot)andviewthecorrespondingdigitalvalueinLEDdisplay,
FLOWCHART:

START

MakeCS=0

keepcheckingtheINTRpin

Ifconversionisnotfinished(IN
TR=1)

Ifconversionisfinished(INTR=0)

STOP
PROGRAM:

Label Address Mnemonics Comments


1000 MOV ;initiatesP1astheinputport
MAIN: P1,#11111111BCLRP ;makesCS=0
3.7 ;makesRDhigh
1003 SETBP3.6
CLR ;makesWRlow
1005 P3.5SETBP3.5 ;lowtohighpulsetoWRforstarting
WAIT: 1008 JBP3.4,WAIT ;pollsuntilINTR=0c
CLRP3.7 onversion
CLRP3.6 ;ensuresCS=0
MOVA,P1 ;hightolowpulsetoRDforreadingthe
100A CPLA datafromADC
MOVP0,A ;movesthedigitaldatatoac
SJMPMAIN cumulator
END ;complementsthedigitaldata
;outputsthedatatoP0fortheLEDs
100D ;Jumptoprogram
;End
100F

JumperDetails:-
Fromswitch CH3

B B
Software CH0 A
C CH
ASOC C
Fromlatch
Box
….

35
RESULT:

Thus assembly language program for programming using Interfacing ADC 8051 was
executed successfully.

36
…..

37
EXPNO:06(b)
INTERFACING OF DAC
DATE:

AIM:
TointerfacetheDACwith8051 microcontroller and generate the square wave, saw tooth wave
and triangular wave.

REQUIREMENTS:

S. Hardware&SoftwareRequirements Quantity
No
1 8051TrainerKit 1No
2 PowerChord 1No
3 DACinterfacingboard 1No
4 CRO 1No

38
CIRCUITDIAGRAM:

WAVEFORMS:

39
SQUAREWAVE

ADDRESS LABEL MNEMONICS OPCODE COMMENTS


4100 MOVDPTR,#E0C0 90,FF,C8 MovetheimmediateData
EOCO
4103 START MOVA,#00 74,00 InitializetheAccumulator
4105 MOVX@DPTR,A F0 Tozero
Long call the
4106 LCALLDELAY 12,41,12
delayMovetheconte
4109 MOVA,#FF 74,FF ntofAccumulator to
410B MOVX@DPTR,A F0 FFLong call
delayLong jump to
410C LCALLDELAY 12,41,12 startMove the 05
410F LJMPSTART 02,41,03 dataToR register
4112 DELAY MOVR1,#05 79,05 DecrementJumpNONzeroRe
turn tomain
4114 LOOP MOVR2,#FF 74,FF programShortjumpto start
4116 HE RE DJNZR2,HERE DA,FE
4118 DJNZR1, LOOP D9,FA
411A RET 22
411C SZMPSTART 80,E3

OBSERVATION:

AMPLITUDE TIMEPERIOD

5.4 v 2.2s

RESULT:
Thus assembly language program for programming using InterfacingDAC 8051 was executed
successfully.

40
…..

….

41
EXP.NO: 07 BLINKING OF LEDS AND LCD
Date:

AIM:
To write and execute the program for LED & Flashing Led‟swithARM7
(LPC2148) processor.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S. Hardware&SoftwareRequirements Quantity
No
1 ARMProcessorboard 1
2 USB/FRCConnector few
3 LEDModule 1
4 PowerSupplyadaptor(5V,DC) 1
5 Keil&flashmagicSoftware 1

PROCEDURE
1. Create a New project Go to “Project” and close the current project “Close Project”.
2. Next Go to the Project New μ vision Project Create New Project Select Device for Target.
3. SelectthedatabaseNXPLPC2148.
4. Add Start up file and Next go to “File” and click “New”.
5. Writeaprogramontheeditorwindowandsaveas“Main.c”.
6. AddthissourcefiletoGroup andclickon“BuildTarget”orF7.
7. CreateaHexfilefrom “Project”menuandclickon“RebuildalltargetFiles”.
8. OpenFlashmagicandselectthedeviceLPC2148inARM7category,Choosethehardwareconn
ected COMport,baudrate9600,interface None[ISP],Oscillatorfrequency

9. Nextbrowsethepathofhexfileandselectthefile.
10. AfterselectingISPmodeonthe HardwareKitandclickonstart thendevicewillstart
toprogram
11. Finally can be see the finished indication and values in SPJ Terminal and Reset
the device into running mode.
12. 0MHz and click on erase of flash code Rd plot.

42
LED INTERFACING:
CIRCUITDIAGRAM:

PROGRAM:

#include <lpc214x.h>inti;

Int main(){

IODIR0=(1<<3);

while(1)

{IOSET0=(1<<3);for(i=0;i<120000;i++);IOCLR0=(1<<3);for(i=0;i<120000;i++);

43
FLASHING OF LED: CIRCUITDIAGRAM:

PROGRAM: TYPE-I:

#include
<lpc214x.h>inti;
intmain()
{ IODIR0=0x000000
FF;
while(1)

{ IOSET0=0x000000A
A;for(i=0;i<120000;i+
+);I
44
OCLR0=0x000000A;

for(i=0;i<120000;i++);
}

FRONT AND BACKLED:

#include
<lpc214x.h>intb,i;
intmain()
{ IODIR0=0x000000F
F;
while(1)
{
for(b=0;b<8;b++)
{IOSET0=(1<<b)
;for(i=0;i<120000;i+
+);IOCLR0=(1<<b);fo
r(i=0;i<120000;i++);
}
for(b=7;b>=0;b--)
{IOSET0=(1<<b)
;for(i=0;i<120000;i+
+);IOCLR0=(1<<b);fo
r(i=0;i<120000;i++);
}
}

SWITCH CONTROLLED LED (1-SWITCH): CIRCUIT DIAGRAM

45
PROGRAM:
#include
<lpc214x.h>inti,b;
intmain()
{ IODIR0=0x000000
FF;IODIR0=~(1<<16
);

while(1)
{if((IOPIN0&(1<<16))==0)
{
for(b=0;b<8;b++)
{IOSET0=(1<<b)

46
;for(i=0;i<120000;i+
+);IOCLR0=(1<<b);fo
r(i=0;i<120000;i++);
}
}
else
{ IOCLR0=0x000000F
F;
}
}
}

47
BLINKING LCD

AIM:
To write and execute the program for LCD with ARM7(LPC2148) processor.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S.No Hardware&SoftwareRequirements Quantity

1 ARMProcessorboard 1
2 USB/FRCConnector few
3 LEDModule 1
4 PowerSupplyadaptor(5V,DC) 1
5 Keil& flashmagicSoftware 1

PROCEDURE

1. CreateaNewproject,Goto“Project”andclosethecurrentproject“CloseProject”.
2. NextGotothe ProjectNewμvisionProjectCreate NewProjectSelectDeviceforTarget.
3. SelectthedatabaseNXPLPC2148.
4. AddStartupfileandNextgoto“File”andclick“New”.
5. Writeaprogramontheeditorwindowandsaveas“Main.c”.
6. AddthissourcefiletoGroupandclickon“BuildTarget”orF7.
7. CreateaHexfilefrom“Project”menuandclickon “RebuildalltargetFiles”.
8. Open Flash magic and select the device LPC2148 in ARM 7 category, COM port will
beCOM 3, baud rate 9600, interface None [ISP], Oscillator frequency 12.0 MHz and c lick
onerase offlashcodeRd plot.
9. Nextbrowsethepathofhexfileandselectthefile.
10. AfterselectingISPmodeontheHardwareKitandclickonstart thendevicewillstart
toprogram
11. Finallycanbeseethe finished indicationandvaluesinSPJTerminalandReset
thedevice intorunning mode.

48
INTERFACING LCD:
CIRCUIT DIAGRAM:

PROGRAM:

#include
<lpc214x.h>#include
<lcd.h>
49
intmain()
{

LCD_INIT();
LCDSTR(0x00000084,"St.ANNES");LCD
STR(0x000000C2,"ENGGCOLLEGE");
while(1)
{
}
}

LCD LAYOUT:

80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F

C0 C C2 C3 C4 C5 C6 C C8 C9 CA CB CC CD CE CF
1 7

OUTPUT:

80 67 43 34 34 14 51 65 67 87 77 55 33 92 75 25

C3 C4 C6 C3 C9 C0 C2 C8 C0 C2 C4 C5 C1 C3 C1 C3

RESULT:

Thus ARM Processor for programming using Blinking of LEDs and LCD Using ARM was
executed successfully.

50
KEYBOARD INTERFACING:
CIRCUITDIAGRAM:

51
EXPNO:08
INTERFACING OF MATRIX KEYBOARD
DATE

AIM:
To write and execute the program for Matrix Keyboard with ARM 7(LPC2148) processor.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S. No Hardware & Software Requirements Quantity

1 ARM Processor Board 1


2 USB/FRC Connector few
3 LCD Module 1
4
Power Supply adaptor(5V,DC) 1
5
Keil & flash magic Software 1
6
Matrix Keypad Module 1

PROCEDURE

1. CreateaNewproject,Goto“Project”andclosethecurrentproject“CloseProject”.
2. NextGototheProjectNewμvisionProjectCreate NewProjectSelectDeviceforTarget.
3. Select thedatabaseNXPLPC2148.
4. AddStartupfileandNextgoto“File”andclick“New”.
5. Writeaprogramontheeditorwindowandsaveas“Main.c”.
6. AddthissourcefiletoGroupandclickon“BuildTarget”orF7.
7. CreateaHexfilefrom“Project”menuandclickon “RebuildalltargetFiles”.
8. Open Flash magic and select the device LPC2148 in ARM 7 category, COM port will
beCOM 3, baud rate 9600, interface None [ISP], Oscillator frequency 12.0 MHz and click
onerase offlashcodeRd plot.
9. Nextbrowsethepathofhexfileandselectthefile.
10. AfterselectingISPmodeontheHardwareKitandclickonstart thendevicewillstart

52
toprogram

PROGRAM:

#include
<lpc214x.h>#include
<lcd.h>#include<keybo
ard.h>

intmain()
{
LCD_INIT();
LCDSTR(0x00000080,"Matrix
Keypad");LCDSTR(0x000000C0,"KeyPr
essed:");
while(1)
{
IO0CLR=CLR;I
O0SET= C1;
delay_ms(10);if(scan(R1))LCDSTR(0x000000
CC,"0");//
K1if(scan(R2))LCDSTR(0x000000CC,"4");//
K5if(scan(R3))LCDSTR(0x000000CC,"8");//
K9if(scan(R4))LCDSTR(0x000000CC,"C");//
K13IO0CLR=CLR;
IO0SET = C2;
if(scan(R1))LCDSTR(0x000000CC,"1");//K2if(
scan(R2))LCDSTR(0x000000CC,"5");//
K6if(scan(R3))LCDSTR(0x000000CC,"9");//
K10if(scan(R4))LCDSTR(0x000000CC,"D");//
K14IO0CLR=CLR;
IO0SET = C3;
if(scan(R1))LCDSTR(0x000000CC,"2");//K3if(
scan(R2))LCDSTR(0x000000CC,"6");//
K7if(scan(R3))LCDSTR(0x000000CC,"A");//
K11if(scan(R4))LCDSTR(0x000000CC,"E");
//K15IO0CLR=CLR;
IO0SET = C4;
if(scan(R1))LCDSTR(0x000000CC,"3");//K4if(
scan(R2))LCDSTR(0x000000CC,"7");//
K8if(scan(R3))LCDSTR(0x000000CC,"B");//
K12if(scan(R4))LCDSTR(0x000000CC,"F");//
K16

53
}
}

INTERFACING OF STEPPER MOTOR

AIM:
To write and execute the program for Stepper Motor with ARM 7(LPC2148) processor.

HARDWARE & SOFTWARE TOOLS REQUIRED:

S. No Hardware&SoftwareRequirements Quantity

1 ARMProcessorboard 1
2 USB/FRCConnector few
3 StepperMotorModule 1
4 PowerSupplyadaptor(5V,DC) 1
5 Keil&flashmagicSoftware 1

PROCEDURE

1. CreateaNewproject,Goto“Project”andclosethecurrentproject“CloseProject”.
2. NextGototheProjectNewμvisionProjectCreateNewProjectSelectDeviceforTarget.
3. SelectthedatabaseNXPLPC2148.
4. AddStartupfileandNextgoto“File”andclick“New”.
5. Writeaprogramontheeditorwindowandsaveas“Main.c”.
i) AddthissourcefiletoGroupandclickon “BuildTarget”orF7.
ii) CreateaHexfilefrom “Project”menuandclickon“RebuildalltargetFiles”.
iii) Open Flash magic and select the device LPC2148 in ARM 7 category, COM port will beCOM
3, baud rate 9600, interface None [ISP], Oscillator frequency 12.0 MHz and click onerase
offlashcodeRd plot.
iv) Nextbrowsethepathofhexfileandselectthefile.
54
v) AfterselectingISPmodeontheHardwareKitandclickonstart thendevicewillstart toprogram
vi) Finallycanbeseethefinished indicationandvalues inSPJTerminalandReset thedevice intorunning
mode.

STEPPERMOTOR:(FORWARDROTATION)CIRCUITDIAGRAM:

PROGRAM:
#include
<lpc214x.h>#include<
delay.h>

intmain()
55
{IODIR0=(1<<16)|(1<<17)|(1<<18)|(1<<19)
;
while(1)
{
//FORWARD

DIRECTIONIOCLR0=(1<
<16);IOCLR0=(1<<17);IOS
ET0=(1<<18);

IOSET0=(1<<19);
delay_ms(10);IOC
LR0=(1<<16);IOS
ET0=(1<<17);IOS
ET0=(1<<18);IOC
LR0=(1<<19);
delay_ms(10);IOS
ET0=(1<<16);IOS
ET0=(1<<17);IOC
LR0=(1<<18);IOC
LR0=(1<<19);
delay_ms(10);IOS
ET0=(1<<16);IOC
LR0=(1<<17);IOC
LR0=(1<<18);IOS
ET0=(1<<19);
delay_ms(10); }
}

STEPPERMOTOR:(REVERSEROTATION)CIRCUITDIAGRAM:

56
PROGRAM:
#include
<lpc214x.h>#include
<delay.h>

intmain()

{IODIR0=(1<<16)|(1<<17)|(1<<18)|(1<<19)
;
while(1)
{
//REVERSE
DIRECTIONIOSET0=(1<
<16);IOCLR0=(1<<17);I
OCLR0=(1<<18);IOSET0
=(1<<19);
delay_ms(10);IOS
ET0=(1<<16);IOS
ET0=(1<<17);IOC
LR0=(1<<18);IOC
LR0=(1<<19);
delay_ms(10);IOC
LR0=(1<<16);IOS
ET0=(1<<17);IOS
ET0=(1<<18);IOC
LR0=(1<<19);
delay_ms(10);IOC
LR0=(1<<16);IOC
LR0=(1<<17);IOS
ET0=(1<<18);IOS
ET0=(1<<19);
delay_ms(10);
}
}

57
RESULT:

58
Thus ARM Processor program for programming using Interfacing keyboard and stepper motor
was executed successfully.

59
‘’..

……

60
MINI PROJECT

61
62
PROJECT TITLE
Smart door lock system system
using Arduino

Submitted by
M. Sathish (511522106040)
K. Rohith (511522106034)
V. Prakash (511522106030)
E. Tamilvasanthan (511522106047)

Under Supervision of:


Dr.S. YOGEESWARAN., AP/ECE

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

P.T.Lee. CHENGALVARAYA NAICKER COLLEGE OF


ENGINEERING &TECHNOLOGY
Oovery, Kanchipuram-631502

63
64
TABLE OF CONTENT

S. NO CONTENT

1. Abstract

2. Introductions

3. Existing system

4. Proposed system

5. Main block diagram

6. Working principle

7. Coding block

8. Advantages, Disadvantages &


Application
9. Future works

10. Output & Result

11. Conclusion

12. references

65
ABSTRACT

66
This project presents a Smart Door Lock System using Arduino
UNO, designed to enhance security through electronic access.
The system uses a 4x4 matrix keypad for entering a secure
password, a servo motor to control the door’s lock mechanism, a buzzer
for alert signals, and a 16x2 LCD to display status messages.
It is a standalone, non-WiFi-based solution ideal for home, lab,
and office security.

67
INTRODUCTION

68
 In the modern era, security plays a crucial role in both domestic and
industrial applications.
 Traditional lock and key systems are vulnerable to duplication and
tampering.
 The proposed Smart Door Lock System aims to overcome these
limitations by introducing a password-protected entry mechanism
using microcontroller-based automation.
 The project is built entirely on Arduino UNO, making it cost-
effective, simple, and efficient.

69
70
EXISTING SYSTEM

 Traditional systems such as mechanical locks


or RFID cards provide basic security but are
prone to duplication or require additional
hardware.
 Biometric systems are secure but expensive
and complex.
 The existing solutions are either outdated or
unaffordable for small-scale applications.

71
PROPOSED SYSTEM

72
The proposed system offers an electronic smart lock based on password
input. It includes:
 Arduino UNO (controller)
 4x4 Matrix Keypad (user input)
 Servo Motor (mechanical locking)
 Buzzer (alerts)
 16x2 LCD (display status)
The user enters a password via the keypad. The system checks it and
either unlocks the door (with servo rotation and feedback) or alerts an
incorrect attempt. This ensures that only authorized users can access
the door.

73
74
Main Block Diagram

Blocks:
 Keypad (Input)
 Arduino UNO (Processing)
 LCD (Output)
 Buzzer (Output)
 Servo Motor (Output)

75
WORKING PRINCIPLE

76
1. LCD shows “Enter Password”
2. User enters password using keypad
3. On pressing ‘#’, password is verified
4. If matched:
 LCD shows “Access Granted”
 Buzzer gives short beep
 Servo rotates 90° to unlock
 After 5 seconds, re-locks

5.f wrong:
 LCD shows “Access Denied”
 Buzzer gives long beep

77
CODING BLOCK

78
#include <Wire.h> #include <LiquidCrystal_I2C.h> #include
<Keypad.h> #include <Servo.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); Servo lockServo;
Const byte ROWS = 4; const byte COLS = 4; char keys[ROWS][COLS]
= { {‘1’,’2’,’3’,’A’}, {‘4’,’5’,’6’,’B’}, {‘7’,’8’,’9’,’C’}, {‘*’,’0’,’#’,’D’}
}; byte rowPins[ROWS] = {9, 8, 7, 6}; byte colPins[COLS] = {5, 4, 3,
2};
Keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS,
COLS);
String password = “1234”; String input = “”; int buzzer = 11;
Void setup() { lcd.init(); lcd.backlight(); lcd.setCursor(0,0);
lcd.print(“Smart Door Lock”); delay(2000); lcd.clear(); lcd.print(“Enter
Password:”);

lockServo.attach(10); lockServo.write(0); pinMode(buzzer, OUTPUT); }

void loop() { char key = keypad.getKey(); if (key) { if (key == ‘#’)


{ lcd.clear(); if (input == password) { lcd.print(“Access Granted”);
digitalWrite(buzzer, HIGH); delay(200); digitalWrite(buzzer, LOW);
lockServo.write(90); delay(5000); lockServo.write(0); } else
{ lcd.print(“Access Denied”); digitalWrite(buzzer, HIGH); delay(1000);
digitalWrite(buzzer, LOW); } delay(2000); lcd.clear(); lcd.print(“Enter
Password:”); input = “”; } else { input += key; lcd.setCursor(0, 1); for
(int I = 0; I < input.length(); i++) { lcd.print(‘*’); } } } }

79
80
ADVANTAGES, DISADVANTAGES &
APPLICATION

Advantages:

 No internet dependency
 Cost-effective and easy to implement
 LCD provides better user interaction
 High customization of passwords

Disadvantages:

 Limited to preset password


 No remote access
 Password visible during entry unless masked

81
Applications:

82
 Home doors
 College labs
 Office cabins
 Server rooms
 Secure storage units

Here is the application where the smart doors are used.


Thus it’s most useful system in this generation.
Thus we have to secure our thinks by automatically
closed the door.

83
FUTURE WORKS:

84
 Add fingerprint/RFID module
 Integrate SMS alert using GSM
 Store access logs in SD card
 Add real-time clock for access timestamps

Here is the future scope for smart door. We maintain the


system by various technique.
Thus the technic are given above for our fast generation.

85
Output

86
Here I kept a code with output. After the entering the password in should
open and also it give the range.

Here, the hardware simulated output is given and it in on condition and also
clearly give the circuit connection.

87
CONCLUSION:

88
 The Smart Door Lock System using Arduino UNO provides a
simple, secure, and affordable access control solution.
 It enhances safety with minimal hardware and coding
complexity.
 The use of an LCD ensures better feedback and user
experience.

Here I concluded the project of smart door lock system.

89
REFERENCES:

90
 www.arduino.cc
 Instructables Arduino Projects
 CircuitDigest Tutorials
 Embedded Systems by Raj Kamal

91

You might also like