P. 1
SMS Controlled Home Automation Systems

SMS Controlled Home Automation Systems

|Views: 385|Likes:
Published by Anirudh Iyengar

More info:

Published by: Anirudh Iyengar on Apr 21, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less






  • 3.2 Typical Microcontroller Architecture and Features
  • 3.3 The UART: What it is and how it works
  • 3.4 Synchronous Serial Transmission
  • 3.5 Asynchronous Serial Transmission
  • 3.6.1 The ATmega8 provides the following prominent features
  • 3.6.2 Pin Descriptions
  • 3.6.3 I/O PORTS
  • 3.7 8-bit Timer/Counter Register Description
  • 3.8 8-bit Timer/Counter0
  • 4.1 Description :
  • 4.2 Syntax :
  • 4.3 Defined values :
  • 5. Preferred Message Format +CMGF
  • 6.Switch contact arrangement (SPDT, DPDT etc) )


GSM technology can provide a sophisticated theft alert system for bank locker system. The embedded I/O unit automates the inner door and entry door. The inner door always kept open. There are two modes in this project one is normal mode and another one is security mode. In normal mode an authorized person can open the locker key and he can close the entry door. At that time GSM never send the message to the required person. If any person tries to open the locker key in security mode, the inner door will be closed automatically and SMS is transferred to the required person’s hand phone. After identifying the theft an authorized person can automate the inner door through the SMS. The GSM module is connected with the microcontroller through serial port. Using ‘AT’ commands the SMS is transferred to the GSM module. The GSM module converts the digital information into airborne signals. Through GSM network the SMS is transferred to the required person’s hand phone. This system offers better solution for the Bank security system and also it will help you to track the intruder. The system includes a ATMEGA8 microcontroller which is interfaced with GSM module and relays which can allow human to switch on the devices by sending a message and also gives the feedback message about the device status.



In general. design engineers can optimize it. automobiles. factory controllers. Handheld computers share some elements with embedded systems — such as the operating systems and microprocessors which power them — but are not truly embedded systems. as many systems have some element of programmability. . An embedded system is some combination of computer hardware and software.An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions. vending machines. Complexity varies from low. Embedded systems have become very important today as they control many of the common devices we use. "embedded system" is not an exactly defined term. or the systems controlling nuclear power plants. either fixed in capability or programmable. Some embedded systems are mass-produced. a generalpurpose computer. peripherals and networks mounted inside a large chassis or enclosure. reducing the size and cost of the product. to large stationary installations like traffic lights. Industrial machines. household appliances. sometimes with real-time computing constraints. to very high with multiple units. can do many different tasks depending on programming. medical equipment. airplanes. In contrast. benefiting from economies of scale. For example. that is specifically designed for a particular kind of application device. embedded systems range from portable devices such as digital watches and MP3 players. because they allow different applications to be loaded and peripherals to be connected. with a single microcontroller chip. Physically. and embedded systems programming is a specialized occupation. or increasing the reliability and performance. such as a personal computer. cameras. Embedded systems that are programmable are provided with a programming interface. Since the embedded system is dedicated to specific tasks. and toys (as well as the more obvious cellular phone and PDA) are among the myriad possible hosts of an embedded system. It is usually embedded as part of a complete device including hardware and mechanical parts.

such as Embedded Java and Windows XP Embedded. What is this Embedded System? The computer you use to compose your mails. So these controllers cannot be used in any other place. many controllers embedded in your car take care of car operations between the bumpers and most of the times you tend to ignore all these controllers. Theoretically. an embedded controller is a combination of a piece of microprocessor based hardware and the suitable software to undertake a specific task. Television. Apart from all these. In recent days.1 APPLICATIONS OF EMBEDDED SYSTEM We are living in the Embedded World. . You need to install the relevant software to get the required processing facility. All kinds of magazines and journals regularly dish out details about latest technologies. you are showered with variety of information about these embedded controllers in many places. You must be wondering about these embedded controllers or systems. or create a document or analyze the database is known as the standard desktop computer. However. as programs on a personal computer are. Access Controllers. Radio. these desktop computers can do many things. These desktop computers are manufactured to serve many purposes and applications.Certain operating systems or language platforms are tailored for the embedded market. In contrast. Most of the time. 2. rather than being loaded into RAM (random access memory). The program is written permanently into the system's memory in this case. So. embedded controllers carryout a specific work for which they are designed. some low-end consumer products use very inexpensive microprocessors and limited storage. Card readers. new devices. engineers design these embedded controllers with a specific goal in mind. with the application and operating system both part of a single program. Now you can agree to the fact that these embedded products have successfully invaded into our world. CD player of your living room. fast applications which make you believe that your basic survival is controlled by these embedded products. Palm devices of your work space enable you to do many of your tasks very effectively. You are surrounded with many embedded products and your daily life largely depends on the proper functioning of these gadgets. Washing Machine or Microwave Oven in your kitchen.

 Military and aerospace software applications From in-orbit embedded systems to jumbo jets to vital battlefield networks. Rich in system resources and networking services. in 8 bit and 32 bit. scalability. and high-availability facilities consistently turn to the LynxOS® RTOS and the LynxOS-178 RTOS for software certification to DO-178B. distributed computing capabilities. and long-term support options. . high reliability. integrated communications stacks. software certification. the most popular and used architecture is Intel's 8031.and safety-critical systems. LynxOS provides an off-the-shelf software platform with hard real-time response backed by powerful distributed computing (CORBA).These days designers have many choices in microprocessors/microcontrollers. POSIX®-compatible RTOS solution. and hard real-time response— LynxOS delivers on these key requirements and more for today's carrier-class systems. Scalable kernel configurations. based on the RTCA DO-178B standard. and fault-management facilities make LynxOS the ideal choice for companies looking for a single operating system for all embedded telecommunications applications—from complex central controllers to simple line/trunk cards. Selecting a right microprocessor may turn out as a most difficult first step and it is getting complicated as new devices continue to pop-up very often.LynxOS-178 is the first DO-178B and EUROCAE/ED-12B certifiable. Real-time systems programmers get a boost with LynuxWorks' DO-178B RTOS training courses. Even after 25 years of existence. In the 8 bit segment.  Communications applications "Five-nines" availability. Especially. the available variety really may overwhelm even an experienced designer. CompactPCI hot swap support. Market acceptance of this particular family has driven many semiconductor manufacturers to develop something new based on this particular architecture. designers of mission-critical aerospace and defense systems requiring real-time performance. semiconductor manufacturers still come out with some kind of device using this 8031 core. assists developers in gaining certification for their mission.The LynxOS-178 RTOS for software certification.

proven stability and full product life-cycle support opportunities associated with Blue Cat embedded Linux. web-enabled navigation systems. The Lynx Certifiable Stack (LCS) is a secure TCP/IP protocol stack designed especially for applications where standards certification is required. .From ISO 9001 certification to fault-tolerance. state-of-the-art. Blue Cat has teamed up with industry leaders to make it easier to build Linux mobile phones with Java integration. For makers of low-cost consumer electronic devices who wish to integrate the LynxOS realtime operating system into their products. we offer special MSRP-based pricing to reduce royalty fees to a negligible portion of the device's MSRP. POSIX conformance. Take advantage of our 20 years of experience. data networking and porting software components—including source code for easy customization. with pre-integrated. radios. personal communication devices. phones and PDAs all benefit from the cost-effective dependability. And as the wireless appliance revolution rolls on. we've got it all. the Blue Cat® Linux® operating system provides a highly reliable and royalty-free option for systems designers.LynuxWorks Jumpstarts for Communications package enables OEMs to rapidly develop mission-critical communications equipment. secure partitioning and high availability.  Industrial automation and process control software Designers of industrial and process control systems know from experience that LynuxWorks operating systems provide the security and reliability that their industrial applications require.  Electronics applications and consumer devices As the number of powerful embedded processors in consumer devices continues to rise.


80386. 68010. This is not the case with Microcontrollers. In many applications. In an Embedded system. A printer is an example of embedded system since the processor inside it performs one task only. Although the addition of external RAM. etc). there is only one application software that is typically burned into ROM. they are commonly referred to as general-purpose Microprocessors. network server. ROM. 80286. and no I/O ports on the chip itself. I/O ports. A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM. ROM. 80486. In other words. . Microprocessors and Microcontrollers are widely used in embedded system products. These applications most often require some I/O operations to read signals and turn on and off certain bits. ROM. These microprocessors contain no RAM. Contrast this with a Pentium based PC. namely getting the data and printing it. For this reason. the RAM. and the Pentium) or Motorola's 680X0 family (68000. the processor. they have the advantage of versatility such that the designer can decide on the amount of RAM. no ROM. Of course the reason a pc can perform myriad tasks is that it has RAM memory and an operating system that loads the application software into RAM memory and lets the CPU run it. print-server. I/O ports. An x86 PC contains or is connected to various embedded products such as keyboard. bank teller terminal. or Internet terminal. ROM. for example a TV remote control. 68040. A system designer using a general-purpose microprocessor such as the Pentium or the 68040 must add RAM. Video game.1 MICROCONTROLLERS FOR EMBEDDED SYSTEMS In the Literature discussing microprocessors. and timers externally to make them functional.What is the difference between a Microprocessor and Microcontroller? By microprocessor is meant the general purpose Microprocessors such as Intel's X86 family (8086. 68030. I/O ports and the timer are all embedded together on one chip. and I/O ports makes these systems bulkier and much more expensive. 3. A PC can be used for any number of applications such as word processor. 68020. Software for a variety of applications can be loaded and run. ROM and I/O ports needed to fit the task at hand. and a timer all on a single chip. there is no need for the computing power of a 486 or even an 8086 microprocessor. An embedded system product uses a microprocessor (or Microcontroller) to do one task only. we often see the term Embedded System.

2.printer. and the registers (stack pointer. All components are connected via an internal bus and are all integrated on one chip. program counter.2 Typical Microcontroller Architecture and Features The basic internal designs of microcontrollers are pretty similar. 3. You can find a more detailed description of these components in later sections. disk controller. . For example. Figure1 shows the block diagram of a typical microcontroller.). Each one of these peripherals has a Microcontroller inside it that performs only one task. . Memory: The memory is sometimes split into program memory and data memory. register file . and so on. modem. mouse. It contains the arithmetic logic unit.1: Basic Layout of Microcontroller The following list contains the modules typically found in a microcontroller. sound card. Table 1-1 lists some embedded products. CD-ROM drives. a DMA controller handles data transfers between peripheral components and the memory. The modules are connected to the outside world via I/O pins. inside every mouse there is a Microcontroller to perform the task of finding the mouse position and sending it to the PC. Processor Core: The CPU of the controller. . accumulator register. the control unit. Fig 3. In larger controllers.

Digital I/O: Parallel digital I/O ports are one of the main features of microcontrollers. In conjunction with sleep modes. which can be used to timestamp events. The analog module also generally features an analog comparator. and a S if it supports Synchronous communications. The number of I/O pins varies from 3-4 to over 90. in conjunction with an external filter. most microcontrollers have integrated analog/digital converters. which can be used to drive motors or for safe breaking (antilock brake system. The UART takes bytes of data and transmits the individual bits in a sequential fashion. There are two primary forms of serial transmission: Synchronous and Asynchronous. Analog I/O: Apart from a few small controllers. ABS). Depending on the modes that are supported by the hardware. Timer/Counter: Most controllers have at least one and more likely 2-3 Timer/Counters. the name of the communication sub-system will usually include a A if it supports Asynchronous communications. a second UART reassembles the bits into complete bytes. Both forms are described below. they help to conserve power.Interrupt Controller: Interrupts are useful for interrupting the normal program flow in case of (important) external or internal events. terminals and other devices. the microcontroller includes digital/analog converters. 3.3 The UART: What it is and how it works The Universal Asynchronous Receiver/Transmitter (UART) controller is the key component of the serial communications subsystem of a computer. Serial transmission is commonly used with modems and for non-networked communication between computers. measure intervals. . depending on the controller family and the controller type. Many controllers also contain PWM (pulse width modulation) outputs. At the destination. or count events. which differ in the number of channels (2-16) and their resolution (8-12 bits). be used to realize a cheap digital/analog converter. Furthermore the PWM output can. In some cases.

This mode is described here for comparison purposes only 3. (This requirement was set in the days of mechanical teleprinters and is easily met by modern electronic equipment. and synchronous communication can be more costly if extra wiring and circuits are required to share a clock signal between the sender and receiver. These two clocks must be accurate enough to not have the frequency drift by more than 10% during the transmission of the remaining bits in the word. these are known as Parallel devices. The Start Bit is used to alert the receiver that a word of data is about to be sent. In the PC industry. Instead. and to force the clock in the receiver into synchronization with the clock in the transmitter. a fill character must be sent instead so that data is always being transmitted. Synchronous communication is usually more efficient because only data bits are transmitted between sender and receiver.) . a bit called the "Start Bit" is added to the beginning of each word that is to be transmitted. if there is no data available at a given instant to transmit. Printers and fixed disk devices are not normally serial devices because most fixed disk interface standards send an entire word of data for each clock or strobe signal by using a separate wire for each bit of the word.4 Synchronous Serial Transmission Synchronous serial transmission requires that the sender and receiver share a clock with one another. or that the sender provide a strobe or other timing signal so that the receiver knows when to “read” the next bit of the data.3. The standard serial communications hardware in the PC does not support Synchronous operations. When a word is given to the UART for Asynchronous transmissions. the sender and receiver must agree on timing parameters in advance and special bits are added to each word which are used to synchronize the sending and receiving units.5 Asynchronous Serial Transmission Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. A form of Synchronous transmission is used with printers and fixed disk devices in that the data is sent on one set of wires while a clock or strobe is sent on a different wire. In most forms of serial Synchronous communication.

the Start Bit for the new word can be sent as soon as the Stop Bit for the previous word has been sent. the individual bits of the word of data are sent.When the entire data word has been sent. these bits are not passed to the host. the UART considers the entire word to be garbled and will report a Framing Error to the host processor when the data word is read.After the Start Bit. If the sender and receiver are configured identically.Regardless of whether the data was received correctly or not. and then the receiver looks for a Stop Bit. and the receiver “looks” at the wire at approximately halfway through the period assigned to each bit to determine if the bit is a 1 or a 0. if there is no data to transmit. If the Stop Bit does not appear when it is supposed to. The Parity Bit may be used by the receiver to perform simple error checking. it may check for the Parity Bits (both sender and receiver must agree on whether a Parity Bit is to be used). Then at least one Stop Bit is sent by the transmitter. 3. Each bit in the transmission is transmitted for exactly the same amount of time as all of the other bits. and so on. the receiver will examine the signal to determine if it is a 1 or a 0 after one second has passed.If another word is ready for transmission. the transmission line can be idle.6 MICROCONTROLLER ATmega8 . The usual cause of a Framing Error is that the sender and receiver clocks were not running at the same speed. For example. Because asynchronous data is “self synchronizing”. the UART automatically discards the Start. The sender only knows when the clock says to begin transmitting the next bit of the word. then it will wait two seconds and then examine the value of the next bit. or that the signal was interrupted. When the receiver has received all of the bits in the data word. The sender does not know when the receiver has “looked” at the value of the bit. if it takes two seconds to send each bit. the transmitter may add a Parity Bit that the transmitter generates. with the Least Significant Bit (LSB) being sent first. Parity and Stop bits.

1 Pin Out of ATmega8 AVR core combines a rich instruction set with 32 general-purpose working registers.6. Low-power AVR® 8-bit Microcontroller • Advanced RISC Architecture   130 Powerful Instructions – Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers . based on the AVR enhanced RISC architecture.The ATmega8 is a low-power CMOS 8-bit microcontroller. By executing powerful instructions in a single clock cycle.6.1 The ATmega8 provides the following prominent features • High-performance. 3. allowing two independent registers to be accessed in one single instruction executed in one clock cycle. 3. the ATmega8 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU). Fig. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers.

   Fully Static Operation Up to 16 MIPS Throughput at 16 MHz On-chip 2-cycle Multiplier • High Endurance Non-volatile Memory segments          8K Bytes of In-System Self-programmable Flash program memory 512 Bytes EEPROM 1K Byte Internal SRAM Write/Erase Cycles: 10. 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 .000 EEPROM Data retention: 20 years at 85°C/100 years at 25°C 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.000 Flash/100. Compare Mode.

Timer/Counters.5V (ATmega8L) 4.16 MHz (ATmega8) • Power Consumption at 4 Mhz. and Standby • I/O and Packages   23 Programmable I/O Lines 28-lead PDIP. 32-lead TQFP.5 μA The Idle mode stops the CPU while allowing the USART.0 mA Power-down Mode: 0.5. disabling all other chip functions until the next External Interrupt or Hardware Reset.6 mA Idle Mode: 1. the Asynchronous Timer continues to run. Power-down. allowing the user to maintain a timer base while the rest of the device is sleeping. 25°C    Active: 3.7 .5.5V (ATmega8) • Speed Grades   0 .• Special Microcontroller Features     Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Five Sleep Modes: Idle.5 . and 32-pad QFN/MLF • Operating Voltages   2. ADC Noise Reduction. SRAM. Power-save. to minimize switching noise during ADC conversions.8 MHz (ATmega8L) 0 . The Power-down mode saves the register contents but freezes the Oscillator. . SPI port. Two-wire interface. 3V. The ADC Noise Reduction mode stops the CPU and all I/O modules except Asynchronous Timer and ADC. In Power-save mode. A/D Converter. and interrupt system to continue functioning.

. PC6/RESET If the RSTDISBL Fuse is programmed. If the Internal Calibrated RC Oscillator is used as chip clock source. GND. A low level on this pin for longer than the minimum pulse length will generate a Reset.. The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. 3. PB7. Port B pins that are externally pulled low will source current if the pull-up resistors are activated.2 Pin Descriptions VCC. PC6 is used as an I/O pin. The Port B pins are tri-stated when a reset condition becomes active. PB7 can be used as output from the inverting Oscillator amplifier.6 is used as TOSC2. Depending on the clock selection fuse settings. As inputs. the Atmel ATmega8 is a powerful microcontroller that provides a highly flexible and cost-effective solution to many embedded control applications. Port B (PB7.Digital supply voltage. Port C pins that are externally pulled low will source current if the pull-up resistors are activated.1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. even if the clock is not running .By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a monolithic chip.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). If the RSTDISBL Fuse is unprogrammed.. Port C (PC5. PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit. even if the clock is not running. Depending on the clock selection fuse settings. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. PC6 is used as a Reset input..PC0) Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). even if the clock is not running. The Port C pins are tri-stated when a reset condition becomes active.6. As inputs. The Port B output buffers have symmetrical drive characteristics with both high sink and source capability.Ground.

Port D (PD7. even if the ADC is not used. AREF AREF is the analog reference pin for the A/D Converter. VCC. Shorter pulses are not guaranteed to generate a reset.PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). It should be externally connected to VCC.. Port C (3.. If the ADC is used. . A low level on this pin for longer than the minimum pulse length will generate a reset. The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. even if the clock is not running.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. RESET Reset input. As inputs. it should be connected to VCC through a low-pass filter.4) use digital supply voltage... even if the clock is not running.. The Port D pins are tri-stated when a reset condition becomes active. Note that Port C (5.6). ADC7.6 (TQFP and QFN/MLF Package Only) In the TQFP and QFN/MLF package. Port D pins that are externally pulled low will source current if the pull-up resistors are activated.. AVCC AVCC is the supply voltage pin for the A/D Converter. ADC7.0). and ADC (7.

program debugger/simulators. in-circuit emulators. and evaluation kits. macro assemblers.1 BLOCK DIAGRAM OF AT mega 8 The ATmega8 AVR is supported with a full suite of program and system development tools including: C compilers. .Fig 3.2.6.

1 Ports as general purpose I/O: The ports are bi-directional I/O ports with optional internal pull-ups. or as the Data Space locations following those of the Register File. If . Each output buffer has symmetrical drive characteristics with both high sink and source capability. Data Direction Register – DDRx. while the Data Register and the Data Direction Register are read/write. In addition. the Pull-up Disable – PUD bit in SFIOR disables the pull-up function for all pins in all ports when set. The I/O Memory can be accessed directly. All I/O pins have protection diodes to both VCC and Ground. 20h . The pin driver is strong enough to drive LED displays directly. The interrupts have priority in accordance with their interrupt vector position. Enabling the alternate function of some of the port pins does not affect the use of the other pins in the port as general digital I/O. The Port Input Pins I/O location is read only. and the PINxn bits at the PINxI/O address.5Fh 3. the PORTxn bits at the PORTx I/O address.3.6. Pxn is configured as an input pin. If DDxn is written logic one. and PINxn. one each for the Data Register – PORTx. The lower the interrupt vector address. If DDxn is written logic zero. The same applies when changing drive value (if configured as output) or enabling/disabling of pull-up resistors (if configured as input). Three I/O memory address locations are allocated for each port. The DDxn bit in the DDRx Register selects the direction of this pin. All port pins have individually selectable pull-up resistors with a supply-voltage invariant resistance. Most port pins are multiplexed with alternate functions for the peripheral features on the device.6. All registers and bit references in this section are written in general form. Pxn is configured as an output pin. 3. and the Port Input Pins – PINx. PORTxn. All interrupts have a separate interrupt vector in the interrupt vector table.3 I/O PORTS All AVR ports have true Read-Modify-Write functionality when used as general digital I/O ports. the higher the priority. The DDxn bits are accessed at the DDRx I/O address. This means that the direction of one port pin can be changed without unintentionally changing the direction of any other pin with the SBI and CBI instructions. Each port pin consists of three register bits: DDxn.A flexible interrupt module has its control registers in the I/O space with an additional global interrupt enable bit in the Status Register.

Table 3. To switch the pull-up resistor off.1 Selection Table . the pull-up enabled state is fully acceptable. even if no clocks are running. If PORTxn is written logic zero when the pin is configured as an output pin.6. the pull-up resistor is activated. PORTxn has to be written logic zero or the pin has to be configured as an output pin. If this is not the case. the port pin is driven low (zero). the port pin is driven high (one).PORTxn is written logic one when the pin is configured as an input pin. as a high-impedance environment will not notice the difference between a strong high driver and a pull-up. the PUD bit in the SFIOR Register can be set to disable all pull-ups in all ports. Normally. If PORTxn is written logic one when the pin is configured as an output pin.3. The port pins are tri-stated when a reset condition becomes active.

max and tpd. The maximum and minimum propagation delays are denoted tpd.Fig 3. the port pin can be read through the PINxn Register bit. This is needed to avoid meta stability if the physical pin changes value near the edge of the internal clock. but it also introduces a delay.1 General I/O Block diagram Independent of the setting of Data Direction bit DDxn.3. min respectively. .6. The PINxn Register bit and the preceding latch constitute a synchronizer.

as indicated by the shaded region of the “SYNC LATCH” signal.When reading back a software assigned pin value. The signal value is latched when the system clock goes low. the delay tpd through the synchronizer is one system clock period.3 Timing diagram when Reading an . The out instruction sets the “SYNC LATCH” signal at the positive edge of the clock.6. As indicated by the two arrows tpd. and goes transparent when the clock is high. The latch is closed when the clock is low.3. min.3. Fig 3.2 Timing Diagram while Reading an 1 Consider the clock period starting shortly after the first falling edge of the system clock. In this case. a nop instruction must be inserted. a single signal transition on the pin will be delayed between ½ and 1½ system clock period depending upon the time of assertion. It is clocked into the PINxn Register at the succeeding positive clock edge. max and tpd.Fig 3.6.

and two types of Pulse Width Modulation (PWM) modes .1 TCCR 1 Bit 7 – FOC2: Force Output Compare The FOC2 bit is only active when the WGM bits specify a non-PWM mode.7 8-bit Timer/Counter Register Description Timer/Counter Control Register – TCCR2 fig 3. However. this bit must be set to zero when TCCR2 is written when operating in PWM mode. • Bit 6. A FOC2 strobe will not generate any interrupt. nor will it clear the timer in CTC mode using OCR2 as TOP. The FOC2 bit is always read as zero. and what type of waveform generation to be used. Therefore it is the value present in the COM21:0 bits that determines the effect of the forced compare.3.3 – WGM21:0: Waveform Generation Mode These bits control the counting sequence of the counter. When writing a logical one to the FOC2 bit. The OC2 output is changed according to its COM21:0 bits setting.7. an immediate Compare Match is forced on the waveform generation unit. the source for the maximum (TOP) counter value. for ensuring compatibility with future devices. Note that the FOC2 bit is implemented as a strobe. Modes of operation supported by the Timer/Counter unit are: Normal mode. Clear Timer on Compare Match (CTC) mode.

However. the function of the COM21:0 bits depends on the WGM21:0 bit setting. Modifying the counter (TCNT2) while the counter is running. If one or both of the COM21:0 bits are set.7. note that the Data Direction Register (DDR) bit corresponding to OC2 pin must be set in order to enable the output driver. the OC2 output overrides the normal port functionality of the I/O pin it is connected to. .7. Writing to the TCNT2 Register blocks (removes) the Compare Match on the following timer clock. When OC2 is connected to the pin.table 3. to the Timer/Counter unit 8-bit counter. Timer/Counter Register – TCNT2 Fig 3. introduces a risk of missing a Compare Match between TCNT2 and the OCR2 Register.1 TCCR modes • Bit 5:4 – COM21:0: Compare Match Output Mode These bits control the Output Compare Pin (OC2) behavior.2 TCNT The Timer/Counter Register gives direct access. both for read and write operations.

8. The device-specific I/O Register and bit locations are listed in the “8-bit Timer/Counter Register Description”.Output Compare Register – OCR2 Fig 3. single channel.7. 3.3 OCR2 The Output Compare Register contains an 8-bit value that is continuously compared with the counter value (TCNT2). are shown in bold. . including I/O bits and I/O pins. A match can be used to generate an Output Compare interrupt. or togenerate a waveform output on the OC2 pin. For the actual placement of I/O pinsCPU accessible I/O Registers. The main features are: • Single Channel Counter • Frequency Generator • External Event Counter • 10-bit Clock Prescaler Overview A simplified block diagram of the 8-bit Timer/Counter is shown in Fig 3. 8-bit Timer/Counter module.1 .8 8-bit Timer/Counter0 Timer/Counter0 is a general purpose.

The Timer/Counter can be clocked internally or via the prescaler. A lower case “n” replaces the Timer/Counter number.Fig 3. Definitions Many register and bit references in this document are written in general form. The Clock Select logic block controls which clock source and edge the Timer/Counter uses to increment its value. TCNT0 for accessing Timer/Counter0 counter value and so on. or by an external clock source on the T0 pin. However. TIFR and TIMSK are not shown in the figure since these registers are shared by other timer units.8. The output from the clock select logic is referred to as the timer clock (clkT0). in the figure) signals are all visible in the Timer Interrupt Flag Register (TIFR). Timer/Counter Clock Sources The Timer/Counter can be clocked by an internal or an external clock source. All interrupts are individually masked with the Timer Interrupt Mask Register (TIMSK).1 8-bit Timer/Counter Registers The Timer/Counter (TCNT0) is an 8-bit register. Interrupt request (abbreviated to Int. the precise form must be used i. Req. when using the register or bit defines in a program. The Timer/Counter is inactive when no clock source is selected. The clock source .e. in this case 0.

2Counter Unit Block Diagram Operation The counting direction is always up (incrementing).8. However. A new counter value can be written anytime. the timer resolution can be increased by software. except that it is only set. combined with the timer overflow interrupt that automatically clears the TOV0 Flag. Figure contains timing data for basic Timer/Counter operation. The counter simply overruns when it passes its maximum 8-bit value (MAX = 0xFF) and then restarts from the bottom (0x00). not cleared.is selected by the clock select logic which is controlled by the clock select (CS02:0) bits located in the Timer/Counter Control Register (TCCR0). Timing Diagrams The Timer/Counter is a synchronous design and the timer clock (clkT0) is therefore shown as a clock enable signal in the following figures. The figure . Counter Unit . and no counter clear is performed. The figures include information on when Interrupt Flags are set. In normal operation the Timer/Counter Overflow Flag (TOV0) will be set in the same timer clock cycle as the TCNT0 becomes zero. The TOV0 Flag in this case behaves like a ninth bit. Fig 3.

8.shows the count sequence close to the MAX value.8.3 timing diagrams 1 Fig 3. Fig 3.4 timing diagrams 2 .


Power led which gives the indication of modem status that is on or off.1: Functions – GSM Mode The GSM modem basically consists of a • • • • SIM card holder to hold the activated SIM card for sending and receiving SMS.1 GSM MODEM INTRODUCTION: What is GSM? GSM stands for Global System for Mobile Communication.1. Functions – GSM Modes Table 3. 9 pin female to which the GSM antenna is connected. It is a globally accepted standard for digital cellular communication. GSM is the name of a standardization group established in 1982 to create a common European mobile telephone standard that would formulate specifications for a pan-European mobile cellular radio system operating at 900 MHz. . 5V AC power supply header to which the 5v ac adapter is connected.

g.1 : GSM Modem Block Diagram GSM Network Setup: TE TA ME USER & APPLICATIONS NETWORK Fig 3. a GSM phone (equal to MS.1.1.Block Diagram of GSM: Fig 3. Here ME stands for Mobile Equipment.2 :GSM setup This is the basic setup of a GSM. e. Mobile Station). TE stands for Terminal Equipment. .

e.g. Through the mobile equipment the network messages are sent and received. a computer (equal to DTE.OFF .3 : Connection Diagra LED Status Indicator The LED will indicate different status of the modem: .2 Fig 3.2 Connection Diagram: The GSM modem being a serial communication device is connected to the serial port or a serial device through a serial connector. Data Circuit Terminating Equipment).1. These messages are sent to the terminal adapter which is nothing but a GSM data card. The power input to the modem is given through a 9v ac adapter as shown in fig 2. a GSM data card (equal to DCE. TA stands for Terminal Adaptor.1. Data Terminal Equipment).ON Modem Switched off Modem is connecting to the network Modem is in idle mode .Flashing Slowly .e.g. Now if there is some data to be sent to the mobile equipment then the terminal equipment that is basically a computer or processor sends out AT COMMANDS to the terminal adapter which in turn sends the mobile equipment the required data as shown in fig 3.

Bits per second (BPS): A single on-off pulse of data. Channel Separation: The separation between adjacent carrier frequencies is 200 KHz. Frequency band: The frequency rage specified for GSM is 1850 to 1990 MHz.GSM SPECIFICATIONS: Before looking at the specification. Watt (W): A measure of power of transmitter. A channel has two frequencies 80 MHz a part. the faster the data can be sent. 9-PIN D-SUB Female Connector: PIN NAME DESIGNATION TYPE 1 2 3 4 5 6 7 8 9 X None Tx Rx DSR GND DTR CTS RTS X None NC Transmit Data Receive Data Data Set Ready Ground Data Terminal Ready clear to send Request to send NC NC Input Output Output Ground Input Output Input NC . Frequency: The number of cycles per unit of time. the broader the bandwidth. Duplex Distance: The duplex distance is 80 MHz. It is measured in hertz. it is important to understand the following basic terms: Bandwidth: The range of channels limits. The duplex distance is the distance between uplink and downlink frequencies. Eight bits are equivalent to one byte. Transmission rate: GSM is a digital system with the over the air bit rate of 270 Kbps.

Command line Commands always start with AT (which means ATtention) and finish with a <CR> character. an OK string is returned. 1 stop bit. an ERROR string is returned. 8 bits data.2 GSM AT Commands : 1. RTS/CTS flow control. 3. Click the “PC Software” Icon to install Smart modem software to the specified destination directory. This indicates that the installation is completed. Select “Program Group” or “Continue” button and wait till it finish the installation and check for the message “Smart Modem Setup was completed successfully”.1. line settings A serial link handler is set with the following default values (factory settings): autobaud. If the command line has been performed successfully. Then click “OK” button. 3. except for the ATV0 DCE response format) and the ATQ1 (result code suppression) commands. the +CME ERROR: <Err> or +CMS ERROR: <SmsErr> strings are returned with different error codes. no parity. If command syntax is correct but with some incorrect parameters. +IFC and +ICF commands to change these settings. Information responses and result codes Responses start and end with <CR><LF>. Observe the Smart Modem Package in program files.exe file to start the installation.2 : PIN D-SUB Female Connector GSM (Global System for Mobile Communication) : Open the Package directory from the CD and run the setup. . click the “OK” button to continue. Please use the +IPR. 2. If command syntax is incorrect. Once “Welcome to the Smart Modem Installation Program” appears on screen.Table 3.

SMS status. This pin state (open/closed) is permanently monitored. Background initialization After entering the PIN (Personal Identification Number). and the inserted Card is not a SIM Card. The AT+CPIN? command delivers the following responses: If the SIM detect pin indicates “absent”. and the inserted Card is a SIM Card. If the SIM detect pin indicates “present”. an IMSI detach procedure is performed. SIM Removal SIM card Insertion and Removal procedures are supported. If the SIM detect pin indicates “present”. etc. These last two states are not given immediately due to background initialization. the response to AT+CPIN? is CME ERROR 10. Between the hardware SIM detect pin indicating “present” and the previous results the AT+CPIN? sends “+CME ERROR: 515” (Please wait. In the following examples <CR> and <CR><LF> are intentionally omitted. the response to AT+CPIN? is “+CPIN: xxx” depending on SIM PIN state.). 2. init in progress). SIM Insertion.). When the SIM detect pin indicates card absence. SMS etc. There are software functions relying on positive reading of the hardware SIM detect pin. all user data is removed from the product (Phonebooks. and if a SIM Card was previously inserted. .In some cases. The logical SIM session will be set up or not depending on whether the detected card is a SIM Card or not. When the SIM detect pin indicates that a card is present in the SIM connector. some SIM user data files are loaded into the product (Phonebooks. The product then switches to emergency mode. such as “AT+CPIN?” or (unsolicited) incoming events. Please be aware that it might take some time to read a large phonebook. the response to AT+CPIN? Is “+CME ERROR 10” (SIM not inserted). General behaviors : 1. the product does not return the OK string as a response. the product tries to set up a logical SIM session.

Discharge Time in string format : “yy/MM/dd. coded like GSM 03. Text mode (+CMGF=1): number of characters PDU mode (+CMGF=0): the TP data unit in octets . After this response user data is loaded (in background).The AT+CPIN? command response comes just after the PIN is checked. The reading of phonebooks will then be refused by “+CME ERROR: 515” or “+CMS ERROR: 515” meaning.40 TP-DA Data Coding Scheme. Short Messages commands 1. coded like SMS-SUBMIT first octet in document [4]. Hour. z Minute. This means that some data may not be available just after PIN entry is confirmed by ’OK’. “Please wait. when asking for +CPIN? status immediately after SIM insertion and before the product has determined if the inserted card is a valid SIM Card. Second and Time Zone [quarters of an hour] ) <fo> value is First Octet. default 17 for SMS-SUBMIT <index> <length> length of Place of storage in memory. Parameters definition <da> <dcs> <dt> Destination Address.hh :mm :ss z”(Year [00-99]. service is not available. when switching from ADN to FDN (or FDN to ADN) and trying to read the relevant phonebook immediately. This type of answer may be sent by the product at several points: when trying to execute another AT command before the previous one is completed (before response). coded like in document [5]. init in progress”. Month [01-12]. Day [01-31].

Type-of-Address of <sca>.<mem1> +CMGD). +CMSS). For SMS : GSM 04. Total number of messages locations in <mem2. Service Center Address Service Center Time Stamp in string format : “yy/MM/dd. Originator Address.hh :mm :ss ± zz” (Year/Month/Day.41 TPDU in hexadecimal format <ra> <sca> <scts> Recipient Address. <mem2> <mid> <mr> <oa> <pid> <pdu> hexadecimal Memory used to list. coded as specified in doc [4] For CBS : GSM 03. Number of messages locations in <mem2. default value is 167 . Type-of-Address of <oa>. Hour: Min: Seconds ± Time Zone) <sn> <st> <stat> <tooa> <tora> <tosca> <total1> <total2> <used1> <used2> <vp> CBM Serial Number Status of a SMS-STATUS-REPORT Status of message in memory. Protocol Identifier. Type-of-Address of <ra>. Number of message locations in <mem1>. CBM Message Identifier. Validity Period of the short message. Message Reference.40 TPDU in format. +CMGR and Memory used to write and send messages (+CMGW.11 SC address followed by GSM 03. read and delete messages (+CMGL. Total number of messages locations in <mem1>.

41(SMS AT command phase 2 version 4. In TEXT mode.0 AT+CSMS=1 Note: SMS AT command phase 2 + AT+CSMS? Note: Current values ? POSSIBLE RESPONSE +CSMS: 1.1 Description : The supported services are originated (SMS-MO) and terminated short message (SMS-MT) + Cell Broadcast Message (SMS-CB) services. either positive (RP-ACK) or negative (RP-ERROR) acknowledgement to the network is possible.1.1 OK Note: SMS.1. Acknowledge with +CNMA is possible only if the +CSMS parameter is set to 1 (+CSMS=1) when a +CMT or +CDS indication is shown (see +CNMI command).3 Defined values : <service> 0: 1: SMS AT commands are compatible with GSM 07.7.1) OK AT+CSMS=? Note :possible services 3. If no . SMS-MT and SMS-CB supported +CSMS: 1.1.7. SMS AT commands are compatible with GSM 07.0. In PDU mode.0 +CSMS: (0.40 and 03.1 OK Note: SMS.1 OK Note: GSM 03.05 Phase 2 + version COMMAND AT+CSMS=0 Note: SMS AT command phase 2 version 4.MO.1 Description : This command allows reception of a new message routed directly to the TE to be acknowledged.MO. New Message Acknowledgement +CNMA 3. 2.7. only positive acknowledgement to the network (RP-ACK) is possible. SMS-MT and SMS-CB supported +CSMS: 1. Select message service +CSMS 2.05 Phase 2 version 4.2 Syntax : 2.2.

”98/10/01.4. 32. <length> [ <CR> PDU is entered Note: PDU is entered using <ackpdu> format instead of <pdu> format (e.0.5<CR><LF> Received message Note : message received OK Note : send positive acknowledgement to the network +CMS ERROR : 340 Note : no+CNMA acknowledgement expected AT+CNMA Note : acknowledge the message received AT+CNMA Note : try to acknowledge again Example of acknowledgement of a new message in PDU mode: COMMAND AT+CMGF=0 Note : Set PDU mode POSSIBLE RESPONSE OK Note : Set PDU mode +CMT:. an RP-ERROR is sent to the network. 3.29 07913366003000F1240B913366920547 F30000003003419404800B506215D42E CFE7E17319 Note: message received .”15379”. Example of acknowledgement of a new message in TEXT mode <ctrl-Z / ESC> ] ] ] Command AT+CMGF=1 Note : Set TEXT mode AT+CNMI=2.2 Syntax : Command syntax in text mode : AT+CNMA Command syntax in PDU mode : AT+CNMA [ = <n> [ .2. the <mt> and <ds> parameters of the +CNMI command are then reset to zero (do not show new message indication).0 Note : <mt>=2 Possible responses OK Note : TEXT mode valid OK +CMT :”123456”.12:30 00=00”. SMSC address field is not present).0.129.129.g.acknowledgement is given within the network timeout.240..

Preferred Message Storage +CPMS 4.AT+CNMA=2<length><CR> …Pdu message…<Ctrl-Z/ESC> Note: negative acknowledgement for the message OK Note: negative acknowledgement to the network (RP-ERROR) with PDU Message(<ackpdu> format) 3.2 Syntax : .3 Defined values : <n>: Type of acknowledgement in PDU mode 0: 1: 2: send RP-ACK without PDU (same as TEXT mode) send RP-ACK with optional PDU message send RP-ERROR with optional PDU message <length> length>: Length of the PDU message 4. 4. writing.1 Description : This command allows the message storage area to be selected (for reading. etc).

the following message indication is sent: +CPMS: <used1>.<total1>. It is kept. It can be: . while the same SIM card is used.<total2> . <mem2> .“SM” : Memory used to write and send messages : SMS message storage in SIM (default).<used2>. read and delete messages.“SR” : Status Report message storage (in SIM if the EF-SMR file exists. If the command is correct. otherwise in the M E non volatile memory) Note : “SR” ME non volatile memory is cleared when another SIM card is inserted. even after a reset.3 Defined values : <mem1>: Memory used to list.4.“BM” : SMS message storage in SIM (default) : CBM message storage (in volatile memory). .“SM” .

Therefore. The modem is connected to PC-Comport.’2’.When <mem1> is selected.’8’. Each pair or characters is converted to a byte (e. Click OK to close the application. Modem not responding message. .’7’. If the modem is not responding.’4’. The format selected is stored in EEPROM by the +CSAS command.’D’. a complete SMS Message including all header information is given as a binary string (in hexadecimal format). then the following form is appeared as shown below Login At the application loading time.g. HOW TO RUN THE APPLICATION: Select Start --> Programs --> Smart Modem --> Smart Modem. +CMGR and +CMGD commands are related to the type of SMS stored in this memory. only the following set of characters is allowed: {‘0’.1 Description : The message formats supported are text mode and PDU mode.’F’}. all following +CMGL. ‘A’. all commands and responses are in ASCII characters.’5’. whose ASCII code is 0x41 or 65).’E’. Preferred Message Format +CMGF 5. Then check The modem is Switched Off. 5.: ‘41’ is converted to the ASCII character ‘A’. checks the modem working conditions.’3’.’1’.’9’. In PDU mode. In Text mode. ‘B’.’6’.’C’. then it displays.

then it displays. At the time of checking modem conditions. Insert the Simcard. Click OK to close the application. Wait for the selection of Command Buttons or Menu options until the Error indicates the Green Signal. Click OK to close the application. How to work with Modem: The application contains the following facilities: SMS Voice Call Data Call Internet The Menu Contains File Configuration Help Exit . other wise it indicates the Red Signal. then it displays. Port Already Open message. Check The Simcard message. If the Simcard is not inserted into Modem. Please wait Checking Modem Connections… message. If the modem is working properly Error indicator indicates the Green Signal.If the PC-Comport is already in open mode. then it displays. Then Close the Comport. if any command Buttons or Menu options are selected from application.

and Cancel buttons are shown in Disable Mode and status will be shown in the Status Bar. Select the Cancel button to Exit from the Voice Form. Baud Rate and Number of Rings. the Config. After sending the Message. If the Disconnect is selected then. Enter the phone number to send the Message. Select the Cancel button to Exit from the Configuration Form. Voice Call: Select the Voice Call option from File Menu. then Click Config Command Button At Modem Configuration time. After the Completion of Modem Configuration Config. Type the Message in Text Box (Data Must be below 150 Characters). and then open the Voice Call Form. Data Call: . and Cancel Command Buttons are shown in Enable Mode. and then open the SMS Form. Modem disconnects the connection. After the establishment of connection. SMS (Short Message Services): Select the SMS option from File Menu.Configuration: Select the Configuration option from Main Menu then open the configuration form Set the Comport. Enter the phone number to be call. if the other end is also received. Modem is Connected…. then Click the OK Button. a message is displayed Message is Send. then message is displayed. Select the Cancel button to Exit from the SMS Form.

If the modem is not initialized then message is displayed Modem not responding. open the Data Call Form. Select the Cancel button to Exit from the Send/Receive form. We can Send or Receive the data simultaneously. ”hutchgprs. Cancel options. Internet form contains Initialize. APN. If modem is initialized. Enter the phone number to get connected. If APN address is wrong message is displayed Invalid Simcard Name. If APN address is correct then it connects to Network. and then open the Internet Form. If Send/Receive is selected then. open the Send/Receive form. Again select the Initialize option. Select the Cancel button to Exit from the Data Form. If Disconnect is selected then. First select Initialize option then. select APN option then. it prompts for Simcard Name (like “airtelgprs. message is displayed Connected to Network. After the modem initialization message is displayed Modem Initialized.Select the Data Call option from File Menu. Save. After the establishment of connection. it gets disconnected. Internet: Select the Internet option from File Menu. . Send/Receive.com”. Modem gets initialized.com”). Select the Save option to save the initialized commands. Again select the APN option. Disconnect options are in Enable mode.

After saving the commands Double Click dialing icon. Because a relay is able to control an output circuit of higher power than the input circuit. a form of an electrical amplifier Operation When a current flows through the coil. the armature is returned by a force approximately half as strong as the magnetic force to its relaxed position. When the current to the coil is switched off. in a broad sense. Select the Cancel button to Exit from the Internet form. Usually this is a spring. In the original form. it can be considered to be. then it establish the Internet connection. The movement either makes or breaks a connection with a fixed contact. the switch is operated by an electromagnet to open or close one or many sets of contacts. It was invented by Joseph Henry in 1835. Relays A relay is an electrical switch that opens and closes under the control of another electrical circuit. the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. .

but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing. If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a spike of voltage and might cause damage to circuit components. Some automotive relays already include that diode inside the relay case. Alternatively a contact protection network, consisting of a capacitor and resistor in series, may absorb the surge. If the coil is designed to be energized with AC, a small copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small out-of-phase current, which increases the minimum pull on the armature during the AC cycle.[1]

The following is a 5 pin relay: _______________________________ | 1 | | | 5


o------------|---------------| | |

| |-----------/---- s | 3 | / / s s

---------|-----------o/ coil s | | | 2 |



o---s-------|---------------| | | | | | |



By analogy with the functions of the original electromagnetic device, a solid-state relay is made with a thyristor or other solid-state switching device. To achieve electrical isolation an optocoupler can be used which is a light-emitting diode (LED) coupled with a photo transistor. In the above diagram pin 3 is connected to pin 5, by default. By sending +12V between pin 1 and pin 2, you will will turn on a switch. Pin 1 and pin 2 will disconnect, and pin 5 and pin 4 will connect.

Relays…more Info

Relay showing coil and switch contacts A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and they are double throw (changeover) switches. Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection inside the relay between the two circuits, the link is magnetic and mechanical. The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the small IC current to the larger value required for the relay coil. The maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly without amplification.

Connect to COM and NO if you want the switched circuit to be on when the relay coil is on. For further information about switch contacts and the terms used to describe them please see the page on switches. COM is connected to this when the relay coil is off. You can see a lever on the left being attracted by magnetism when the coil is switched on. it is the moving part of the switch. The supplier's catalogue should show you the relay's connections. The animated picture shows a working relay with its coil and switch contacts. NO = Normally Open. There is one set of contacts (SPDT) in the foreground and another behind them. The coil will be obvious and it may be connected either way round. Connect to COM and NC if you want the switched circuit to be on when the relay coil is off. Most relays are designed for PCB mounting but you can solder wires directly to the pins providing you take care to avoid melting the plastic case of the relay. Physical size and pin arrangement If you are choosing a relay for an existing PCB you will need to ensure that its dimensions . NC = Normally Closed. To prevent damage you must connect a protection diode across the relay coil. The relay's switch connections are usually labelled COM. making the relay DPDT. always connect to this. Relay coils produce brief high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in the circuit. for example relays with 4 sets of changeover contacts are readily available. This lever moves the switch contacts.Relays are usuallly SPDT or DPDT but they can have many more sets of switch contacts. COM is connected to this when the relay coil is on. NC and NO: • • • • COM = Common. • Choosing a relay You need to consider several features when choosing a relay: 1.

6. Coil voltage The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Coil resistance The circuit must be able to supply the current required by the relay coil. For example: A 12V supply relay with a coil resistance of 400 passes a current of 30mA. 3. 2. You should find this information in the supplier's catalogue. This is OK for a 555 timer IC (maximum output current 200mA). but it is too much for most ICs and they will require a transistor to amplify the current. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value. Switch ratings (voltage and current) ) the relay's switch contacts must be suitable for the circuit they are to control. Note that the voltage rating is usually higher for AC. 5.and pin arrangement are suitable. You will need to check the voltage and current ratings. DPDT etc) ) Most relays are SPDT or DPDT which are often described as "single pole changeover" . You can use Ohm's law to calculate the current: supply voltage coil resistance Relay coil current = 4. for example: "5A at 24V DC or 125V AC". Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Switch contact arrangement (SPDT.

They are capable of switching much more rapidly than standard relays. Reed relays generally have higher coil resistances than standard relays (1000 Reed Relay Photograph © Rapid Electronics for example) and a wide range of supply voltages (9-20V for example). Current flowing through a relay coil creates a magnetic field which collapses suddenly when the current is switched off. Reed relays Reed relays consist of a coil surrounding a reed switch. but they can only switch low currents (500mA maximum for example). up to several hundred times per second. The reed relay shown in the photograph will plug into a standard 14-pin DIL socket ('IC holder'). The diagram shows how a signal diode (eg 1N4148) is connected 'backwards' across the relay coil to provide this protection. Protection diodes for relays Transistors and ICs must be protected from the brief high voltage produced when a relay coil is switched off. This prevents the induced voltage becoming high enough to cause damage to transistors and ICs. but in a reed relay current flows through the coil to create a magnetic field and close the reed switch. The protection diode allows the induced voltage to drive a brief current through the coil (and diode) so the magnetic field dies away quickly rather than instantly.(SPCO) or "double pole changeover" (DPCO). . For further information about reed switches please see the page on switches. The sudden collapse of the magnetic field induces a brief high voltage across the relay coil which is very likely to damage transistors and ICs. Reed switches are normally operated with a magnet. For further information please see the page on switches.

• • . In these cases a relay will be needed. Relays cannot switch rapidly (except reed relays). but note that a low power transistor may still be needed to switch the current for the relay's coil! The main advantages and disadvantages of relays are listed below: Advantages of relays: • • • • Relays can switch AC and DC. For switching small DC currents (< 1A) at low voltage they are usually a better choice than a relay.Relays and transistors compared Like relays. Relays can switch high voltages. Relays can switch many contacts at once. so a low power transistor may be needed to switch the current for the relay's coil. transistors can switch many times per second. Relays require more current than many ICs can provide. Disadvantages of relays: • • Relays are bulkier than transistors for switching small currents. Relays are a better choice for switching large currents (> 5A). However transistors cannot switch AC or high voltages (such as mains electricity) and they are not usually a good choice for switching large currents (> 5A). Relays use more power due to the current flowing through their coil. transistors can only switch DC. transistors can be used as an electrically operated switch. transistors cannot.

POWER SUPPLY A variable regulated power supply.5. is one where you can continuously adjust the output voltage to your requirements. Varying . also called a variable bench power supply.

To use these parts we need to build a regulated 5 volt source.1 LM7805 voltage regulator The LM7805 is simple to use. While a dedicated supply is quite handy e. 5V or 12V.1 CIRCUIT FEATURES • Brief description of operation: Gives out well regulated +5V output. The IC is shown below. especially for testing. connect the negative lead to the 8. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin. Most digital logic circuits and processors need a 5 volt power supply. Usually you start with an unregulated power To make a 5 volt power supply. This type of regulation is ideal for having a simple variable bench power supply.g. Fig 8.the output of the power supply is the recommended way to test a project after having double checked parts placement against circuit drawings and the parts placement guide. we use a LM7805 voltage regulator IC (Integrated Circuit). it's much handier to have a variable supply on hand. output current capability of 100 mA . Actually this is quite important because one of the first projects a hobbyist should undertake is the construction of a variable regulated power supply.

uses only very common basic components Design testing: Based on datasheet example circuit. I have used this circuit successfully as part of many electronics projects • • • • Applications: Part of electronics devices. reliable operation Availability of components: Easy to get.2.• Circuit protection: Built-in overheating protection shuts down output when regulator IC gets too hot • • • • Circuit complexity: Very simple and easy to build Circuit performance: Very stable +5V output voltage.2 BLOCK DIAGRAM Fig 8. small laboratory power supply Power supply voltage: Unregulated DC 8-18V power supply Power supply current: Needed output current + 5 mA Component costs: Few dollars for the electronics components + the input transformer cost 8.1 BLOCK DIAGRAM of Power supply .

3.1 Circuit DIAGRAM of Power supply .8.3EXAMPLE CIRCUIT DIAGRAM Fig 8.






You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->