automatic college bell report

40
Microcontroller Based Automatic College Bell Students name 1) 2) 3) 4)

Upload: nagraj-tondchore

Post on 07-Dec-2015

226 views

Category:

Documents


1 download

DESCRIPTION

AUTOMATIC COLLAGE BELL DOC

TRANSCRIPT

Page 1: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Students name

1)

2)

3)

4)

INDEX

Page 2: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

INTRODUCTION OF PROJECT

Page 3: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

INTRODUCTION OF PROJECT

This Project takes over the task of Ringing of the Bell in Colleges.

It replaces the Manual Switching of the Bell in the College. It has an Real Time Clock

(DS1307) which tracks over the Real Time. When this time equals to the Bell Ringing time,

then the Relay for the Bell is switched on. Time Clock is displayed on LCD display. The

Microcontroller AT89c51 is used to control all the Functions. When the Real time and Bell

time get equal then the Bell is switched on for a predetermined time.

This project can be used in the exam mode where user can set the exam

start time and exam end time. The display will show the exam started and when exam time

over it will show the exam end and buzzer will ring for indication.

The implementation of this automatic college bell would be advantageous since it keeps

manual work away i.e. there is no requirement of any labour, it runs automatically.

Page 4: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

BLOCK DIAGRAM:

Micro

Controller

Real Time Clock

Buzzer Driver

LCD Display

Signal Conditioning

RECEIVER

Buzzer

Temp Sensor

RECEIVER

Power Supply

Keypad

RECEIVER

Page 5: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

MICROCONTROLLER P89V51RD2:

The P89V51RD2 is a low-power, high-performance CMOS 8-bit microcomputer with 64

Kbytes of Flash Programmable and Erasable Read Only Memory (PEROM). The device is

manufactured using Atmel’s high density non-volatile memory technology and is compatible

with the industry standard MCS-51 instruction set and pin out.

 The on-chip Flash allows the program memory to be reprogrammed in-system or by a

conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with

Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which

provides a highly flexible and cost effective solution to many applications.

DS1307:

The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD)

clock/calendar plus 56 bytes of NV SRAM. The clock/calendar provides seconds, minutes,

hours, day, date, month, and year information. The end of the month date is automatically

adjusted for months with fewer than 31 days, including corrections for leap year. The clock

operates in either the 24-hour or 12-hour format with AM/PM indicator. The DS1307 has a

built-in power-sense circuit that detects power failures and automatically switches to the

backup supply. Timekeeping operation continues while the part operates from the backup

supply

LCD Display:

It will display the time, date as well as current room temperature. Output of microcontroller

is applied to the LCD display.

Buzzer & Buzzer driver:

Output of microcontroller is applied to buzzer driver which drives buzzer after lecture.

Power Supply

There are many types of power supply. Most are designed to convert high voltage AC mains

electricity to a suitable DC voltage supply for electronic circuits and other devices. A power

supply can by broken down into a series of blocks, each of which performs a particular

function.

Page 6: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

A 5V regulated supply

.

Each of the blocks is described in more detail below:

Transformer - steps down high voltage AC mains to low voltage AC.

Rectifier - converts AC to DC, but the DC output is varying.

Smoothing - smoothes the DC from varying greatly to a small ripple.

Regulator - eliminates ripple by setting DC output to a fixed voltage.

Bridge rectifier

A bridge rectifier can be made using four individual diodes, but it is also available in special

packages containing the four diodes required. It is called a full-wave rectifier because it uses

all the AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier

because each diode uses 0.7V when conducting and there are always two diodes conducting,

as shown in the diagram below. Bridge rectifiers are rated by the maximum current they can

pass and the maximum reverse voltage they can withstand (this must be at least three times

the supply RMS voltage so the rectifier can withstand the peak voltages

Page 7: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir, supplying current to the output when the varying DC voltage

from the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and

the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying

DC, and then discharges as it supplies current to the output.

Voltage regulator

Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable output

voltages. They are also rated by the maximum current they can pass. Negative voltage

regulators are available, mainly for use in dual supplies. Most regulators include some

automatic protection from excessive current ('overload protection') and overheating ('thermal

protection').

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as

the 7805 +5V 1A regulator shown on the right. They include a hole for attaching a heatsink

if necessary.

Page 8: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

 

Page 9: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Circuit Diagram & Description

Circuit Diagram:

Page 10: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Microcontroller Section

Power supply Section

Page 11: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Keypad Section

Page 12: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

RTC Interfacing:

Buzzer Driver:

Page 13: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Specification of Components used:

Microcontroller P89V51RD2:

Features

64 KB flash memory

1 KB RAM

32 I/O lines

Page 14: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Programmable counter array

In System Application

Three 16-bit Timer/Counter

Accumulator:

ACC is the accumulator register. It is an 8 bit register. It is most versatile and holds

sources operand and receives the result of arithmetic operations including addition,

subtraction, integer multiplication, division and Boolean bit manipulations.

It is also used for data transfer between 8051 and any external memory. Several functions

like rotate, test etc. apply specifically on the accumulator.

Arithmetic and Logic Unit (ALU):

The ALU can perform arithmetic and logic operations on eight bit data. It can perform

arithmetic operations like addition, subtraction, multiplication, division and logical

operations like AND, OR, EX – OR, complement, rotate etc.

Program Status Word (PSW) and Flags:

Many instructions affect the status of flags. In order to address these flags

conveniently they are grouped to from the program status word. PSW contain Carry flag

( CY) , Auxiliary carry flag ( AC ), User defined Flag 0 (F0 ) , register bank selections

flag (RS0,RS1) Overflow flag( OV ) Parity flag (p) .Flags are 1 bit registers provided to

store the results of some instructions. A Flag is a flip flop that indicates some condition

produced by the execution of an instruction.

Page 15: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

RST:

Reset input. A high on his pin two machine cycles while the oscillator is

running resets the device. This pin drives high for 98 oscillator periods after the Watchdog

times out. The DISRTO bit in SFR AUXR (address 8 EH) can be used to disable this

feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

Program Counter (PC):

It is a 16-bit register. It is used to hold the address of a byte in the

memory. It keeps the track of the execution of the program. The program instruction

bytes are fetched from locations in memory that are addressed by the Program counter.

The Stack and Stack Pointer:

The stack is a reserved area of the memory in RAM where temporary

information may be stored. An 8 – bit stack pointer is used to hold the address of the

most recent stack entry. This location, which has the most recent entry, is called as the

top of the stack.

Special Function Registers:

A map of the on-chip memory area called the Special Function Register

(SFR) space is shown in Table 5-1. Note that not all of the addresses are occupied, and

unoccupied addresses may not be implemented on the chip. Read accesses to these

addresses will in general return random data, and write accesses will have an

indeterminate effect. User software should not write 1s to these unlisted locations, since

they may be used in future products to invoke new features. In that case, the reset or

inactive values of the new bits will always be 0.

Timer 2 Registers: Control and status bits are contained in registers

T2CON (shown in Table 5- 2) and T2MOD (shown in Table 10-2) for Timer 2. The

register pair (RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit

capture mode or 16-bit auto-reload mode. Interrupt Registers: The individual interrupt

enable bits are in the IE register. Two priorities can be set for each of the six interrupt

sources in the IP register.

Page 16: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Input and output ports:

The I/O circuit of microcontroller is totally versatile. It connects

the microcontroller to external world. The microcontroller 89v51 has four i/o ports i.e. 24

lines out of 32 port lines are for one of the two entirely different function so, although

microcontroller is 40 pin chip, it appears to have 64 pins.

As two functions are multiplexed, in order to decide which function is

supported we need to see how the circuit is connected and what software commands are

used to program the pin.

The microcontroller has four ports named as p0, p1, p2, p3. All these ports are bi-

directional.

Liquid Crystal display (LCD):

The three control lines are EN, RS, and RW.

The EN line is called "Enable." This control line is used to tell the LCD that you are sending

it data. To send data to the LCD, your program should make sure this line is low (0) and then

set the other two control lines and/or put data on the data bus. When the other lines are

completely ready, bring EN high (1) and wait for the minimum amount of time required by

the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.

The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a

command or special instruction (such as clear screen, position cursor, etc.). When RS is high

(1), the data being sent is text data which should be displayed on the screen. For example, to

display the letter "T" on the screen you would set RS high.

The RW line is the "Read/Write" control line. When RW is low (0), the information on the

data bus is being written to the LCD. When RW is high (1), the program is effectively

querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command.

All others are write commands--so RW will almost always be low.

Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by

the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3,

DB4, DB5, DB6, and DB7.

Page 17: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Liquid Crystal Display also called as LCD is very helpful in providing user interface as well

as for debugging purpose. The most common type of LCD controller is HITACHI 44780

which provides a simple interface between the controller & an LCD. These LCD's are very

simple to interface with the controller as well as are cost effective.

2x16 Line Alphanumeric LCD Display

The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16

characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty

characters per line). 

The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data

lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines + 3

control lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data lines +

3 control lines i.e. 7 lines are required. How do we decide which mode to use? It’s simple if

you have sufficient data lines you can go for 8 bit mode & if there is a time constrain i.e.

display should be faster then we have to use 8-bit mode because basically 4-bit mode takes

twice as more time as compared to 8-bit mode.

 Pin  Symbol Function

 1  Vss  Ground

 2  Vdd  Supply Voltage

 3  Vo  Contrast Setting

 4  RS  Register Select

 5  R/W  Read/Write Select

 6  En  Chip Enable Signal

Page 18: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

 7-14  DB0-DB7  Data Lines

 15  A/Vee  Gnd for the backlight

 16  K  Vcc for backlight

 

When RS is low (0), the data is to be treated as a command. When RS is high (1), the data

being sent is considered as text data which should be displayed on the screen.

When R/W is low (0), the information on the data bus is being written to the LCD. When RW

is high (1), the program is effectively reading from the LCD. Most of the times there is no

need to read from the LCD so this line can directly be connected to Gnd thus saving one

controller line.

The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW signal is

required to latch the data. The LCD interprets and executes our command at the instant the

EN line is brought low. If you never bring EN low, your instruction will never be executed.

8051 Interfacing to LCD

DS 1307 Real time Clock (RTC):

Page 19: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

The purpose of an RTC or a real time clock is to provide precise time and date which can be

used for various applications. RTC is an electronic device in the form of an Integrated Chip

(IC) available in various packaging options. It is powered by an internal lithium battery.

As a result of which even if the power of the system is turned off, the RTC clock keeps

running. It plays a very important role in the real time systems like digital clock, attendance

system, digital camera etc

While designing any real time system which deals with time, there are two ways of handling

the time factor. One is to generate the time internally which is done by programming the

timers of the controller; and the other is to use an RTC. The following table shows the

comparison of these methods while designing a real time application.

In our project we are going to use DS1307 serial real-time clock (RTC)

The DS1307 is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56

bytes of NV SRAM. The clock/calendar provides seconds, minutes, hours, day, date,

month, and year information. The end of the month date is automatically adjusted for

months with fewer than 31 days, including corrections for leap year. The clock operates in

either the 24-hour or 12-hour format with AM/PM indicator. The DS1307 has a built-in

power-sense circuit that detects power failures and automatically switches to the backup

supply. Timekeeping operation continues while the part operates from the backup supply

Important Features of DS1307

1. Uses BCD format to represent the clock and calendar information

2. Has 56 bytes to store critical information

3. Clock calendar provides seconds, minutes, hours, day, date, month, and year information

Operates in either the 24-hour or 12-hour format with AM/PM indicator

4. Has built-in power sense circuit that detects power failure and automatically switches to

the battery supply

Page 20: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

DS1307 Address Map

Address Map Details

1. Bit 6 of the hours register selects whether the 12-hour or 24-hour mode is used.

2. Bit 5 of the hours register selects whether the current time is AM or PM if 12-hour mode

is selected.

3. DS1307 supports standard mode (100 Kbps) of data transfer.

4. The device address (ID) of the DS1307 is 1101000

DS1307 Control Register

1. Bit 7 controls the output level of the SQWOUT pin when the square output is disabled.

Page 21: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

2. The SQWE bit enables/disables the SQWOUT pin output.

3. Bits 1 and 0 select the output frequency of the SQWOUT pin

Buzzer:

These devices are output transducers converting electrical energy to sound. They contain an

internal oscillator to produce the sound which is set at about 400Hz for buzzers and about

3kHz for bleepers. Buzzers have a voltage rating but it is only approximate, for example 6V

and 12V buzzers can be used with a 9V supply. Their typical current is about 25mA.

Bleepers have wide voltage ranges, such as 3-30V, and they pass a low current of about

10mA. Buzzers and bleepers must be connected the right way round, their red lead is positive

(+).

Buzzer (about 400Hz)

Interfacing RS232:

The Serial Port is harder to interface than the Parallel Port. In most cases, any

Page 22: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

device you connect to the serial port will need the serial transmission converted back to parallel

so that it can be used. This can be done using a UART. On the software side of things, there are

many more registers that you have to attend to than on a Standard Parallel Port. (SPP)

So what are the advantages of using serial data transfer rather than parallel?

1. Serial Cables can be longer than Parallel cables. The serial port transmits a '1' as -3 to -25 volts

and a '0' as +3 to +25 volts where as a parallel port transmits a '0' as 0v and a '1' as 5v. Therefore

the serial port can have a maximum swing of 50V compared to the parallel port which has a

maximum swing of 5 Volts. Therefore cable loss is not going to be as much of a problem for

serial cables than they are for parallel.

2. You don't need as many wires than parallel transmission. If your device needs to be mounted a

far distance away from the computer then 3 core cable (Null Modem Configuration) is going to

be a lot cheaper that running 19 or 25 core cable. However you must take into account the cost

of the interfacing at each end.

Devices which use serial cables for their communication are split into two categories. These

are DCE (Data Communications Equipment) and DTE (Data Terminal Equipment.) Data

Communications Equipment are devices such as your modem, TA adapter, plotter etc while

Data Terminal Equipment is your Computer or Terminal. The electrical specifications of the

serial port are contained in the EIA (Electronics Industry Association) RS232C standard. It

states many parameters such as -

1. A "Space" (logic 0) will be between +3 and +25 Volts.

2. A "Mark" (Logic 1) will be between -3 and -25 Volts.

3. The region between +3 and -3 volts is undefined.

4. An open circuit voltage should never exceed 25 volts. (In Reference to

GND)

5. A short circuit current should not exceed 500mA. The driver should be

able to handle this without damage. (Take note of this one!)

Pin Functions:

Page 23: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Abbreviation Full Name Function

   TD Transmit Data Serial Data Output (TXD)

   RD Receive Data Serial Data Input (RXD)

  CTS Clear to Send This line indicates that the Modem is ready to exchange

data.

  DCD Data Carrier

Detect

When the modem detects a "Carrier" from the modem at

the other end of the phone line, this Line becomes active.

  DSR Data Set

Ready

This tells the UART that the modem is ready to establish

a link.

  DTR Data Terminal

Ready

This is the opposite to DSR. This tells the Modem that

the UART is ready to link.

  RTS Request To

Send

This line informs the Modem that the UART is ready to

exchange data.

  RI Ring Indicator Goes active when modem detects a ringing signal from

the PSTN.

PCB Design Basics:

Page 24: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

PCB Design Layout

In the PCB design of electronics circuit, it is important that one plan and has a checklist of

the do's and don'ts before proceeding to do the printed circuit board layout. The

understanding of the circuit is critical to the design, for example one needs to understand the

maximum current and voltage that are carried by each conductor in order to determine the

track width of the conductor and the type of PCB that will be used.

The voltage difference between each track will determine the clearance between each

conductor. If the clearance is not enough, chances are that the electrical potential between

each track will cause spark over and short circuit the PCB. This will cause functional failure

to the product and the safety of the users that are using the product will be compromised. It is

therefore critical for one to understand some of these basics requirements before one proceed

to design the PCB.

Conductor Thickness and Width

The PCB conductor thickness and width will determine the current carrying capacity of the

track. The IPC standard for the conductor thickness and width of the common 1 oz/square-

feet PCB is as shown below. However, it is always advisable to use a bigger value due to the

tolerance and variation of the PCB processes. If higher current carrying capacity is required,

a 2 oz/square-feet or 3 oz/square-feet type of PCB is preferred. Many electronics hobbyist

prefer to solder a thick cooper conductor on the PCB track to increase the current carrying

capacity of the track.

Page 25: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

LAYERS OF PCB:

*.BOT - bottom copper

*.SMB - Solder mask bottom

*.SST - Silk screen top

*.ASY - Assembly top, contains the board outline

*.DS - drill sizes

Tracks Restricted Area

Tracks should not be located on the areas that can cause them to be peeled off easily. One of

the restricted areas is holes on the PCB which are used to mount screws or PCB spacers.

These holes are usually used to secure the PCB to a casing or to secure it in a fixed place.

The edges of the PCB should not have any tracks as these areas are usually used to transport

the PCB from one process to another process by using a conveyor belt. These edges are

places where the possibility of scratches and cracking of the PCB happens. The

Page 26: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

recommended areas that should not have any track is as shown in the diagram below

assuming a hole diameter of 4 mm which is used to mount a PCB spacer.

First a few safety precautions:

Never touch the element or tip of the soldering iron.

They are very hot (about 400°C) and will give you a nasty burn.

Take great care to avoid touching the mains flex with the tip of the iron.

The iron should have a heatproof flex for extra protection. An ordinary plastic flex

will melt immediately if touched by a hot iron and there is a serious risk of burns and

electric shock.

Always return the soldering iron to its stand when not in use.

Never put it down on your workbench, even for a moment!

Work in a well-ventilated area.

The smoke formed as you melt solder is mostly from the flux and quite irritating.

Avoid breathing it by keeping you head to the side of, not above, your work.

Wash your hands after using solder.

Solder contains lead which is a poisonous metal.

Preparing the soldering iron:

Place the soldering iron in its stand and plug in.

The iron will take a few minutes to reach its operating temperature of about 400°C.

Dampen the sponge in the stand.

The best way to do this is to lift it out the stand and hold it under a cold tap for a

moment, then squeeze to remove excess water. It should be damp, not dripping wet.

Wait a few minutes for the soldering iron to warm up.

You can check if it is ready by trying to melt a little solder on the tip.

Wipe the tip of the iron on the damp sponge.

This will clean the tip.

Melt a little solder on the tip of the iron.

This is called 'tinning' and it will help the heat to flow from the iron's tip to the joint.

Page 27: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

It only needs to be done when you plug in the iron, and occasionally while soldering

if you need to wipe the tip clean on the sponge.

Program Burning Into Microcontroller:

Page 28: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

PCB LAYOUT:

Microcontroller with LCD

Power Supply:

Page 29: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Keypad:

Buzzer Driver:

Page 30: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

Applications:

This system can be used in colleges for regular lecture bell.

It can be also used in institutes, coaching classes etc

This project can be used in companies after some modifications

Advantages:

There is no requirement of any labour, it runs automatically & decreases dependability on

human.

The chances of errors are less compared to manual system.

Future Scope:

Wireless technology can be used for further advancements

Time table can be displayed after some modifications

REFERENCE BOOKS:-

The 8051 microcontroller :- Kenneth Ayala

The 8051 microcontroller and Embedded systems :- Muhammad Ali Mazidi

WEB-SITES:-

www.alldatasheets.com

www.datasheetarchieve.com

www.atmel.com

Page 31: Automatic College Bell REPORT

Microcontroller Based Automatic College Bell

DATASHEETS