Doc-A.15-Automation of Electrical Appliances

Embed Size (px)

Citation preview

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    1/25

    CHAPTER 1

    INTRODUCTION

    1.1 MICROCONTROLLER

    A microcontroller(sometimes abbreviated C, uCor MCU) is a small computer on a single

    integrated circuitcontaining a processor core, memory, and programmable input/output

    peripherals. Program memory in the form ofNOR flashor OTP ROMis also often included on

    chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded

    applications, in contrast to the microprocessorsused inpersonal computersor other general

    purpose applications.Microcontrollers are used in automatically controlled products and devices,

    such as automobile engine control systems, implantable medical devices, remote controls, office

    machines, appliances, power tools, and toys. By reducing the size and cost compared to a design

    that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it

    economical to digitally control even more devices and processes. Mixed signal microcontrollers

    are common, integrating analog components needed to control non-digital electronic

    systems.Some microcontrollers may use four-bit words and operate at clock ratefrequencies as

    low as 4 kHz, for low power consumption (milliwatts or microwatts). They will generally have

    the ability to retain functionality while waiting for an event such as a button press or other

    interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just

    nanowatts, making many of them well suited for long lasting battery applications. Other

    microcontrollers may serve performance-critical roles, where they may need to act more like a

    digital signal processor(DSP), with higher clock speeds and power consumption.Amicrocontroller is a programmable device that can read inputs from external devices, analyze the

    input, and then output control signals to external devices. There is a whole range of both analog

    and digital devices that serve a wide variety of purposes. Simple devices like pushbuttons,

    switches, keypads, temperature and humidity sensors, lights, buzzers, speakers, LCD displays,

    servo motors and stepper motors. More complex devices include motion sensors, accelerometers,

    1

    http://en.wikipedia.org/wiki/Integrated_circuithttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Flash_memory#NOR_flashhttp://en.wikipedia.org/wiki/Programmable_read-only_memoryhttp://en.wikipedia.org/wiki/Random-access_memoryhttp://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Clock_ratehttp://en.wikipedia.org/wiki/Digital_signal_processorhttp://en.wikipedia.org/wiki/Digital_signal_processorhttp://en.wikipedia.org/wiki/Clock_ratehttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Random-access_memoryhttp://en.wikipedia.org/wiki/Programmable_read-only_memoryhttp://en.wikipedia.org/wiki/Flash_memory#NOR_flashhttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Integrated_circuit
  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    2/25

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    3/25

    NEC V850(32-bit)

    PIC(8-bit PIC16, PIC18, 16-bit dsPIC33 / PIC24)

    PowerPCISE

    PSoC (Programmable System-on-Chip)

    Rabbit 2000(8-bit)

    Texas Instruments MicrocontrollersMSP430(16-bit), C2000 (32-bit), and Stellaris (32-

    bit)

    Toshiba TLCS-870(8-bit/16-bit)

    XMOSXCore XS1(32-bit)

    Zilog eZ8(16-bit), eZ80(8-bit)

    1.3 FEATURES

    The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited

    to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and

    Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051

    models often have a different form factor, and are not "drop-in compatible". All these things are

    called 8051 because they can all be programmed using 8051 assembly language, and they all

    share certain features (although the different models all have their own special features).

    Some of the features that have made the 8051 popular are:

    64 KB on chip program memory.

    128 bytes on chip data memory(RAM).

    4 reg banks.

    128 user defined software flags.

    8-bit data bus

    16-bit address bus

    32 general purpose registers each of 8 bits

    16 bit timers (usually 2, but may have more, or less).

    3

    http://en.wikipedia.org/wiki/V850http://en.wikipedia.org/wiki/PIC_microcontrollerhttp://en.wikipedia.org/wiki/PowerPChttp://en.wikipedia.org/wiki/PSoChttp://en.wikipedia.org/wiki/Rabbit_2000http://en.wikipedia.org/wiki/Texas_Instruments#Microcontrollershttp://en.wikipedia.org/wiki/TI_MSP430http://en.wikipedia.org/wiki/Toshiba_TLCShttp://en.wikipedia.org/wiki/XMOShttp://en.wikipedia.org/wiki/XCore_XS1http://en.wikipedia.org/wiki/Zilog_Z8http://en.wikipedia.org/wiki/EZ80http://en.wikipedia.org/wiki/EZ80http://en.wikipedia.org/wiki/Zilog_Z8http://en.wikipedia.org/wiki/XCore_XS1http://en.wikipedia.org/wiki/XMOShttp://en.wikipedia.org/wiki/Toshiba_TLCShttp://en.wikipedia.org/wiki/TI_MSP430http://en.wikipedia.org/wiki/Texas_Instruments#Microcontrollershttp://en.wikipedia.org/wiki/Rabbit_2000http://en.wikipedia.org/wiki/PSoChttp://en.wikipedia.org/wiki/PowerPChttp://en.wikipedia.org/wiki/PIC_microcontrollerhttp://en.wikipedia.org/wiki/V850
  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    4/25

    3 internal and 2 external interrupts.

    Bit as well as byte addressable RAM area of 16 bytes.

    Four 8-bit ports, (short models have two 8-bit ports).

    16-bit program counter and data pointer.

    1 Microsecond instruction cycle with 12 MHz Crystal.

    8051 models may also have a number of special, model-specific features, such as UARTs, ADC,

    OpAmps, etc

    4

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    5/25

    CHAPTER 2

    MICROCONTROLLER AT89C51

    2.1 MICROCONTROLLER AT89C51

    Fig 2.1 Diagram showing microcontroller AT89c51

    The AT89C51is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of

    Flashprogrammable and erasable read only memory (PEROM). The device is manufactured

    using Atmels high-denity nonvolatile memory technology and is compatible with the industry-

    standard MCS-51 instruction set and pinout. The on-chip Flashallows the program memory to

    be reprogrammed in-system or by a conven- tional nonvolatile memory programmer. By

    combining a versatile 8-bit CPU with Flashon a monolithic chip, the Atmel AT89C51is apowerful microcomputer which provides a highly-flexible and cost-effective solution to many

    embedded control applications.

    5

    http://www.datasheetdir.com/Flashhttp://www.datasheetdir.com/Flashhttp://www.datasheetdir.com/Flashhttp://www.datasheetdir.com/Flashhttp://www.datasheetdir.com/Flashhttp://www.datasheetdir.com/Flash
  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    6/25

    2.2 COMPARISION BETWEEN MICROCONTROLLER 8051

    AND AT89C51

    The main difference between them lies in the following points:

    Pin function: Pins almost identical changes were, in the AT89S51 in P1.5, P1.6, P1.7 have a

    second function, that is, the second 3-pin serial ISP function formed programming interface.

    Programmability: AT89C51 only supports parallel programming, But AT89S51 supports both

    parallel programming and ISP programming.

    Voltage in the programming area, AT89C51 in addition to normal programming voltage of 5V,

    another 12v is needed for Vpp. But AT89S51 just need to be 4-5V.

    Endurance: AT89C51 flash memory can be programmed upto 1000 times while the AT89S51

    can be programmed from 1000-10000 times, so that the learner repeated the beginning of a more

    favorable programmer, reducing learning costs.

    Frequency: AT89C51 limits the operating frequency is 24MHZ, and AT89S51 maximum

    operating frequency is 33MHZ, (AT89S51 chip in two models, to support the maximum

    operating frequency of 24MHZ and 33MHZ) in order to have a faster computing speed.

    Power Supply: AT89S51 operating voltage range is up to 4-5.5V, while the AT89C51 at the end

    of the 4.8V and 5.3V.

    Anti-jamming more: AT89S51 has integrated watchdog timer (Watchdog Timer), and

    AT89C51 needs an external watchdog timer circuit, or single-chip software constitute the

    internal watchdog timer to achieve anti-jamming software.

    6

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    7/25

    CHAPTER 3

    FEATURES OF MICROCONTROLLER

    3.1 BASIC FEATURES OF AT89C51

    4K Bytes of Re-programmable Flash Memory.

    RAM is 128 bytes.

    2.7V to 6V Operating Range.

    Fully Static Operation: 0 Hz to 24 MHz.

    Two-level Program Memory Lock.

    128 x 8-bit Internal RAM.

    32 Programmable I/O Lines.

    Two 16-bit Timer/Counters.

    Six Interrupt Sources.

    Programmable Serial UART Channel.

    7

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    8/25

    CHAPTER 4

    PIN CONFIGURATION

    4.1 PIN DESCRIPTION OF AT89C51

    The AT89C51 is a low-voltage, high-performance CMOS 8-bit microcomputer with 4K bytes of

    Flash programmable memory. The device is manufactured using Atmels high-density

    nonvolatile memory technology and is compatible with the industry-standard MCS-51

    instruction set. 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 embedded control applications.In addition, the AT89C51 is designed with static

    logic for operation down to zero frequency and supports two software selectable power saving

    modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and

    interrupt system to continue functioning. The power-down mode saves the RAM contents but

    freezes the oscillator disabling all other chip functions until the next hardware reset.

    8

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    9/25

    4.1.1Pin Diagram

    Fig 4.1 pin digram of AT89c51

    9

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    10/25

    4.2.1. Pin Description

    Vcc

    Pin 40 provides supply voltage to the chip. The voltage source is +5V.

    GND

    Pin 20 is the ground.

    XTAL1 and XTAL2

    XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that

    can be configured for use as an on-chip oscillator, as shown in Figure 11. Either a quartz crystal

    or ceramic resonator may be used. To drive the device from an external clock source, XTAL2

    should be left unconnected while XTAL1 is driven, as shown in the below figure. There are no

    requirements on the duty cycle of the external clock signal, since the input to the internal

    clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high

    and low timespecifications must be observed

    10

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    11/25

    Fig 4.2 Oscillator Connections

    C1, C2 = 30 pF 10 pF for Crystals

    = 40 pF 10 pF for Ceramic Resonators

    11

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    12/25

    Fig 4.3External Clock Drive Configuration

    RESET

    Pin9 is the reset pin. It is an input and is active high. Upon applying a high pulse to this pin, the

    microcontroller will reset and terminate all the activities. This is often referred to as a power-on

    reset.

    EA (External access)

    Pin 31 is EA. It is an active low signal. It is an input pin and must be connected to either Vcc or

    GND but it cannot be left unconnected. The 8051 family members all come with on-chip ROM

    to store programs. In such cases, the EA pin is connected to Vcc. If the code is stored on an

    12

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    13/25

    external ROM, the EA pin must be connected to GND to indicate that the code is stored

    externally.

    PSEN (Program store enable)

    This is an output pin.

    ALE (Address latch enable)

    This is an output pin and is active high.

    Ports 0, 1, 2 and 3

    The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports upon

    RESET are configured as input, since P0-P3 have value FFH on them.

    Port 0(P0)

    Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. ALE

    indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when ALE=1, it

    has address A0-A7. Therefore, ALE is used for demultiplexing address and data with the help of

    an internal latch.

    When there is no external memory connection, the pins of P0 must be connected to a 10K-ohm

    pull-up resistor. This is due to the fact that P0 is an open drain. With external pull-up resistors

    connected to P0, it can be used as a simple I/O, just like P1 and P2. But the ports P1, P2 and P3

    do not need any pull-up resistors since they already have pull-up resistors internally. Upon reset,

    ports P1, P2 and P3 are configured as input ports.

    13

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    14/25

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    15/25

    Machine cycle for the 8051

    The CPU takes a certain number of clock cycles to execute an instruction. In the 8051

    family, these clock cycles are referred to as machine cycles. The length of the machine cycle

    depends on the frequency of the crystal oscillator. The crystal oscillator, along with on-chip

    circuitry, provides the clock source for the 8051 CPU. The frequency can vary from 4 MHz to 30

    MHz, depending upon the chip rating and manufacturer. But the exact frequency of 11.0592

    MHz crystal oscillator is used to make the 8051 based system compatible with the serial port of

    the IBM PC.In the original version of 8051, one machine cycle lasts 12 oscillator periods.

    Therefore, to calculate the machine cycle for the 8051, the calculation is made as 1/12 of the

    crystal frequency and its inverse is taken.The assembly language program is written and this

    program has to be dumped into the microcontroller for the hardware kit to function according to

    the software. The program dumped in the microcontroller is stored in the Flash memory in the

    microcontroller. Before that, this Flash memory has to be programmed .

    CHAPTER 5

    15

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    16/25

    APPLICATIONS

    5.1 APPLICATIONS

    Microcontrollers may be classified into those for control applications and those for

    embedded applications. A microcontroller is used inside a system, such as an

    automobile, PC, air conditioner, video recorder, mobile telephone, TV, or electronic rice

    cooker (in other words, it is used embedded into a system). Practically the only people

    who carefully look at microcontrollers are those who actually make them and hobbyists.

    Microcontrollers for control or embedded applications have functions reinforced for

    embedded applications or are especially designed to be easy to use with such

    applications.Microcomputers can be classified into microprocessors called MPU or CPU

    and microcontrollers called MCU.

    Data is input into a computer that processes (calculates) the data and outputs the result.

    A microprocessor isintended to process the data and therefore consists mainly of CPU

    functions. Examples of functions that constitute a computer are shown below. Recent

    microprocessors integrate not only CPU functions but also functions gathered at the

    center and surrounded by a dark cream color. Some have even functions surrounded by a

    light cream color, such as ports, and A/D and D/A converters. Many microprocessors,

    however, require the connection of an external ROM that stores instructions.

    A microcontroller (MCU) has an internal ROM, so it can operate even with a single LSI

    by writing instructions to this internal ROM, thus allowing a more compact system to be

    organized.

    16

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    17/25

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    18/25

    Information of a switch is usually 1 bit. This means that a microcontroller for a control

    application must be able to process 1-bit information efficiently. Because physical

    quantities in the natural world are analog variables, the output signals of a sensor are

    analog signals. An A/D converter is necessary to use these signals. Some of the output

    signals of a microcontroller for control applications are 1-bit to perform an ON/OFF

    control action such as to illuminate or extinguish a light, some are analog signals that

    control brightness, issue sounds, or control DC motor, while the others are signals that

    drive an actuator such as a motor or, in some cases, a display unit such as an LCD or

    fluorescent indicator panel. Microcontrollers are therefore required to have output

    functions for supporting these signals.

    To use a microcontroller in a mobile system, it is necessary that the system be organized

    to be compact. In addition, low-voltage operations and low power consumption are

    important factors.

    Microcontrollers for control or embedded applications therefore have functions suitable

    for various purposes, by providing particular features.

    18

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    19/25

    CHAPTER 6

    SIMULATION

    6.1 SOFTWARE USEDWe have used two softwares,namelyproteus and keiluvision .In order to get the

    simulation

    Proteus* is a software technology that allows creating clinical executable decision support

    guidelines with little effort.Proteusis software for microprocessorsimulation, schematic

    capture, andprinted circuit board(PCB) design. It is developed by

    LabcenterElectronics.TheXGameStationMicro Edition was designed using Labcenter's Proteus

    schematic entryand PCB layout tools.[

    KEIL COMPILER:Keil compiler is a software used where the machine language code is

    written and compiled. After compilation, the machine source code is converted into hex code

    which is to be dumped into the microcontroller for further processing. Keil compiler also

    supports C language code.

    PROLOAD:Proload is a software which accepts only hex files. Once the machine code is

    converted into hex code, that hex code has to be dumped into the microcontroller and this is done

    by the Proload. Proload is a programmer which itself contains a microcontroller in it other than

    the one which is to be programmed. This microcontroller has a program in it written in such a

    way that it accepts the hex file from the keil compiler and dumps this hex file into the

    microcontroller which is to be programmed. As the proload programmer kit requires power

    supply to be operated, this power supply is given from the power supply circuit designed above.

    It should be noted that this programmer kit contains a power supply section in the board itself but

    in order to switch on that power supply, a source is required. Thus this is accomplished from the

    power supply board with an output of 12volts.Keil C51 is the industry-standard toolchain for all

    8051-compatible devices, it supports classic 8051, Dallas 390, NXP MX, extended 8051variants.

    19

    http://en.wikipedia.org/wiki/Microprocessorhttp://en.wikipedia.org/wiki/Printed_circuit_boardhttp://en.wikipedia.org/w/index.php?title=Labcenter_Electronics&action=edit&redlink=1http://en.wikipedia.org/wiki/XGameStationhttp://en.wikipedia.org/wiki/Schematic_capturehttp://en.wikipedia.org/wiki/Proteus_(design_software)#cite_note-0http://en.wikipedia.org/wiki/Proteus_(design_software)#cite_note-0http://en.wikipedia.org/wiki/Schematic_capturehttp://en.wikipedia.org/wiki/XGameStationhttp://en.wikipedia.org/w/index.php?title=Labcenter_Electronics&action=edit&redlink=1http://en.wikipedia.org/wiki/Printed_circuit_boardhttp://en.wikipedia.org/wiki/Microprocessor
  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    20/25

    6.2 PROGRAM DEVELOPED IN KEIL UVISION

    #include

    #include

    void delay();

    void main()

    {

    unsigned char mybyte;

    P1=0x00;

    TMOD=0x20;

    TH1=0xFd;

    TR1=1;

    SCON=0x52;

    printf("\n\tchoose any number \n 1:>-light \n 2:>-Fan \n 3:>light & Fan \n 4:>music sytem \n

    5:>Music system & light \n 6:>musicsystem&fan \n 7:>All three");

    printf("\n 0:>Off all applns");

    while(1)

    {

    SCON=0x51;

    while(RI==0);

    mybyte=SBUF-0x30;

    P1=mybyte;

    RI=0;

    }

    }

    void delay()

    20

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    21/25

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    22/25

    6.3 WORKING PROCEDURE

    The project mainly focuses on taking the respective commands and thus displaying the required

    output .here, we use microcontroller at89c51 to do all the commands.the program is built in

    software kiel using the preload operation profram is dumped into the microcontroller thus

    using that microcontroller ,we can input the options and get the desired outputs respectively

    .here,we use basic electrical appliances like light (using leds) ,fan (opto coupler) etc.The inbuilt

    program helps us in getting the respective results

    6.4 SIMULATION CIRCUIT

    Fig 6.1 simulation circuit

    22

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    23/25

    CHAPTER 7

    CONCLUSION AND SCOPE FOR FUTURE

    ENHANCEMENTS

    7.1 CONCLUSION

    AUTOMATION OF ELECTRICAL APPLIANCES is made apt by getting the output

    ,wherein the inputs are being controlled by the microcontroller AT89C51.The software and

    hardware circuits have been designed and desired outputs have been obtained.

    7.2 SCOPE FOR FUTURE ENHANCEMENTS

    The microcontroller can be further developed by using developed version of atmel AT89c51 and

    the interfacing of the devices can be done by using more number of devices .In addition to the

    microcontroller ,another component can be further be used to develop the project. The present

    invention relates to a method for improving the precision and reliability of the heating control for

    an anesthetic machine circuit, which is applicable for the heating control of devices involved in

    medical diagnosis, and more particularly for the temperature monitoring and control on the

    circuit heating part in an anesthetic machine or ventilator.

    23

  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    24/25

    REFERENCES

    WEBSITES:

    www.robots.com

    www.zbasic.net

    www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.p

    en.wikipedia.org/wiki/Microcontroller

    www.atmel.com/atmel/acrobat/doc0265.pdf

    www.parallax.com/dl/docs/article/siuapplicationmicros.pdf

    www.icpartno.com/ic_2011-2-21/AT89C51-20JC/

    www.alldatasheet.com/view.jsp?Searchword=AT89C51

    BOOKS:

    NEWEasy Step'n, David Benson

    Parallel Port Complete, Jan Axelson

    PIC'n up the PACE, PIC Microcontroller Applications Guide, David Benson.

    PIC'n Techniques, PIC Microcontroller Applications Guide, David Benson.

    Serial PIC'n, PIC Microcontroller Serial Communications, Roger L. Stevens

    24

    http://www.robots.com/http://www.zbasic.net/http://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.phttp://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.phttp://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.phttp://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.phttp://www.atmel.com/atmel/acrobat/doc0265.pdfhttp://www.icpartno.com/ic_2011-2-21/AT89C51-20JC/http://www.icpartno.com/ic_2011-2-21/AT89C51-20JC/http://www.icpartno.com/ic_2011-2-21/AT89C51-20JC/http://www.rentron.com/books.htm#stepnhttp://www.rentron.com/books.htm#parallelhttp://www.rentron.com/books.htm#book4http://www.rentron.com/books.htm#book5http://www.rentron.com/books.htm#book6http://www.rentron.com/books.htm#book6http://www.rentron.com/books.htm#book5http://www.rentron.com/books.htm#book4http://www.rentron.com/books.htm#parallelhttp://www.rentron.com/books.htm#stepnhttp://www.icpartno.com/ic_2011-2-21/AT89C51-20JC/http://www.atmel.com/atmel/acrobat/doc0265.pdfhttp://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.phttp://www.zbasic.net/http://www.robots.com/
  • 8/10/2019 Doc-A.15-Automation of Electrical Appliances

    25/25

    APPENDIX

    INTEGRATED

    INTEGRATED

    25