Saturday, September 22, 2012

RESULT


RESULTS AND DISCUSSION
A system to effectively monitor & control the agricultural farm weather condition using LabVIEW is setup. The system can monitor & control the farm weather parameters such as temperature, humidity, and light and soil moisture content. The main advantage of system using labVIEW is that it has high accuracy. Since the system has simple front panel, the user can easily monitor & control the atmospheric condition. Moreover, the system is very simple as compared to other microcontroller system.
The centralised farm automation system is developed by using LabVIEW. For making the monitoring and controlling more easily, each parameter is designed under different tab.
9.1 TAB CONTROL
Tab controls to overlap front panel controls and indicators in a smaller area. A tab control consists of pages and tabs. We can add front panel objects to the pages of the tab control and use the tab as the selector to display each page. A page is active when the tab for that page is flush with the page and the objects on the page are visible. Terminals for controls and indicators you add to the tab control appear as any other block diagram terminal.
1
3
5
4
2
 



Fig 9.1.1: TAB Control

1.     GENERAL Tab
2.     TEMPERATURE Tab
3.     HUMIDITY Tab
4.     LIGHT INTENSITY Tab
5.     MOISTURE Tab
Each tab is designed in such a way to monitor the single parameter, but the GENERAL tab is the default tab and can monitor all the parameters at the same time.
9.2 GENERAL TAB:
Fig. 9.2.1: Front panel of GENERAL Tab
GENERAL Tab window consist of Waveform chart, process variable indicators and stop button. GENERAL Tab is the default tab which will run, when no other tab is selected to monitor the parameters. The process values of each parameter can be monitored using numerical indicators and waveform chart. This makes monitoring more accurate.

a) Waveform Chart
       TEMPERATURE Vs TIME Chart is designed to plot graph for the different values of temperature. It is calibrated in terms in terms of degree Celsius.
       HUMIDITY Vs TIME Chart is designed in such a way to display the variation in atmospheric humidity.
       LIGHT INTENSITY Vs TIME Chart is designed to plot the graph proportional to the variation in the light intensity. Its unit is candela (Cd).
       SOIL MOISTURE Vs TIME Chart indicates the presence of water content in the soil. Variation in soil moisture is plotted.
b) Process variable indicators
       Numerical indicators are used to display the process values of Temperature, Light intensity, Relative humidity and Soil moisture.
c) Stop button
       Stop button is used to stop the execution of the program and thereby to stop the execution of the parameters.
Fig 9.2.2: Block diagram of General tab

9.3 TEMPERATURE TAB:    
Fig 9.3.1: Front panel for TEMPERATURE Tab
Fig 9.3.2: Block diagram of temperature tab
a) Waveform Chart
       TEMPERATURE Vs TIME Chart is calibrated in such a way to plot the atmospheric temperature in terms of degree Celsius.
b) Thermometer
       Thermometer is calibrated and arranged in such a way to indicate the temperature in degree Celsius as similar to the temperature indicated by mercury in thermometer.
c) Control Parameters panel
       Control Parameters panel is designed and arranged in such a way to set the Set point temperature and to display the process variable and manipulated variable.
9.4  HUMIDITY TAB:
a) Waveform Chart
       RELATIVE HUMIDITY Vs TIME Chart is calibrated in such a way to plot the atmospheric humidity in terms of RH %.
b) Control Parameters panel
       Control Parameters panel is designed and arranged in such a way to set the Set point humidity and to display the process variable and manipulated variable.
c) HIGH and LOW indicators
       Indicators are used to indicate HIGH when the Relative humidity (process variable) rises above the set point value and indicate LOW when the Relative humidity decreases below the set point value.
d) Humidity meter
       Humidity meter is used to indicate the relative humidity in a calibrated scale using a needle or pointer.


Fig 9.4.1: Front panel of HUMIDITY Tab
Fig 9.4.2 : Block diagram of Humidity tab
9.5 LIGHT TAB
Fig 9.5.1: Front panel of LIGHT INTENSITY Tab
Fig 9.5.2 : Block diagram of Light intensity tab
a) Waveform Chart
       LIGHT INTENSITY Vs TIME Chart is calibrated in such a way to plot the variation in the light intensity with respect to time.
b) Control Parameters panel
       Control Parameters panel is designed and arranged in such a way to set the Set point value of light intensity and to display the process variable and manipulated variable.
c) HIGH and LOW indicators
       Indicators are used to indicate HIGH when the light intensity (process variable) rises above the set point value and indicate LOW when the light intensity decreases below the set point value.

9.6  MOISTURE TAB:
a) Waveform Chart
SOIL MOISTURE Vs TIME Chart is calibrated in such a way to plot the variation in the soil moisture with respect to time.
b) Control Parameters panel
Control Parameters panel is designed and arranged in such a way to set the Set point value of soil moisture and to display the process variable and manipulated variable.
c) HIGH and LOW indicators
Indicators are used to indicate HIGH when the soil moisture (process variable) rises above the set point value and indicate LOW when the soil moisture decreases below the set point value.

Fig 9.6.1:Front panel of MOISTURE Tab
Fig 9.6.2: Block diagram of Soil moisture tab
CHAPTER 10
ADVANTAGES AND DISADVANTAGES OF THE FARM AUTOMATION SYSTEM
ADVANTAGES
-        The system is user friendly.
-        Use of LabVIEW software reduces wired circuit
-        Hardware failure is very rare compared to embedded system.
-        Monitoring the farm parameter through the system is very easy task.
-        For further control of parameter, the LabVIEW software is helpful.
-        It gives continuous display.
DISADVANTAGE
-        The cost of the system is more compared to embedded system.











CHAPTER 11
FUTURE SCOPE
·     The importance of agricultural field is getting more relevant during these recent days. It will rise also in the future. So the system can be enhanced for controlling the atmospheric condition.
·     It can be implemented in any variety of plantations.
·     Centralised monitoring can be done effectively in the case of a wide area plantation.
·     This system can be installed in place where any of the parameters such as light, humidity, temperature, soil moisture is controlled.




CHAPTER 12
CONCLUSION
A throughout study has been made about LabVIEW. Using this project atmospheric temperature, relative humidity, light and soil moisture presence can be detected & monitored. This Centralized farm automation system which automatically monitors & control the farm is a better development in the field of agriculture because it has wide application which is relevant in the modern society.
It can be produced in the market in wide range with high accuracy. By doing this project what we have tried to do is to make just a demo of it. The most difficult part of the project was to calibrate the sensor output. It is done in maximum possible extend. With this we are concluding this main project.











BIBLIOGRAPHY
·       www.alldatasheets.com
·       www.ni.com
·       Virtual Instrumentation using LabVIEW  -  Sanjay Gupta & Joseph John
·       www.wikipedia.org








LabVIEW SOFTWARE


     
          The expanded form of LabVIEW is Laboratory Virtual Instrumentation Engineering Workbench. Graphical programming language that allows for instrument control, data acquisition, and pre/post processing of acquired data. The main feature of this program are easy to use, faster development time, graphical user interface graphical source code, easily modularized, application builder to create stand-alone executables, multi-platform compatibility(perform natural and migrate applications between platforms).The entire Measurement and Automated system can be controlled with  LabVIEW locally, or over the Internet. LabVIEW can acquire data by using DAQ. LabVIEW includes the following tools analyze the data:
-        Analysis Vis for differential equations, optimization, curve fitting, calculus, linear algebra, statistics, etc.
-        Signal processing Vis for filtering, windowing transforms, peak detection, harmonic analysis, spectrum analysis etc.
LabVIEW version 7 has introduced a new concept in interfacing- the use of assistants. The idea behind the introduction is to provide a user interactive way for development of data acquisition, instrument interfacing and code analysis. Thus the assistants provide a user friendly face to the somewhat complex task of interfacing, be it an instrument or a multifunction device. The DAQ assistant icon when placed on the diagram initializes itself and comes up with a display appropriate to the hardware installed.
LabVIEW relies on graphical symbols rather than textual language to describe programming actions. The principle of data flow, in which the functions execute only after receiving the following data, governs execution in straightforward manner. LabVIEW programs are called virtual instruments (VIs) because their appearance and operation imitate actual instruments. However they are analogous to main programs, functions and subroutines from popular languages like C, FORTRAN, and Pascal etc. In LabVIEW we can create or use “Virtual instruments” (VI) for data acquisition. A VI allows computer screen to act as an actual laboratory instrument with characteristics tailored to particular needs. We can also use build-in examples, or use standard templates for setting up your data acquisition input channels.   

BENEFITS

1. Interfacing

A key benefit of LabVIEW over other development environments is the extensive support for accessing instrumentation hardware. Drivers and abstraction layers for many different types of instruments and buses are included or are available for inclusion. These present themselves as graphical nodes. The abstraction layers offer standard software interfaces to communicate with hardware devices. The provided driver interfaces save program development time. The sales pitch of National Instruments is, therefore, that even people with limited coding experience can write programs and deploy test solutions in a reduced time frame when compared to more conventional or competing systems. A new hardware driver topology (DAQmxBase), which consists mainly of G-coded components with only a few register calls through NI Measurement Hardware DDK (Driver Development Kit) functions, provides platform independent hardware access to numerous data acquisition and instrumentation devices. The DAQmxBase driver is available for LabVIEW on Windows, Mac OS X and Linux platforms.
Although not a .NET language, Labview also offers an interface to .NET Framework assemblies, which makes it possible to use, for instances, databases and XML files in automation projects.

1.     Code compilation

In terms of performance, LabVIEW includes a compiler that produces native code for the CPU platform. The graphical code is translated into executable machine code by interpreting the syntax and by compilation. The LabVIEW syntax is strictly enforced during the editing process and compiled into the executable machine code when requested to run or upon saving. In the latter case, the executable and the source code are merged into a single file. The executable runs with the help of the LabVIEW run-time engine, which contains some precompiled code to perform common tasks that are defined by the G language. The run-time engine reduces compile time and also provides a consistent interface to various operating systems, graphic systems, hardware components, etc. The run-time environment makes the code portable across platforms. Generally, LabVIEW code can be slower than equivalent compiled C code, although the differences often lie more with program optimization than inherent execution speed.

 3. Large libraries

Many libraries with a large number of functions for data acquisition, signal generation, mathematics, statistics, signal conditioning, analysis, etc., along with numerous graphical interface elements are provided in several LabVIEW package options. The number of advanced mathematic blocks for functions such as integration, filters, and other specialized capabilities usually associated with data capture from hardware sensors is immense. In addition, LabVIEW includes a text-based programming component called Math Script with additional functionality for signal processing, analysis and mathematics. Math Script can be integrated with graphical programming using "script nodes" and uses a syntax that is generally compatible with MATLAB.

 4. Code re-use

The fully modular character of LabVIEW code allows code reuse without modifications: as long as the data types of input and output are consistent, two sub VIs are interchangeable. The LabVIEW Professional Development System allows creating stand-alone executables and the resultant executable can be distributed an unlimited number of times. The run-time engine and its libraries can be provided freely along with the executable. A benefit of the LabVIEW environment is the platform independent nature of the G code, which is (with the exception of a few platform-specific functions) portable between the different LabVIEW systems for different operating systems (Windows, Mac OS X and Linux). National Instruments is increasingly focusing on the capability of deploying LabVIEW code onto an increasing number of targets.

 5. Parallel Programming

With LabVIEW it is very easy to program different tasks that are performed in parallel by means of multithreading. This is, for instance, easily done by drawing two or more parallel while loops. This is a great benefit for test system automation, where it is common practice to run processes like test sequencing, data recording, and hardware interfacing in parallel.
        A VI has three main parts:
1.  
The front panel: This is an interactive user interface of VI, so named because it can simulate the front panel of the physical instrument. Simply put, the front panel is the window through which the user interacts with the program. When we run VI we must have the front panel open such that we can input dada to the executing program. The front panel where you see your program’s output. The front panel is primarily the combination of controls and indicators. Components of the front panel are controls = inputs from the user = source terminals, indicators = outputs to the user = destinations.


Fig. 8.1: Front Panel of labVIEW software
2.   The block (or wiring) diagram: it is the Vis source code, constructed in LabVIEW’s graphical programming language: G. It is the actual executable program. Subroutine in the block diagram of VI. The block diagram window holds the graphical source code of a LabVIEW VI – it is the actual executable code.

    You construct the block diagram by wiring together the objects that perform specific functions. The various components of a block diagrams are terminals, nodes, and wires.
Fig. 8.2: Block Diagram of labVIEW software
Icons/connectors: A LabVIEW VI is held together wires connecting nodes and terminals; they deliver data from one source terminals to one or more destination 

CENTRALISED MONITORING AND CONTROLLING SYSTEM



Virtual instrument is that in the general computer platform, users define and design the testing functions of equipment according to requirements, making users operate the machine like operate the same equipment designed by them. The emergence of the concept of virtual instruments, breaking the traditional definition of equipment from manufacturers, users can not change the work mode, users can make according to its own needs, design their own instrument system, in the testing system and equipment design to make full use of software instead of hardware, take full advantage of computer technology and expansion of the traditional test systems and equipment functions. "Software is equipment" is the simplest concept of virtual instrument also is the most essential expression. Virtual machines cannot work without computer control; design software of virtual instrument is the most important and most complex part.
Usually instrumentation manufacturers provide specific functions to given architecture and fixed interfaces for measuring devices, and thus limit the application domain of these devices. In actual use much time is required for adjusting the measuring range and for saving and documenting the results. The advent of microprocessors in the measurement and instrumentation fields produced rapid modifications of measuring device technology, soon followed by the appearance of computer-based measurement techniques. A single user controls the system, which runs exclusively on a piece of hardware. The measurement consists of three parts, as shown in Fig.7.1, acquisition of measurement data or signals, conditioning and processing of analysis of measurement signals and presentation of data
Figure 7.1: measurement of data
The concept of virtual instrument is frequently used in industrial measurement practice, but not always with precisely the same meaning. For some people, virtual instruments are based on standard computers and represent systems for storage, processing and presentation of measurement data. For others, a virtual instrument is a computer equipped with software for a variety of uses including drivers for various peripherals, as well as analogue to digital and digital to analogue converters, representing an alternative to expensive conventional instruments with analogue displays and electronics. Both views are more or less correct. Acquisition of data by a computer can be achieved in various ways and for this reason the understanding of the architecture of the measuring instrument becomes important.

A virtual instrument can be defined as an integration of sensors by a PC equipped with specific data acquisition hardware and software to permit measurement data acquisition, processing and display. A virtual instrument can replace the traditional front panel equipped with buttons and display by a virtual front panel on a PC monitor. Virtual instruments are a means of integration of the display, control and centralization of complex measurement systems. Industrial instrumentation applications, however, require high rates, long distances, and multi- vendor instrument connectivity based on open industrial network protocols. In order to construct a virtual instrument it is necessary to combine the hardware and software elements which should perform data acquisition and control, data processing and data presentation in a different way to take maximum advantage of the PC. It seems that in the future the restrictions of instruments will move more and more from hardware.

7.1 BASIC COMPONENTS OF SYSTEM
     The basic components of all virtual instruments include a computer and a display, the virtual instrument software, driver software and the instrument hardware.

1.     Computer and Display
The computer and the display are the heart of virtual instrument systems. These systems are typically based on a personal computer or workstation with a high resolution monitor, a keyboard, and a mouse. It is important for the chosen computer to meet the system requirement specified by the instrumentation software packages. Rapid technological advancements of PC technology have greatly enhanced virtual instrumentation. Moving from DOS to Windows gave to PC users the graphical user interface and made 32-bit software available for building virtual instruments. The advances in processor performance supplied the power needed to bring new applications within    the scope of virtual instrumentation. Faster bus architectures (such as PCI) have eliminated the traditional data transfer bottleneck of older buses. The future of virtual instrumentation is tightly coupled with PC technology.
2.     Software
If the computer is the heart of the virtual instrument systems, the software is their brain. The software uniquely defines the functionality and personality of the virtual instrument system. Most software is designed to run on industry standard operating systems on personal computers and workstations. Currently the most popular way of programming is based on the high-level tool software. With easy-to-use integrated development tools, design engineers can quickly create, configure and display measurements in a user-friendly form, during product design, and verification. The most known, popular tool is LabVIEW (Laboratory Virtual Instrument Engineering Workbench) | is a highly productive graphical programming language for building data acquisition and instrumentation systems. To specify the system functionality one intuitively assembles block diagrams a natural design notation for engineers. Its tight integration with measurement hardware facilities gives rapid development of data acquisition, analysis and presentation of solutions.
3. Instrument Hardware
The preceding subsection on interfaces also touches on the attributes found in each of the respective instrument hardware products. One note is worth to be repeated: Virtual instrumentation never eliminates the instrument hardware completely. To measure the real world there will always be some sort of measurement hardware, sensor, transducer and conditioning circuit, but the physical form factor of this instrumentation may continue to evolve.
4. Driver software
Today drivers for most instruments, as well as interfacing hardware are available either free or nominal cost. This reduces the cost and development time for application utilising these products. In today’s environment, it is almost mandatory for an instrument developer to provide a driver on one or more of VI platforms. To cater to popular hardware where manufacture does not provide support for VI, there is now a very large number of small vendors splicing in the development of these drivers. Many of examples, labVIEW drivers are available as downloads for almost all instrument of Tektronix, AAGILENT etc.

CONTROLLERS


  CONTROLLERS
In this new Farm automation system, we are using different controllers to control the parameters such as temperature, light, soil moisture and atmospheric humidity. The detailed descriptions of these controllers are given below.
5.1 SOIL MOISTURE CONTROLLER
A water system needs to move the water produced from the source to its customers. In almost all cases, the source is at a lower elevation than the user so the water must be raised to a higher level. Some type of pumping equipment must be used to generate the pressure for raising the water to the higher elevation. Since centrifugal pump delivers a constant flow of water at a constant pressure for any given set of conditions, it is ideal for delivering water to customers. Most well pumps are centrifugal pumps. They are ideal for use in the distribution system since they do not produce pulsating surges of flow and pressure. This pump operates on the theory of centrifugal force. As the impeller rotates in the pump case, it tends to push water away from the centre of the rotation. As the water is pushed away from the centre of the impeller, additional water is pulled into the eye, or centre, of the impeller. The water that has been pushed to the outside of the impeller is removed from the pump through the discharge piping. This water will have a pressure that is determined by the pitch of the impeller and the speed at which the impeller is turning. There are many types of centrifugal pumps, but they all have major parts in common
1. Pump Case
    The pump case or volute is designed to allow the liquid being pumped to move to the centre of the impeller as well as to allow the water to be removed from the pump through the discharge. The case, which fits closely around the impeller on all but the discharge side, is made of cast iron or brass. If the liquid is abrasive or corrosive, other materials, such as a rubber lining, may be used.
2. Impellers
    The impeller generates the centrifugal force that moves the liquid. Variations in the impeller are based on whether a particular application calls for large quantities of water, high pressure, or both. The design of the impeller is important to the development of pressure and flow.
The submersible pump is especially suited to deep well and booster service for industrial, commercial, and municipal water systems. The pump utilizes a submersible motor coupled directly to the bowl assembly and is designed to operate completely submerged in the fluid being pumped. Power is supplied to the motor by waterproof electrical cable. In deep well applications the pump motor and cable are suspended in the well by the riser pipe. Booster applications involve installing the unit in a steel suction barrel or horizontally in a pipe line. Since the entire unit is either enclosed or below the surface of the ground, there are several applications where the submersible pump has many advantages.

1.     Extremely deep wells where problems with shafting are likely to be encountered.
2.     In installations where flooding would damage standard above ground motors.
3.     Applications such as boosters pumps which require quiet operation.
4.     Installations where there is little or no floor space.
5.     Horizontal pipeline booster pumps placed directly in the pipeline where conditions require a minimum amount of excavation or use of land surface.

Submersible pumps may be operated and controlled in the same manner as any other type of turbine pump in similar applications. No special consideration peculiar to the submersible is generally necessary, with the exception of the motor starting equipment.
.                                      

Fig.5.1.1 submersible pump
5.2  HUMIDITY CONTROLLER
A mechanical fan is a machine used to create flow within a fluid, typically a gas such as air. A fan consists of a rotating arrangement of vanes or blades which act on the air. Usually, it is contained within some form of housing or case. This may direct the airflow or increase safety by preventing objects from contacting the fan blades. Most fans are powered by electric motors, but other sources of power may be used, including hydraulic motors and internal combustion engines and solar power. Fans produce air flows with high volume and low pressure, as opposed to compressors which produce high pressures at a comparatively low volume. A fan blade will often rotate when exposed to an air stream, and devices that take advantage of this, such as anemometers and wind turbines, often have designs similar to that of a fan. Typical applications include climate control and personal thermal comfort (e.g., an electric table or floor fan), vehicle and machinery cooling systems, ventilation, fume extraction, winnowing, removing dust (e.g. in a vacuum cleaner), drying (usually in combination with heat) and to provide draft for a fire.
While fans are often used to cool people, they do not actually cool air (if anything, electric fans warm it slightly due to the warming of their motors), but work by evaporative cooling of sweat and increased heat conduction into the surrounding air due to the airflow from the fans. Thus, fans may become ineffective at cooling the body if the surrounding air is near body temperature and contains high humidity.
Fig.5.2.1 axial fans
The axial-flow fans have blades that force air to move parallel to the shaft about which the blades rotate. Axial fans blow air along the axis of the fan, linearly, hence their name. This type of fan is used in a wide variety of applications, ranging from small cooling fans for electronics to the giant fans used in wind tunnels. Axial flow fans are applied for air conditioning and industrial process applications. Standard axial flow fans have diameters from 300-400 mm or 1800 to 2000 mm and work under pressures up to 800 Pa.
Examples of axial fans are:
  • Table fan: Basic elements of a typical table fan include the fan blade, base, armature and lead wires, motor, blade guard, motor housing, oscillator gearbox, and oscillator shaft. The oscillator is a mechanism that moves the fan from side to side. The axle comes out on both ends of the motor, one end of the axle is attached to the blade and the other is attached to the oscillator gearbox. The motor case joins to the gearbox to contain the rotor and stator. The oscillator shaft combines to the weighted base and the gearbox. A motor housing covers the oscillator mechanism. The blade guard joins to the motor case for safety.
  • Ceiling fan: A fan suspended from the ceiling of a room is a ceiling fan. Ceiling fans can be found in both residential and industrial/commercial settings.
  • In automobiles, a mechanical fan provides engine cooling and prevents the engine from overheating by blowing or sucking air through a coolant-filled radiator. It can be driven with a belt and pulley off the engine's crankshaft or an electric fan switched on or off by a thermostatic switch.
  • Computer cooling fan.
5.3 LIGHT INTENSITY CONTROLLER
The incandescent light bulb produces light by heating a filament wire to a high temperature until it glows. The hot filament is protected from oxidation in the air with a glass enclosure that is filled with inert gas or evacuated. In a halogen lamp, filament evaporation is prevented by a chemical process that redeposit’s metal vapour onto the filament, extending its life. The light bulb is supplied with electrical current by feed-through terminals or wires embedded in the glass. Most bulbs are used in a socket which provides mechanical support and electrical connections.
Incandescent bulbs are manufactured in a wide range of sizes, light output, and voltage ratings, from 1.5 volts to about 300 volts. They require no external regulating equipment, have low manufacturing costs, and work equally well on either alternating current or direct current. As a result, the incandescent lamp is widely used in household and commercial lighting, for portable lighting such as table lamps, car headlamps, and flashlights, and for decorative and advertising lighting. Some applications of the incandescent bulb deliberately use the heat generated by the filament. Such applications include incubators, brooding boxes for poultry, heat lights for reptile tanks infrared heating for industrial heating and drying processes, and the Easy-Bake Oven toy. But waste heat can also significantly increase the energy required by a building's air conditioning system. Incandescent light bulbs consist of an air-tight glass enclosure (the envelope, or bulb) with a filament of tungsten wire inside the bulb, through which an electric current is passed. Small wires embedded in the stem in turn support the filament and its lead wires. The bulb is filled with an inert gas such as argon (93%) and nitrogen (7%) to reduce evaporation of the filament and prevent its oxidation. Early lamps and some small modern lamps used only a vacuum to protect the filament from oxygen. Filament temperatures depend on the filament type, shape, size, and amount of current drawn. The heated filament emits light that approximates a continuous spectrum.
Figure 5.3.1 incandescent bulb


CHAPTER 6
RELAYS
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.
Fig. 6.1 Relay switch

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 main circuit. There is no electrical connection inside the relay between the two circuits; the link is magnetic and mechanical.
The relay’s switch connections are usually labelled COM, NC and NO:
·       COM=Common, always connect to this, it is the moving part of the switch.
·       NC=Normally Closed, COM is connected to this when the relay coil is off.
·       NO=Normally Open, COM is connected to this when the relay coil is on.

Fig. 6.2: Normally open/close connections

6.1 RELAY SELECTION
We need to consider several features when choosing a relay:
·       Physical size and pin arrangement
If we are choosing a relay for an existing PCB you will need to ensure that its dimensions and pin arrangement are suitable. We should find this information in thee supplier’s catalogue.
·       Coil voltage
The relay’s coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value.
·       Coil current
The circuit must be able to supply the current required by the relay coil. You can use Ohm’s law to calculate the current:
                        Relay coil current = supply voltage / Coil resistance
·       Switch ratings (voltage and current)
The relay’s switch contacts must be suitable for the circuit they are to control.
·       Switch contact arrangement (SPDT, DPDY etc)
Most relays are SPDT or DPDT which are often described as “single pole changeover” (SPCO) or “double pole changeover” (DPCO).
6.2  PROTECTION DIODES FOR RELAYS
       Transistors and ICs (chips) must be protected from the brief high voltage ‘spike’ produced when the relay the coil is switched off. The diagram shows how a signal diode (eg 1N4148) is connected across the relay coil to provide this protection.
       Note that the diode is connected ‘backwards’ so that it will normally not conduct. Conduction only occurs when the relay coil is switched off, at this moment current tries to continue flowing through the coil and it is harmlessly diverted through the diode. Without the diode no current could flow and the coil would produce a damaging high voltage ‘spike’ in its attempt to keep the current flowing.
Fig 6.2.1: Protection circuitry for Relays