03-11-2016, 12:18 PM
1463980142-project.docx (Size: 301.38 KB / Downloads: 7)
ABSTRACT:
In the field of agriculture, use of proper method of the protection and irrigation is important. The project makes the protection and irrigation automated. With the use of low cost sensors and the simple circuitry makes this project is a low cost product, which can be bought even by a poor farmer. This project is best suited for places where water is scares and has to be used in limited quantity and it is used for protection of farm from various attacks. The heart of the project is the microcontroller. Protection of the farm is done by using PIR sensor, Beeper, Electrical fence and Temperature sensor. For irrigation a wetness sensor is used which checks the moisture level of the soil.
Keyword: Microcontroller, PIR Sensor, Electrical Fence, Wetness Sensor, Temperature Sensor.
INTRODUCTION:
In our country we usually come across irrigation systems that are manually operated and hence the exact amount of water required by the plants is not known, to overcome this problem the automated system is being designed, also we have been seeing in the newspapers and media that many animals are being killed by the very high voltage electric wires or drugging and killing the animals by poisoning them. This is against law and also against ethics of humanity. Hence it is proposed to design and develop an embedded based system to control the water requirement for the plants and warn the animals from entering into the fields of the farmers. Instead if they use this security system the animals are scared by sound so that they are run back into the forests.
The proposed system consists of the microcontroller which regulates the motor and the sensors used in the system. The complete system can be explained in two parts. i)Protection System: This part of system consists of a specialized sensor called PIR (Passive Infra Red) device which detects the infra red rays emitted by the body of wild animals. PIR sensor also detects the motion of any animal with reasonable size. In a PIR-based motion detector, the PIR sensor is typically mounted on a printed circuit board which also contains the necessary electronics required to interpret the signals from the chip. The complete circuit is contained in a housing which is then mounted in a location where the sensor can view the area to be monitored. Infrared energy is able to reach the sensor through the window because the plastic used is transparent to infrared radiation (but only translucent to visible light).It is planned to connect the PIR sensor to RISC controller so that the detection of wild animals can be sensed and signal is transmitted to the controller which could be far away and kept in a safe control room. The monitoring system or controller is based on RISC microcontroller Atmega32. The system will have digital display and a keypad to set time of activation and deactivation of the PIR sensor. The controller generates siren sound which acts as a deterrent sound for the animals. The controller program is written in embedded C language. The compiler is GNU C compiler and the AVR studio 4.12 to be used as an IDE for program development debugging and porting the program into Atmega 32 using STK500 programmer. ii)Irrigation System: In this part of the project the main work of the micro controller is to control the flow of water depending on the moisture content of the soil, to do so our main objective is to design the automatic on and off motor. If the water content of the soil is less, then the water is supplied automatically through the solenoid valve or by switching on the irrigation pump and is kept open for the specified amount of time which can be manually set through LCD and KEYBOARD interface. The complete system uses RISC based MicroController, lcd, relay, ac motor, and sensors. Sensors may be steel rods through which the change of the leakage current is calculated, which is directly proportional to the water content in the soil. The sensors will sense the water content in the soil and data is fed to Microcontroller.
MICROCONTROLLER (ATMEGA 32):
Port A (PA7….PA0): Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port B (PB7….PB0): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also serves the functions of various special features of the ATmega32 as listed.
Port C (PC7….PC0): Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5 (TDI), PC3 (TMS) and PC2 (TCK) will be activated even if a reset occurs. The TD0 pin is tri-stated unless TAP states that shift out data are entered. Port C also serves the functions of the JTAG interface and other special features of the ATmega32 as listed.
Port D (PD7….PD0): Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also serves the functions of various special features of the ATmega32 as listed.
RESET: Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.
XTAL1: Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
XTAL2: Output from the inverting Oscillator amplifier.
AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter.
AREF: AREF is the analog reference pin for the A/D Converter.
In order to maximize performance and parallelism, the AVR uses Harvard architecture– with separate memories and buses for program and data. Instructions in the program memory are executed with a single level pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables instructions to be executed in every clock cycle. The program memory is In- System Reprogrammable Flash memory.
The fast-access Register File contains 32 x 8-bit general purpose working registers with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In a typical ALU operation, two operands are output from the Register File, the operation is executed, and the result is stored back in the Register File – in one clock cycle.
Six of the 32 registers can be used as three 16-bit indirect addresses register pointers for Data Space addressing – enabling efficient address calculations. One of the address pointers can also be used as an address pointer for look up tables in Flash Program memory. These added function registers are the 16-bit X-, Y-, and Z-register, described later in this section.
The ALU supports arithmetic and logic operations between registers or between a constant and a register. Single register operations can also be executed in the ALU. After an arithmetic operation, the Status Register is updated to reflect information about the result of the operation.
Program flow is provided by conditional and unconditional jump and call instructions, able to directly address the whole address space. Most AVR instructions have a single16-bit word format. Every program memory address contains a 16- or 32-bit instruction. Program Flash memory space is divided in two sections, the Boot program section and the Application Program section. Both sections have dedicated Lock bits for write and read/write protection. The SPM instruction that writes into the Application Flash memory section must reside in the Boot Program section.
During interrupts and subroutine calls, the return address Program Counter (PC) is stored on the Stack. The Stack is effectively allocated in the general data SRAM, and consequently the Stack size is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the SP in the reset routine (before subroutines or interrupts are executed). The Stack Pointer SP is read/write accessible in the I/O space. The data SRAM can easily be accessed through the five different addressing modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps. A flexible interrupt module has its control registers in the I/O space with an additional global interrupt enable bit in the Status Register. All interrupts have a separate interrupt vector in the interrupt vector table. The interrupts have priority in accordance with their interrupt vector position. The lower the interrupt vector address, the higher the priority.
The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, SPI, and other I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations following those of the Register File.
8-bit Timer/Counter 0:Timer/Counter0 is a general purpose, single compare unit, 8-bit Timer/Counter module. The main features are:
Single Compare Unit Counter.
Clear Timer on Compare Match (Auto Reload).
Glitch-free, Phase Correct Pulse Width Modulator (PWM).
Frequency Generator.
External Event Counter.
10-bit Clock Prescalers.
Overflow and Compare Match Interrupt Sources (TOV0 and OCF0).
Timer/Counter Control Register – TCCR0:
When the OCIE0 bit is written to one, and the I-bit in the Status Register is set (one), the Timer/Counter0 Compare Match interrupt is enabled. The corresponding interrupt is executed if a compare match in Timer/Counter0 occurs, i.e., when the OCF0 bit is set in the Timer/Counter Interrupt Flag Register – TIFR.
Bit 0 – TOIE0: Timer/Counter0 Overflow Interrupt Enable
When the TOIE0 bit is written to one, and the I-bit in the Status Register is set (one), the Timer/Counter0 Overflow interrupt is enabled. The corresponding interrupt is executed if an overflow in Timer/Counter0 occurs, i.e., when the TOV0 bit is set in the Timer/Counter Interrupt Flag Register – TIFR.
ANALOG TO DIGITAL CONVERTER:
The ADC is connected to an 8-channel Analog Multiplexer which allows 8 single-ended voltage inputs constructed from the pins of Port A.The single-ended voltage inputs refer to 0V (GND). The device also supports 16 differential voltage input combinations. Two of the differential inputs (ADC1, ADC0 and ADC3, ADC2) are equipped with a programmable gain stage, providing amplification steps of 0 dB (1x), 20 dB (10x), or 46 dB (200x) on the differential input voltage before the A/D conversion. Seven differential analog input channels share a common negative terminal (ADC1), while any other ADC input can be selected as the positive input terminal. If 1x or 10x gain is used, 8-bit resolution can be expected. If 200 x gains are used, 7-bit resolution can be expected.
The ADC contains a Sample and Hold circuit which ensures that the input voltage to the ADC is held at a constant level during conversion. A block diagram of the ADC is shown in Figure 2.7. The ADC has a separate analog supply voltage pin, AVCC. AVCC must not differ more than ±0.3 V from VCC. Internal reference voltages of nominally 2.56V or AVCC are provided On-chip. The voltage reference may be externally decoupled at the AREF pin by a capacitor for better noise performance.
PROTECTION SYSTEM:
The protection system consist of I) fence protection ii) fire protection. The fence protection consists of PIR sensor, Buzzer and LED. The fire protection consist of thermistor sensor and motor .
PIR sensor: The most common type of sensor seen mostly in home installation is the infrared sensor, as it tends to be cheaper and more reliable than microwave sensors. This type of sensor utilizes the infrared light spectrum, which is an invisible light that emanates from any heat source. The sensor measures the heat of any object that passes by it, and compares this heat to a background setting, such as a wall. One of the drawbacks of infrared sensors though, is that they don't actually cover a full room. It covers a scanned area, kind of like fingers pointing out into the coverage area. The area between the fingers is not covered. The plus side though, is that different lenses can be used, depending on the environment the sensor is in. For example, a long hallway can use a lower angle lens (approx 30 degrees) that covers a greater distance.
PIR-based motion detector, the PIR sensor is typically mounted on a printed circuit board which also contains the necessary electronics required to interpret the signals from the chip as shown in fig 3.13. The complete circuit is contained in a housing which is then mounted in a location where the sensor can view the area to be monitored. Infrared energy is able to reach the sensor through the window because the plastic used is transparent to infrared radiation (but only translucent to visible light). This plastic sheet prevents the introduction of dust and insects which could obscure the sensor's field of view. A few mechanisms have been used to focus the distant infrared energy onto the sensor surface. The window may have Fresnel lenses moulded into it. Cylindrical facet lens in front of PIR sensor. Each facet (rectangle) is a Fresnel lens. Alternatively, sometimes PIR sensors are used with plastic segmented parabolic mirrors to focus the infrared energy; when mirrors are used, the plastic window cover has no Fresnel lenses moulded into it.
The PIR device can be thought of as a kind of infrared 'camera' which remembers the amount of infrared energy focused on its surface. Once power is applied to the PIR the electronics in the PIR shortly settle into a quiescent state and energize a small relay. If the amount of infrared energy focused on the sensor changes within a configured time period, the device will switch the state of the alarm output relay.
A person entering the monitored area is detected when the infrared energy emitted from the intruder's body is focused by a Fresnel lens or a mirror segment and overlaps a section on the chip which had previously been looking at some much cooler part of the protected area. That portion of the chip is now much warmer than when the intruder wasn't there. As the intruder moves, so does the hot spot on the surface of the chip. This moving hot spot causes the electronics connected to the chip to de-energize the relay, operating its contacts, thereby activating the detection input on the alarm control panel. Conversely, if an intruder were to try to defeat a PIR perhaps by holding some sort of thermal shield between himself and the PIR, a corresponding 'cold' spot moving across the face of the chip will also cause the relay to de-energize — unless the thermal shield has the same temperature as the objects behind it. Manufacturers recommend careful placement of their products to prevent false alarms. They suggest mounting the PIRs in such a way that the PIR cannot 'see' out of a window.
PIRs come in many configurations for a wide variety of applications. The most commonly used home security systems has numerous Fresnel lenses or mirror segments and has an effective range of about thirty feet. PIRs can have more than one internal sensing element so that, with the appropriate electronics and Fresnel lens, it can detect direction. Left to right, right to left, up or down and provide an appropriate output signal.
The 'logic' of the PIR sensor is that it must detect 'significant change' of the normal level of heat within the 'field' of its view. The circuits that control it must be able to determine what 'normal' is, and then close a switch when the normal field changes, as when a human walks in front of it. It must also be able to 'tolerate' slow changes within the field, and remember that as the new 'normal'. This is so that gradual changes like the sunlight changes throughout the day, don't cause a false alarm. This is a standard behaviour of 'PIR' type sensors. PIRs can have more than one internal sensing element so that, with the appropriate electronics and Fresnel lens, it can detect direction. Left to right, right to left, up or down and provide an appropriate output signal.
BUZZER:
A buzzer is a mechanical, electrochemical ,magnetic, electromagnetic ,electro acoustic or piezo electric audio signalling device. A piezo electric buzzer can be driven by an oscillating electronic circuit or other audio signal source.
LED:
A light emitting diode is a two lead semiconductor light source it is a pre-junction diode which emits light when activated. When suitable voltage is applied to the leads. Electrons are able to recombine with electrons holes with in the device, releasing the energy in the from of photons.
THERMISTOR SENSOR:
A thermistor is a temperature sensing element composed of sintered semiconductor material which exhibits a large change in temperature. Thermistors usually have negative temperature coefficients which means the resistance of the thermisteor decreases the temperature increases
FIG4: Thermistor sensor
MOTOR:
A dc motor is any of a class of electrical machines that converts direct current electrical power into mechanical power. The most common types rely on the forces produced by magnetic fields. Nearly all types of dc motors have some internal mechanism, either electromechanical or electronic ,to periodically change the direction of current flow in the part of the motor .most types produce rotary motion; a linear motor directly produces force and motion in a straight line .
In this paper we are going to use synchronous motors (brushless motor).typically brushless dc motors use one or more permanent magnets in the rotor and electromagnets on the motor housing for the stator .A motor controller converts DC to AC .this design is mechanically simpler than that of brushed motors because it eliminates the complication of transferring power from outside the motor to the spinning rotor.
IRRIGATION SYSTEM:
The irrigation system consists of moisture sensor and motor.
MOISTURE SENSOR:
Moisture sensor measure the volumetric water content indirectly by using some other property of the soil such as electrical resistance ,dielectric constant or interaction with neutrons as a proxy fro the moisture content the relation between the measured property and soil moisture must be calibrated and vary depending on environmental factors such as soil type, temperature, or electric conductivity. Elected microwave radiation is effected by the soil moisture and is used for remote sensing in hydrology and agriculture. Portable probe instruments can be used by farmers or gardeners.