Vous êtes sur la page 1sur 56

Temperature Monitoring Robot Abstract

A robot is a mechanical or virtual artificial agent. In practice, it is usually an electromechanical system which, by its appearance or movements, conveys a sense that it has intent or agency of its own. The word robot can refer to both physical robots

and virtual software agents, but the latter are usually referred to as Robots There is no consensus on which machines qualify as robots, but there is general agreement among experts and the public that robots tend to do some or all of the following: move around, operate a mechanical arm, sense and manipulate their environment, and exhibit intelligent behavior, especially behavior which mimics humans or animals. Micro controller controls the robot in this project. This robot can measure the temperature at various locations. IR sensors are placed at the front for the obstacle detection. LCD is used for display. L293d is used as a driver IC for controlling the DC Motors.

This prototype project is basically helpful in places like where there is a necessary of measuring high temperatures like industries, power generators (coal mine), etc.,

The project is built around the AVR micro controller from Atmel. This micro controller provides all the functionality of the display and wireless control.

Block Diagram:

Battery

Temperature Sensor

LCD

AVR ADC MICRO CONTROLLER MOTOR1 L293D MOTOR2

Schematic Diagram:

LCD1
LM016L

VSS VDD VEE

RS RW E 4 5 6

U2

1 2 3

27.0

U1
VOUT 2 14 15 16 17 18 19 9 10 PB0/ICP1 PB1/OC1A PB2/SS/OC1B PB3/MOSI/OC2 PB4/MISO PB5/SCK PB6/TOSC1/XTAL1 PB7/TOSC2/XTAL2 PC0/ADC0 PC1/ADC1 PC2/ADC2 PC3/ADC3 PC4/ADC4/SDA PC5/ADC5/SCL PC6/RESET PD0/RXD PD1/TXD PD2/INT0 PD3/INT1 PD4/T0/XCK PD5/T1 PD6/AIN0 PD7/AIN1 23 24 25 26 27 28 1 2 3 4 5 6 11 12 13

LM35

2 7 1

IN1 IN2 EN1

VSS

VS OUT1 OUT2

3 6

+88.8

16

U3
21 20 AREF AVCC ATMEGA8

IR RX

7 8 9 10 11 12 13 14

D0 D1 D2 D3 D4 D5 D6 D7

IR TX

9 10 15

EN2 IN3 IN4 GND

OUT3 GND OUT4

11 14
+88.8

L293D

Atmega 8: Features:
High-performance, Low-power AtmelAVR 8-bit Microcontroller

Advanced RISC Architecture 130 Powerful Instructions Most Single-clock Cycle Execution 32 8 General Purpose Working Registers Fully Static Operation Up to 16MIPS Throughput at 16MHz On-chip 2-cycle Multiplier High Endurance Non-volatile Memory segments 8Kbytes of In-System Self-programmable Flash program memory 512Bytes EEPROM 1Kbyte Internal SRAM Write/Erase Cycles: 10,000 Flash/100,000 EEPROM Data retention: 20 years at 85C/100 years at 25C(1) Optional Boot Code Section with Independent Lock Bits

In-System Programming by On-chip Boot Program True Read-While-Write Operation Programming Lock for Software Security Peripheral Features Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode Real Time Counter with Separate Oscillator Three PWM Channels 8-channel ADC in TQFP and QFN/MLF package Eight Channels 10-bit Accuracy 6-channel ADC in PDIP package Six Channels 10-bit Accuracy Byte-oriented Two-wire Serial Interface Programmable Serial USART Master/Slave SPI Serial Interface Programmable Watchdog Timer with Separate On-chip Oscillator On-chip Analog Comparator Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and Standby I/O and Packages

23 Programmable I/O Lines 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF Operating Voltages 2.7V - 5.5V (ATmega8L) 4.5V - 5.5V (ATmega8) Speed Grades 0 - 8MHz (ATmega8L) 0 - 16MHz (ATmega8) Power Consumption at 4Mhz, 3V, 25C Active: 3.6mA Idle Mode: 1.0mA Power-down Mode: 0.5A

Pin Diagram:

Block Diagram:

Pin Descriptions:

VCC Digital supply voltage. GND Ground. Port B (PB7..PB0): XTAL1/XTAL2/TOSC1/TOSC2 Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). ThePort B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit. Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. The various special features of Port B are elaborated in Alternate Functions of Port B Port C (PC5..PC0) Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running.

PC6/RESET

If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the clock is not running. The minimum pulse length is given in Table 15 on page 38. Shorter pulses are not guaranteed to generate a Reset. Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. RESET Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset. AVCC AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. Note that Port C (5..4) use digital supply voltage, VCC. AREF AREF is the analog reference pin for the A/D Converter. ADC7..6 (TQFP and QFN/MLF Package Only) In the TQFP and QFN/MLF package, ADC7..6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.

AVR Atmega 8 Memories:


In-System Reprogrammable Flash Program Memory The ATmega8 contains 8Kbytes On-chip In-System Reprogrammable Flash memory for program storage. Since all AVR instructions are 16-bits or 32-bits wide, the Flash is organized as 4K 16 bits. For software security, the Flash Program memory space is divided into two sections, Boot Program section and Application Program section. The Flash memory has an endurance of at least 10,000 write/erase cycles. The ATmega8 Program Counter (PC) is 12 bits wide, thus addressing the 4K Program memory locations. Constant tables can be allocated within the entire Program memory address space.

SRAM Data Memory

The lower 1120 Data memory locations address the Register File, the I/O Memory, and the internal data SRAM. The first 96 locations address the Register File and I/O Memory, and the next 1024 locations address the internal data SRAM. The five different addressing modes for the Data memory cover: Direct, Indirect with Displacement, Indirect, Indirect with Predecrement, and Indirect with Post-increment. In the Register File, registers R26 to R31 feature the indirect addressing pointer registers. The direct addressing reaches the entire data space. The Indirect with Displacement mode reaches 63 address locations from the base address given by the Y-register or Z-register. When using register indirect addressing modes with automatic predecrement and post-increment, the address registers X, Y and Z are decremented or incremented. The 32 general purpose working registers, 64 I/O Registers, and the 1024 bytes of internal data SRAM in the ATmega8 are all accessible through all these addressing modes.

Data Memory Access Times

This section describes the general access timing concepts for internal memory access.

EEPROM Data Memory


The ATmega8 contains 512bytes of data EEPROM memory. It is organized as a separate data space, in which single bytes can be read and written. The EEPROM has an endurance of at least 100,000 write/erase cycles. The access between the EEPROM and the CPU is described below, specifying the EEPROM Address Registers, the EEPROM Data Register, and the EEPROM Control Register.

EEPROM Read/Write Access


The EEPROM Access Registers are accessible in the I/O space. A self-timing function, however, lets the user software detect when the next byte can be written. If the user code contains instructions that write the EEPROM, some precautions must be taken. In heavily filtered power supplies, VCC is likely to rise or fall slowly on Power-up/down. This causes the device for some period of time to run at a voltage lower than specified as minimum for the clock frequency used. In order to prevent unintentional EEPROM writes, a specific write procedure must be followed. When the EEPROM is read, the CPU is halted for four clock cycles before the

next instruction is executed. When the EEPROM is written, the CPU is halted for two clock cycles before the next instruction is executed.

The EEPROM Address Register EEARH and EEARL

Bits 15..9 Res: Reserved Bits

These bits are reserved bits in the ATmega8 and will always read as zero. Bits 8..0 EEAR8..0: EEPROM Address The EEPROM Address Registers EEARH and EEARL specify the EEPROM address in the 512bytes EEPROM space. The EEPROM data bytes are addressed linearly between 0 and 511. The initial value of EEAR is undefined. A proper value must be written before the EEPROM may be accessed.

The EEPROM Data Register EEDR

Bits 7..0 EEDR7..0: EEPROM Data

For the EEPROM write operation, the EEDR Register contains the data to be written to the EEPROM in the address given by the EEAR Register. For the EEPROM read operation, the EEDR contains the data read out from the EEPROM at the address given by EEAR.

The EEPROM Control Register EECR

Bits 7..4 Res: Reserved Bits These bits are reserved bits in the AtmelAVR ATmega8 and will always read as zero. Bit 3 EERIE: EEPROM Ready Interrupt Enable Writing EERIE to one enables the EEPROM Ready Interrupt if the I bit in SREG is set. Writing EERIE to zero disables the interrupt. The EEPROM Ready interrupt generates a constant interrupt when EEWE is cleared. Bit 2 EEMWE: EEPROM Master Write Enable The EEMWE bit determines whether setting EEWE to one causes the EEPROM to be written. When EEMWE is set, setting EEWE within four clock cycles will write data to the EEPROM at the selected address If EEMWE is zero, setting EEWE will have no effect. When EEMWE has been written to one by software, hardware clears the bit to zero after four clock cycles. Bit 1 EEWE: EEPROM Write Enable
The EEPROM Write Enable Signal EEWE is the write strobe to the EEPROM. When address and data are correctly set up, the EEWE bit must be written to one to write the value into the EEPROM. The EEMWE bit must be written to one before a logical one is written to EEWE, oth- erwise no EEPROM write takes place. The following procedure should be followed when writing the EEPROM

1. Wait until EEWE becomes zero 2. Wait until SPMEN in SPMCR becomes zero 3. Write new EEPROM address to EEAR (optional) 4. Write new EEPROM data to EEDR (optional) 5. Write a logical one to the EEMWE bit while writing a zero to EEWE in EECR 6. Within four clock cycles after setting EEMWE, write a logical one to EEWE The EEPROM can not be programmed during a CPU write to the Flash memory. The software must check that the Flash programming is completed before initiating a new EEPROM write. Step 2 is only relevant if the software contains a boot loader allowing the CPU to program the Flash. If the Flash is never being updated by the CPU, step 2 can be omitted. See Boot Loader Support Read-While-Write Self-Programming on page 202 for details about boot programming. Caution: An interrupt between step 5 and step 6 will make the write cycle fail, since the EEPROM Master Write Enable will time-out. If an interrupt routine accessing the EEPROM is interrupting another EEPROM access, the EEAR or EEDR Register will be modified, causing the interrupted EEPROM access to fail. It is recommended to have the Global Interrupt Flag cleared during all the steps to avoid these problems. When the write access time has elapsed, the EEWE bit is cleared by hardware. The user software can poll this bit and wait for a zero before writing the next byte. When EEWE has been set, the CPU is halted for two cycles before the next instruction is executed.

Bit 0 EERE: EEPROM Read Enable


The EEPROM Read Enable Signal EERE is the read strobe to the EEPROM. When the correct address is set up in the EEAR Register, the EERE bit must be written to a logic one to trigger the EEPROM read. The EEPROM read access takes one instruction, and the requested

data is available immediately. When the EEPROM is read, the CPU is halted for four cycles before the next instruction is executed. The user should poll the EEWE bit before starting the read operation. If a write operation is in progress, it is neither possible to read the EEPROM, nor to change the EEAR Register.

Crystal Oscillator
XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be configured for use as an On-chip Oscillator. Either a quartz crystal or a ceramic resonator may be used. The CKOPT Fuse selects between two different Oscillator amplifier modes. When CKOPT is programmed, the Oscillator output will oscillate a full rail-torail swing on the output. This mode is suitable when operating in a very noisy environment or when the output from XTAL2 drives a second clock buffer. This mode has a wide frequency range. When CKOPT is unprogrammed, the Oscillator has a smaller output swing. This reduces power consumption considerably. This mode has a limited frequency range and it cannot be used to drive other clock buffers. For resonators, the maximum frequency is 8MHz with CKOPT unprogrammed and 16MHz with CKOPT programmed. C1 and C2 should always be equal for both crystals and resonators. The optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray capacitance, and the electromagnetic noise of the environment. Some initial guidelines for choosing capacitors for use with crystals are given in Table 4. For ceramic resonators, the capacitor values given by the manufacturer should be used.

Timer/Counter Oscillator
For AVR microcontrollers with Timer/Counter Oscillator pins (TOSC1 and TOSC2), the crystal is connected directly between the pins. By programming the CKOPT Fuse, the user can enable internal capacitors on XTAL1 and XTAL2, thereby removing the need for external capacitors. The Oscillator is optimized for use with a 32.768kHz watch crystal. Applying an external clock source to TOSC1 is not recommended.

System Control and Reset


Resetting the AVR During Reset, all I/O Registers are set to their initial values, and the program starts execution from the Reset Vector. If the program never enables an interrupt source, the Interrupt Vectors are not used, and regular program code can be placed at these locations. This is also the case if the Reset Vector is in the Application section while the Interrupt Vectors are in the boot section or vice versa. The I/O ports of the AVR are immediately reset to their initial state when a reset source goes active. This does not require any clock source to be running. After all reset sources have gone inactive, a delay counter is invoked, stretching the internal reset. This allows the power to reach a stable level before normal operation starts. The time-out period of the delay counter is defined by the user through the CKSEL Fuses.

Reset Sources
The ATmega8 has four sources of Reset: Power-on Reset. The MCU is reset when the supply voltage is below the Power-on Reset threshold (VPOT) External Reset. The MCU is reset when a low level is present on the RESET pin for longer than the minimum pulse length Watchdog Reset. The MCU is reset when the Watchdog Timer period expires and the Watchdog is enabled

Brown-out Reset. The MCU is reset when the supply voltage VCC is below the Brown-out

Reset threshold (VBOT) and the Brown-out Detector is enabled

Watchdog Timer
The Watchdog Timer is clocked from a separate On-chip Oscillator which runs at 1MHz. This isthe typical value at VCC = 5V. See characterization data for typical values at other VCC levels. By controlling the Watchdog Timer prescaler, the Watchdog Reset interval can be adjusted as shown in Table 17 on page 44. The WDR Watchdog Reset instruction resets the Watchdog Timer. The Watchdog Timer is also reset when it is disabled and when a Chip Reset occurs.

Eight different clock cycle periods can be selected to determine the reset period. If the reset period expires without another Watchdog Reset, the ATmega8 resets and executes from the Reset Vector. To prevent unintentional disabling of the Watchdog, a special turn-off sequence must be followed when the Watchdog is disabled.

Interrupt Vectors in ATmega8

VOLTAGE REGULATOR 7805:

Features:
Output Current up to 1A. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V. Thermal Overload Protection.

Short Circuit Protection. Output Transistor Safe Operating Area Protection.

Description:
The LM78XX/LM78XXA series of three-terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide range of applications. Each type employs internal current limiting, thermal shutdown and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

Internal Block Diagram

FIG: BLOCK DIAGRAM OF VOLTAGE REGULATOR

Absolute Maximum Ratings:

TABLE: RATINGS OF THE VOLTAGE REGULATOR

Typical Performance Characteristics:

FIG: PERFORMANCE CHARACTERISTICS OF REGULATOR

CAPACITORS:
A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric. When a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly separated conductors.

An ideal capacitor is characterized by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. In practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage. The properties of capacitors in a circuit may determine the resonant frequency and quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy capacity in a high-power system, and many other important aspects. A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of practical capacitors vary widely, but all contain at least two conductors separated by a nonconductor. Capacitors used as parts of electrical systems, for example, consist of metal foils separated by a layer of insulating film. Capacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant circuits that tune radios to particular frequencies and for many other purposes.

A capacitor is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator). When there is a potential difference (voltage) across the conductors, a static electric field develops in the dielectric that stores energy and produces a mechanical force between the conductors. An ideal capacitor is characterized by a single constant value, capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. The capacitance is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called "plates", referring to an early means of construction. In practice the dielectric between the plates passes a small amount of leakage current and also has an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance and resistance.

History:

Battery of four Leyden jars in Museum Boerhaave, Leiden, the Netherlands

In October 1745, Ewald Georg von Kleist of Pomerania in Germany found that charge could be stored by connecting a high voltage electrostatic generator by a wire to a volume of water in a hand-held glass jar. Von Kleist's hand and the water acted as conductors and the jar as a dielectric (although details of the mechanism were incorrectly identified at the time). Von Kleist found, after removing the generator, that touching the wire resulted in a painful spark. In a letter describing the experiment, he said "I would not take a second shock for the kingdom of

France." The following year, the Dutch physicist Pieter van Musschenbroek invented a similar capacitor, which was named the Leyden jar, after the University of Leiden where he worked. Daniel Gralath was the first to combine several jars in parallel into a "battery" to increase the charge storage capacity. Benjamin Franklin investigated the Leyden jar and "proved" that the charge was stored on the glass, not in the water as others had assumed. He also adopted the term "battery", (denoting the increasing of power with a row of similar units as in a battery of cannon), subsequently applied to clusters of electrochemical cells. Leyden jars were later made by coating the inside and outside of jars with metal foil, leaving a space at the mouth to prevent arcing between the foils. The earliest unit of capacitance was the 'jar', equivalent to about 1 nanofarad. Leyden jars or more powerful devices employing flat glass plates alternating with foil conductors were used exclusively up until about 1900, when the invention of wireless (radio) created a demand for standard capacitors, and the steady move to higher frequencies required capacitors with lower inductance. A more compact construction began to be used of a flexible dielectric sheet such as oiled paper sandwiched between sheets of metal foil, rolled or folded into a small package. Early capacitors were also known as condensers, a term that is still occasionally used today. The term was first used for this purpose by Alessandro Volta in 1782, with reference to the device's ability to store a higher density of electric charge than a normal isolated conductor.

Theory of operation:
Main article: Capacitance

Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric (orange) reduces the field and increases the capacitance.

A simple demonstration of a parallel-plate capacitor A capacitor consists of two conductors separated by a non-conductive region The nonconductive region is called the dielectric or sometimes the dielectric medium. In simpler terms, the dielectric is just an electrical insulator. Examples of dielectric mediums are glass, air, paper, vacuum, and even a semiconductor depletion region chemically identical to the conductors. A capacitor is assumed to be self-contained and isolated, with no net electric charge and no influence from any external electric field. The conductors thus hold equal and opposite charges on their facing surfaces, and the dielectric develops an electric field. In SI units, a capacitance of one farad means that one coulomb of charge on each conductor causes a voltage of one volt across the device. The capacitor is a reasonably general model for electric fields within electric circuits. An ideal capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge Q on each conductor to the voltage V between them:

Sometimes charge build-up affects the capacitor mechanically, causing its capacitance to vary. In this case, capacitance is defined in terms of incremental changes:

Energy storage:
Work must be done by an external influence to "move" charge between the conductors in a capacitor. When the external influence is removed the charge separation persists in the electric field and energy is stored to be released when the charge is allowed to return to its equilibrium position. The work done in establishing the electric field, and hence the amount of energy stored, is given by:[11]

Current-voltage relation
The current i(t) through any component in an electric circuit is defined as the rate of flow of a charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves the positive plate, resulting in an electron depletion and consequent positive charge on one electrode that is equal and opposite to the accumulated negative charge on the other. Thus the charge on the electrodes is equal to the integral of the current as well as proportional to the voltage as discussed above. As with any antiderivative, a constant of integration is added to represent the initial voltage v (t0). This is the integral form of the capacitor equation,

. Taking the derivative of this, and multiplying by C, yields the derivative form,

. The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the electric field. Its current-voltage relation is obtained by exchanging current and voltage in the capacitor equations and replacing C with the inductance L.

DC circuits
See also: RC circuit

A simple resistor-capacitor circuit demonstrates charging of a capacitor. A series circuit containing only a resistor, a capacitor, a switch and a constant DC source of voltage V0 is known as a charging circuit. If the capacitor is initially uncharged while the switch is open, and the switch is closed at t = 0, it follows from Kirchhoff's voltage law that

Taking the derivative and multiplying by C, gives a first-order differential equation,

At t = 0, the voltage across the capacitor is zero and the voltage across the resistor is V0. The initial current is then i (0) =V0 /R. With this assumption, the differential equation yields

where 0 = RC is the time constant of the system. As the capacitor reaches equilibrium with the source voltage, the voltage across the resistor and the current through the entire circuit decay exponentially. The case of discharging a charged capacitor likewise demonstrates exponential decay, but with the initial capacitor voltage replacing V0 and the final voltage being zero.

AC circuits:
Impedance, the vector sum of reactance and resistance, describes the phase difference and the ratio of amplitudes between sinusoidally varying voltage and sinusoidally varying current at a given frequency. Fourier analysis allows any signal to be constructed from a spectrum of

frequencies, whence the circuit's reaction to the various frequencies may be found. The reactance and impedance of a capacitor are respectively

where j is the imaginary unit and is the angular velocity of the sinusoidal signal. The - j phase indicates that the AC voltage V = Z I lags the AC current by 90: the positive current phase corresponds to increasing voltage as the capacitor charges; zero current corresponds to instantaneous constant voltage, etc. Note that impedance decreases with increasing capacitance and increasing frequency. This implies that a higher-frequency signal or a larger capacitor results in a lower voltage amplitude per current amplitudean AC "short circuit" or AC coupling. Conversely, for very low frequencies, the reactance will be high, so that a capacitor is nearly an open circuit in AC analysisthose frequencies have been "filtered out". Capacitors are different from resistors and inductors in that the impedance is inversely proportional to the defining characteristic, i.e. capacitance.

Parallel plate model:

Dielectric is placed between two conducting plates, each of area A and with a separation of d. The simplest capacitor consists of two parallel conductive plates separated by a dielectric with permittivity (such as air). The model may also be used to make qualitative predictions for other device geometries. The plates are considered to extend uniformly over an area A and a charge

density = Q/A exists on their surface. Assuming that the width of the plates is much greater than their separation d, the electric field near the centre of the device will be uniform with the magnitude E = /. The voltage is defined as the line integral of the electric field between the plates

Solving this for C = Q/V reveals that capacitance increases with area and decreases with separation . The capacitance is therefore greatest in devices made from materials with a high permittivity.

Several capacitors in parallel.

Networks:
See also: Series and parallel circuits For capacitors in parallel Capacitors in a parallel configuration each have the same applied voltage. Their capacitances add up. Charge is apportioned among them by size. Using the schematic diagram to visualize parallel plates, it is apparent that each capacitor contributes to the total surface area.

For capacitors in series

Several capacitors in series. Connected in series, the schematic diagram reveals that the separation distance, not the plate area, adds up. The capacitors each store instantaneous charge build-up equal to that of every other capacitor in the series. The total voltage difference from end to end is apportioned to each capacitor according to the inverse of its capacitance. The entire series acts as a capacitor smaller than any of its components.

Capacitors are combined in series to achieve a higher working voltage, for example for smoothing a high voltage power supply. The voltage ratings, which are based on plate separation, add up. In such an application, several series connections may in turn be connected in parallel, forming a matrix. The goal is to maximize the energy storage utility of each capacitor without overloading it. Series connection is also used to adapt electrolytic capacitors for AC use.

Non-ideal behaviour:
Capacitors deviate from the ideal capacitor equation in a number of ways. Some of these, such as leakage current and parasitic effects are linear, or can be assumed to be linear, and can be dealt with by adding virtual components to the equivalent circuit of the capacitor. The usual methods of network analysis can then be applied. In other cases, such as with breakdown voltage, the effect is non-linear and normal (i.e., linear) network analysis cannot be used, the effect must be dealt with separately. There is yet another group, which may be linear but invalidate the assumption in the analysis that capacitance is a constant. Such an example is temperature dependence.

Breakdown voltage:
Above a particular electric field, known as the dielectric strength Eds, the dielectric in a capacitor becomes conductive. The voltage at which this occurs is called the breakdown voltage of the device, and is given by the product of the dielectric strength and the separation between the conductors, Vbd = Edsd The maximum energy that can be stored safely in a capacitor is limited by the breakdown voltage. Due to the scaling of capacitance and breakdown voltage with dielectric thickness, all

capacitors made with a particular dielectric have approximately equal maximum energy density, to the extent that the dielectric dominates their volume. For air dielectric capacitors the breakdown field strength is of the order 2 to 5 MV/m; for mica the breakdown is 100 to 300 MV/m, for oil 15 to 25 MV/m, and can be much less when other materials are used for the dielectric. The dielectric is used in very thin layers and so absolute breakdown voltage of capacitors is limited. Typical ratings for capacitors used for general electronics applications range from a few volts to 100V or so. As the voltage increases, the dielectric must be thicker, making high-voltage capacitors larger than those rated for lower voltages. The breakdown voltage is critically affected by factors such as the geometry of the capacitor conductive parts; sharp edges or points increase the electric field strength at that point and can lead to a local breakdown. Once this starts to happen, the breakdown will quickly "track" through the dielectric till it reaches the opposite plate and cause a short circuit. The usual breakdown route is that the field strength becomes large enough to pull electrons in the dielectric from their atoms thus causing conduction. Other scenarios are possible, such as impurities in the dielectric, and, if the dielectric is of a crystalline nature, imperfections in the crystal structure can result in an avalanche breakdown as seen in semi-conductor devices. Breakdown voltage is also affected by pressure, humidity and temperature.
Equivalent circuit

Two different circuit models of a real capacitor An ideal capacitor only stores and releases electrical energy, without dissipating any. In reality, all capacitors have imperfections within the capacitor's material that create resistance. This is

specified as the equivalent series resistance or ESR of a component. This adds a real component to the impedance:

As frequency approaches infinity, the capacitive impedance (or reactance) approaches zero and the ESR becomes significant. As the reactance becomes negligible, power dissipation approaches PRMS = VRMS /RESR. Similarly to ESR, the capacitor's leads add equivalent series inductance or ESL to the component. This is usually significant only at relatively high frequencies. As inductive reactance is positive and increases with frequency, above a certain frequency capacitance will be canceled by inductance. High-frequency engineering involves accounting for the inductance of all connections and components. If the conductors are separated by a material with a small conductivity rather than a perfect dielectric, then a small leakage current flows directly between them. The capacitor therefore has a finite parallel resistance, and slowly discharges over time (time may vary greatly depending on the capacitor material and quality).

L293D: Features:
Featuring Unitrode L293 and L293D Products Now From Texas Instruments Wide Supply-Voltage Range: 4.5 V to 36 V Separate Input-Logic Supply Internal ESD Protection Thermal Shutdown High-Noise-Immunity Inputs Functional Replacements for SGS L293 and SGS L293D Output Current 1 A Per Channel (600 mA for L293D) Peak Output Current 2 A Per Channel

(1.2 A for L293D) Output Clamp Diodes for Inductive Transient Suppression (L293D)

Pin Diagram:

Description:
The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltage from 4.5 V to 36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications. All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled and their outputs are active and in phase with their inputs. When the enable input is low, those drivers are disabled and their outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications. On the L293, external highspeed output clamp diodes should be used for inductive transient suppression. A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation. The L293and L293D are characterized for operation from 0C to 70C.

Block diagram:

Logic Diagram:

DC Motors
A direct current (DC) motor is a fairly simple electric motor that uses electricity and a magnetic field to produce torque, which turns the motor. At its most simple, a DC motor requires two magnets of opposite polarity and an electric coil, which acts as an electromagnet. The repellent and attractive electromagnetic forces of the magnets provide the torque that causes the DC motor to turn. Whenever a robotics hobbyist talk about making a robot, the first thing comes to his mind is making the robot move on the ground. And there are always two options in front of the designer whether to use a DC motor or a stepper motor. When it comes to speed, weight, size, cost... DC motors are always preferred over stepper motors. There are many things which you can do with your DC motor when interfaced with a microcontroller. For example you can control the speed of motor, you can control the direction of rotation, you can also do encoding of the rotation made by DC motor i.e. keeping track of how many turns are made by your motors etc. So you can see DC motors are no less than a stepper motor. How to interface a DC motor with a microcontroller? Usually H-bridge is preferred way of interfacing a DC motor. These days many IC manufacturers have H-bridge motor drivers available in the market like L293D is most used H-Bridge driver IC. H-bridge can also be made with the help of transistors and MOSFETs etc. rather of being cheap, they only increase the size of the design board, which is sometimes not required so using a small 16 pin IC is preferred for this purpose. Working Theory of H-Bridge: The name "H-Bridge" is derived from the actual shape of the switching circuit which control the motion of the motor. It is also known as "Full Bridge". Basically there are four switching elements in the H-Bridge as shown in the figure below.

As you can see in the figure above there are four switching elements named as "High side left", "High side right", "Low side right", "Low side left". When these switches are turned on in pairs motor changes its direction accordingly. Like, if we switch on High side left and Low side right then motor rotate in forward direction, as current flows from Power supply through the motor coil goes to ground via switch low side right. This is shown in the figure below.

Similarly, when you switch on low side left and high side right, the current flows in opposite direction and motor rotates in backward direction. This is the basic working of H-Bridge. We can also make a small truth table according to the switching of H-Bridge explained above. Truth Table High Left On Off On Off High Right Off On On Off Low Left Off On Off On Low Right On Off Off On Description Motor runs clockwise Motor runs anti-clockwise Motor stops Motor stops

As already said, H-bridge can be made with the help of transistors as well as MOSFETs, the only thing is the power handling capacity of the circuit. If motors are needed to run with high current then lot of dissipation is there. So head sinks are needed to cool the circuit. Now you might be thinking why we did not discuss the cases like High side left on and Low side left on or high side right on and low side right on. Clearly seen in the diagram, we don't want to burn our power supply by shorting them. So that is why those combinations are not discussed in the truth table.

So we have seen that using simple switching elements we can make our own H-Bridge, or other option we have is using an IC based H-bridge driver. LM35 Temperature Sensor: The LM35 is a popular and low cost temperature sensor. It has three pins. The Vcc can be from 4V to 20V as specified by the datasheet. To use the sensor simply connect the Vcc to +5V ,GND to ground and the OUT to one of the ADC (analog to digital converter) channel. The output linearly varies with temperature. The output is

10 mV per degree centigrade So if the output is 310 mV then temperature is 31 degree C.

IR Sensors:

Object Detection using IR light


It is the same principle in ALL Infra-Red proximity sensors. The basic idea is to send infra red light through IR-LEDs, which is then reflected by any object in front of the sensor. For detecting the reflected IR light, we are going to use a very original technique: we are going to use another IR-LED, to detect the IR light that was emitted from another led of the exact same type! This is an electrical property of Light Emitting Diodes (LEDs) which is the fact that a led Produce a voltage difference across its leads when it is subjected to light. As if it was a photo-cell, but with much lower output current. In other words, the voltage generated by the leds can't be - in any way - used to generate electrical power from light, It can barely be detected.

LCD: Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose. The most commonly used Character based LCDs are based on Hitachi's HD44780 controller or other which are compatible with HD44580. The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers.

Pin Description

Pin No. 1 2 3 4

Name VSS VCC VEE RS

Description Power supply (GND) Power supply (+5V) Contrast adjust 0 = Instruction input 1 = Data input 0 = Write to LCD module 1 = Read from LCD module Enable signal Data bus line 0 (LSB) Data bus line 1

5 6 7 8

R/W EN D0 D1

9 10 11 12 13 14 15 16

D2 D3 D4 D5 D6 D7 LED+ LED-

Data bus line 2 Data bus line 3 Data bus line 4 Data bus line 5 Data bus line 6 Data bus line 7 (MSB) Back Light VCC Back Light GND

DDRAM - Display Data RAM Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for display can be used as general data RAM. So whatever you send on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16 characters are visible, so whatever you write after 16 chars is written in DDRAM but is not visible to the user. CGROM - Character Generator ROM Now you might be thinking that when you send an ASCII value to DDRAM, how the character is displayed on LCD? So the answer is CGROM. The character generator ROM generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes. It can generate 208 5 x 8 dot character patterns and 32 5 x 10 dot character patterns. CGRAM - Character Generator RAM As clear from the name, CGRAM area is used to create custom characters in LCD. In the character generator RAM, the user can rewrite character patterns by program. For 5 x 8 dots, eight character patterns can be written, and for 5 x 10 dots, four character patterns can be written. BF - Busy Flag Busy Flag is a status indicator flag for LCD. When we send a command or data to the LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed successfully this

flag is cleared (BF = 0). This is helpful in producing and exact amount of delay for the LCD processing. To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept next command or data and BF = 0 means LCD is ready for the next command or data to process. Instruction Register (IR) and Data Register (DR) There are two 8-bit registers in HD44780 controller Instruction and Data register. Instruction register corresponds to the register where you send commands to LCD e.g. LCD shift command, LCD clear, LCD address etc. and Data register is used for storing data which is to be displayed on LCD. When send the enable signal of the LCD is asserted, the data on the pins is latched in to the data register and data is then moved automatically to the DDRAM and hence is displayed on the LCD. Data Register is not only used for sending data to DDRAM but also for CGRAM, the address where you want to send the data, is decided by the instruction you send to LCD. Commands and Instruction set Only the instruction register (IR) and the data register (DR) of the LCD can be controlled by the MCU. Before starting the internal operation of the LCD, control information is temporarily stored into these registers to allow interfacing with various MCUs, which operate at different speeds, or various peripheral control devices. The internal operation of the LCD is determined by signals sent from the MCU. These signals, which include register selection signal (RS), read/write signal (R/W), and the data bus (DB0 to DB7), make up the LCD instructions (Table 3). There are four categories of instructions that: Designate LCD functions, such as display format, data length, etc. Set internal RAM addresses Perform data transfer with internal RAM

Perform miscellaneous functions

Although looking at the table you can make your own commands and test them. Below is a brief list of useful commands which are used frequently while working on the LCD.

No. 1 2 3 4 5

Instruction Function Set: 8-bit, 1 Line, 5x7 Dots Function Set: 8-bit, 2 Line, 5x7 Dots Function Set: 4-bit, 1 Line, 5x7 Dots Function Set: 4-bit, 2 Line, 5x7 Dots Entry Mode Display off Cursor off

Hex 0x30 0x38 0x20 0x28 0x06

Decimal 48 56 32 40 6

(clearing display without clearing DDRAM content)

0x08

7 8 9 10 12 13 14 15 16

Display on Cursor on Display on Cursor off Display on Cursor blinking Shift entire display left Shift entire display right Move cursor left by one character Move cursor right by one character Clear Display (also clear DDRAM content) Set DDRAM address or cursor position on display Set CGRAM address or set pointer to CGRAM location

0x0E 0x0C 0x0F 0x18 0x1C 0x10 0x14 0x01 0x80+add

14 12 15 24 30 16 20 1 128+add

17

0x40+add

64+add

Sending Commands to LCD To send commands we simply need to select the command register. Everything is same as we have done in the initialization routine. But we will summarize the common steps and put them in a single subroutine. Following are the steps: move data to LCD port select command register select write operation send enable signal wait for LCD to process the command

Sending Data to LCD To send data we simply need to select the data register. Everything is same as the command routine. Following are the steps: move data to LCD port select data register select write operation send enable signal wait for LCD to process the data

Working with AVR Studio:


AVR studio is an Integrated Development Environment (IDE) by ATMEL for developing applications based on 8-bit AVR microcontroller. Prior to installation of AVR Studio you have to install the compiler WinAVR. This will allow AVR Studio to detect the compiler.

Step 1:

Step 2:

Click on new project

Step 3:

Click on AVR GCC Write the project name Select your project location. Click on Next>>

Step 4:

Click on AVR Simulator in left block and then select your controller (e.g.: ATmega16). Click on finish button

Step5:

Write the code in main body area. Save the project file.

Step6:

Go to PROJECT -> Configuration Options

Step 7:

Write the crystal frequency if you are using external crystal. Check the checkbox corresponding to Create Hex File and then click on OK. Save the project again.

Step 8:

Go to BUILD -> Compile. This will compile your code and generate error if any.

For the first time it will generate two errors, ignore them. Step 9:

Again go to BUILD and click on Build. This will generate hex file of the code. Use that Hex file to burn your microcontroller. Where you will find Hex file? Just go to the location which you selected at the starting. Open that folder you will find one more folder named Default. This is the default location of where the hex file is generated. While working in real time if you want to change the code, make changes and build the file again. This will automatically update the previous hex file.

Vous aimerez peut-être aussi