Final Report Acs 12
-
Upload
abhishek-singh -
Category
Documents
-
view
39 -
download
3
Transcript of Final Report Acs 12
1
PROBLEM STATEMENT
GBPUAT is an agro-based university with considerable efforts of research being
applied in this field through experimentation; therefore a large part of these studies takes
place in the several polyhouses that are installed across the university campus. To provide
these installations with a low-cost ventilation temperature control system, our project aims to
fulfill this very need.
The project aims to automatically control and regulate the speed of Induction Motor
according to the current temperature of the surroundings thereby increasing the air flow rate
and bringing about a resultant decrease in temperature. It is aimed at designing an integrated
low cost solution that can be easily installed in external environments of
Polyhouses/Greenhouses and to remove the need for manual control of the ventilation
system.
2
Chapter 1: INTRODUCTION
The concept of this project is to create an Automatic Temperature Control System to
control the temperature of a system. The circuit maintains the temperature of the system in a
particular range. The fan RPM increases with increase in temperature and vice versa. For the
circuit, it consists of Temperature Sensing Unit, ATMEGA16 microcontroller, LCD Module,
Switching Device, Driver Circuit and a Fan. It will operate based on the values or ranges of
temperature in the system which is detected by the Temperature Sensor.
The Temperature Sensor detects the temperature of the system. The Temperature
Sensor consists of an LM35 IC. The temperature sensor is connected to the ADC input of the
ATMEGA16 microcontroller. It converts the analog input to a digital value. The
ATMEGA16 generates Pulse Width Modulation (PWM) value according to the temperature
sensor value. The ATMEGA16 is connected to a driver circuitwhich regulates the speed of
the fan. The LCD module is also connected to the ATMEGA16 microcontroller. The LCD
module displays the current temperature and PWM value.
3
Chapter 2: LITERATURE REVIEW
2.1 DC Motor:
A DC motor is a mechanically commutated electric motor powered from direct
current (DC). The stator is stationary in space by definition and therefore its current. The
current in the rotor is switched by the commutator to also be stationary in space. This is how
the relative angle between the stator and rotor magnetic flux is maintained near 90 degrees,
which generates the maximum torque.
DC motors have a rotating armature winding (winding in which a voltage is induced)
but non-rotating armature magnetic field and a static field winding (winding that produce the
main magnetic flux) or permanent magnet. Different connections of the field and armature
winding provide different inherent speed/torque regulation characteristics. The speed of a DC
motor can be controlled by changing the voltage applied to the armature or by changing the
field current. The introduction of variable resistance in the armature circuit or field circuit
allowed speed control. Modern DC motors are often controlled by power electronics systems
called DC drives.
The introduction of DC motors to run machinery eliminated the need for local steam
or internal combustion engines, and line shaft drive systems. DC motors can operate directly
from rechargeable batteries, providing the motive power for the first electric vehicles. Today
DC motors are still found in applications as small as toys and disk drives, or in large sizes to
operate steel rolling mills and paper machines.
The speed of a d.c. motor is given by:
N=(V-IR)/Ф (2.1)
It is clear that there are three main methods of controlling the speed of a d.c. motor, namely:
(i) By varying the flux per pole. This is known as flux control method.
(ii) By varying the resistance in the armature circuit. This is known as armature control
method.
(iii) By varying the applied voltage V. This is known as voltage control method.
4
2.2 Controlling dc motor speed with Pulse Width Modulation (PWM)
PWM is an effective method for adjusting the amount of power delivered to the load.
PWM technique allows smooth speed variation without reducing the starting torque. In PWM
method, operating power to the motors is turned on and off to modulate the current to the
motor. The ratio of on to off time is called as duty cycle. The duty cycle determines the speed
of the motor. The desired speed can be obtained by changing the duty cycle. The Pulse-
Width-Modulation (PWM) in microcontroller is used to control duty cycle of DC motor
drive.
PWM is an entirely different approach to controlling the speed of a DC motor. Power
is supplied to the motor in square wave of constant voltage but varying pulse-width or duty
cycle. Duty cycle refers to the percentage of one cycle during which duty cycle of a
continuous train of pulses. Since the frequency is held constant while the on-off time is
varied, the duty cycle of PWM is determined by the pulse width. Thus the power increases
duty cycle in PWM.
5
2.3 Induction Motor
An AC motor is an electric motor driven by an alternating current (AC).It commonly
consists of two basic parts, an outside stationary stator having coils supplied with alternating
current to produce a rotating magnetic field, and an inside rotor attached to the output shaft
that is given a torque by the rotating field.
An induction or asynchronous motor is an AC motor in which current is induced in
the rotor winding by the magnetic field of the stator winding, by electromagnetic induction.
Therefore they do not require the sliding electric contacts, such as a commutator or slip rings,
which are needed to transfer current to the rotor winding in other types of motor such as
the universal motor. Rotor windings consist of short-circuited loops of conductors and are
made in two types: the wound rotor and the squirrel-cage rotor.
Three-phase squirrel-cage induction motors are widely used in industrial drives
because they are rugged, reliable and economical. Single-phase induction motors are used
extensively for smaller loads, such as household appliances like fans. Although the simple
induction motor is a fixed-speed device, they are increasingly being used with variable-
frequency drive (VFD) systems, which allow the speed to be varied. VFDs offer especially
important energy savings opportunities for existing and prospective induction motors in
variable-torque centrifugal fan, pump and compressor load applications. Squirrel cage
induction motors are very widely used in both fixed-speed and VFD applications.
There are the following methods for the Speed control of the Induction motors:
1.Speed control by Frequency Changing or Variable Frequency control method
2.Speed control by Voltage Variation or Stator voltage Control Method
3.Speed control by pole changing method
6
2.4 Speed Control by Voltage Variation using TRIAC
The Induction motor speed can be controlled by changing the applied voltages on
the stator; because in induction motor the output torque is directly proportional to the square
of the voltage. Thus the motor speed controlled without changing the supply frequency, for
example, if the supply voltage value is decreases to its half, the motor torque is decreases ¼th
times; the torque is directly proportional to the speed of the motor.
In stator voltage control method, the stator voltage is controlled by a SCR; these
SCRs are connected with three phase supply (with each Phase) in anti parallel conduction.
The output voltage of the SCR is controlled by the firing angle of the SCR. Increasing the
firing angle, decreases the output voltage and this way the speed of the induction motor is
decreases. By decreases the firing angle, increasing the output voltages and the speed of the
motor is increases.
7
Chapter 3: PROJECT RESOURCES REQUIRED
3.1 Softwares
3.1.1 Proteus ISIS 7.6: Proteus is the best simulation software for various designs with
microcontroller. It is mainly popular because of availability of almost all microcontrollers
in it.This software combines mixed mode circuit simulation, micro-processor models and
interactive component models to allow the simulation of complete micro-controller based
designs. Proteus provides the means to enter the design in the first place, the architecture
for real time interactive simulation and a system for managing the source and object code
associated with each project. In addition, a number of graph objects can be placed on the
schematic to enable conventional time, frequency and swept variable simulation to be
performed.
3.1.2 ExpressPCB: ExpressPCB is a simple to use PCB layout packager aimed at the
first time user and designer. ExpressPCB offers a schematic capture program that
integrates with their PCB layout software. The schematic and layout files can be linked to
automatically carry changes forward. ExpressPCB is meant to be used with the
ExpressPCB PCB manufacturing service and does not support outputting to standard
formats directly. ExpressPCB offers a file conversion service for a fee if standard outputs
are required.
8
3.2 Hardware
3.2.1 Atmega16 Microcontroller:
Fig 3.1: Pin Diagram of Atmega16 Microcontroller
ATmega16 is an 8-bit high performance microcontroller of Atmel‟s Mega AVR
family with low power consumption. Atmega16 is based on enhanced RISC architecture
with 131 powerful instructions.. Atmega16 can work on a maximum frequency of 16MHz.
ATmega16 has 16 KB programmable flash memory, static RAM of 1 KB and EEPROM
of 512 Bytes. ATmega16 is a 40 pin microcontroller.
There are 32 I/O (input/output) lines which are divided into four 8-bit ports
designated as PORTA, PORTB, PORTC and PORTD. ATmega16 has various in-built
peripherals like USART, ADC, Analog Comparator, SPI, JTAG etc. Each I/O pin has an
alternative task related to in-built peripherals.
9
Advanced Features of Atmega16 Microcontroller:
• Up to 16 MIPS Throughput at 16 MHz
• 16K Bytes of In-System Self-Programmable Flash
• 512 Bytes EEPROM
• 1K Byte Internal SRAM
• 32 Programmable I/O Lines
• In-System Programming by On-chip Boot Program
• 8-channel, 10-bit ADC
• Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
• One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
• Four PWM Channels
• Programmable Serial USART
• Master/Slave SPI Serial Interface
• Byte-oriented Two-wire Serial Interface
• Programmable Watchdog Timer with Separate On-chip Oscillator
• External and Internal Interrupt Sources
10
The following table shows the pin description of ATmega16:
Pin no. Pin name Description Alternate Function
1 (XCK/T0)
PB0
I/O PORTB, Pin 0 T0: Timer0 External Counter Input.
XCK : USART External Clock I/O
2 (T1) PB1 I/O PORTB, Pin 1 T1:Timer1 External Counter Input
3 (INT2/AIN0)
PB2
I/O PORTB, Pin 2 AIN0: Analog Comparator Positive I/P
INT2: External Interrupt 2 Input
4 (OC0/AIN1)
PB3
I/O PORTB, Pin 3 AIN1: Analog Comparator Negative I/P
OC0 : Timer0 Output Compare Match
Output
5 (SS) PB4 I/O PORTB, Pin 4 In System Programmer (ISP)
Serial Peripheral Interface (SPI) 6 (MOSI) PB5 I/O PORTB, Pin 5
7 (MISO) PB6 I/O PORTB, Pin 6
8 (SCK) PB7 I/O PORTB, Pin 7
9 RESET Reset Pin, Active
Low Reset
10 Vcc Vcc = +5V
11 GND GROUND
12 XTAL2 Output to Inverting Oscillator Amplifier
13 XTAL1 Input to Inverting Oscillator Amplifier
14 (RXD) PD0 I/O PORTD, Pin 0
USART Serial Communication Interface 15 (TXD) PD1 I/O PORTD, Pin 1
16 (INT0) PD2 I/O PORTD, Pin 2 External Interrupt INT0
17 (INT1) PD3 I/O PORTD, Pin 3 External Interrupt INT1
18 (OC1B) PD4 I/O PORTD, Pin 4
PWM Channel Outputs 19 (OC1A) PD5 I/O PORTD, Pin 5
20 (ICP) PD6 I/O PORTD, Pin 6 Timer/Counter1 Input Capture Pin
21 PD7 (OC2) I/O PORTD, Pin 7 Timer/Counter2 Output Compare Match
Output
11
22 PC0 (SCL) I/O PORTC, Pin 0
TWI Interface 23 PC1 (SDA) I/O PORTC, Pin 1
24 PC2 (TCK) I/O PORTC, Pin 2
JTAG Interface
25 PC3 (TMS) I/O PORTC, Pin 3
26 PC4 (TDO) I/O PORTC, Pin 4
27 PC5 (TDI) I/O PORTC, Pin 5
28 PC6
(TOSC1)
I/O PORTC, Pin 6 Timer Oscillator Pin 1
29 PC7
(TOSC2)
I/O PORTC, Pin 7 Timer Oscillator Pin 2
30 AVcc Voltage Supply = Vcc for ADC
31 GND GROUND
32 AREF Analog Reference Pin for ADC
33 PA7 (ADC7) I/O PORTA, Pin 7 ADC Channel 7
34 PA6 (ADC6) I/O PORTA, Pin 6 ADC Channel 6
35 PA5 (ADC5) I/O PORTA, Pin 5 ADC Channel 5
36 PA4 (ADC4) I/O PORTA, Pin 4 ADC Channel 4
37 PA3 (ADC3) I/O PORTA, Pin 3 ADC Channel 3
38 PA2 (ADC2) I/O PORTA, Pin 2 ADC Channel 2
39 PA1 (ADC1) I/O PORTA, Pin 1 ADC Channel 1
40 PA0 (ADC0) I/O PORTA, Pin 0 ADC Channel 0
Fig 3.2: Pin Description of Atmega16 Microcontroller
12
3.2.2 Temperature Sensor LM35:
The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus
has an advantage over linear temperature sensors calibrated in° Kelvin, as the user is not
required to subtract a large constant voltage from its output to obtain convenient
Centigrade scaling. The LM35 does not require any external calibration or trimming to
provide typical accuracies of 1⁄4°C at room temperature and 3⁄4°C over a full −55 to
+150°C temperature range. Low cost is assured by trimming and calibration at the wafer
level.
The LM35‟s low output impedance, linear output, and precise inherent calibration
make Interfacing to readout or control circuitry especially easy. It can be used with single
power supplies, or with plus and minus supplies. As it draws only 60 μA from its supply,
it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over
a −55° to +150°C temperature range, while the LM35C is rated for a −40° to +110°C
range (−10°with improved accuracy).
LM35 Pin Diagram:
+Vcc 1
Output 2
GND 3
Fig. 3.3 LM35 Pin Diagram
13
3.2.3 LCD JHD162A
LCD is based on the HD44780 microcontroller (Hitachi) and can display messages in
two lines with 16 characters each. It can display all the letters of alphabet, Greek letters,
punctuation marks, mathematical symbols etc on a miniature liquid crystal display. It is
also possible to display symbols made up by the user. Other useful features include
automatic message shift (left and right), cursor appearance, LED backlight etc.
An LCD (Liquid Crystal Display) basically works on the concept of Light
Polarization of a „Liquid Crystal‟ under the influence of an Electric Field. Every LCD
contains a Back-Light behind the Liquid Crystal array, which acts as a light source.
When an Electric Field is applied across certain fluids, it changes the way they allow
light to pass through them, that is, it changes the orientation of the liquid crystal
molecules as a result they do not allow light to pass through them. Hence, by applying
suitable potential difference, we can control if light passes or doesn‟t pass through the
LCD pixels.
Fig 3.3: Pin Diagram of LCD
14
Pin Description of JHD162A:
LCD Pin Symbol Function External connection
1 Vss Signal Ground (GND) External ground (Power section)
2 Vdd Vcc for LCD Power supply for logic (+5v)
3 Vo Contrast Adjust Externally connected potentiometer
4 RS Register Select Signal To micro-controller control pins
5 R/W Read/Write Select Signal To micro-controller control pins
6 E Enable Signal To micro-controller control pins
7 DB0 Four low oder bidirectional
three-state data bus lines .
These four are not used if 4-
bit interface used.
To micro-controller data pins
8 DB1 To micro-controller data pins
9 DB2 To micro-controller data pins
10 DB3 To micro-controller data pins
11 DB4 Four low oder bidirectional
three-state data bus lines .
These four are not used if 4-
bit interface used
To micro-controller data pins
12 DB5 To micro-controller data pins
13 DB6 To micro-controller data pins
14 DB7 To micro-controller data pins
15 1 LED (K) Back light LED cathode terminal
16 15 LED (A) Back light LED cathode terminal
Fig 3.4: Pin Description of LCD
15
3.2.4 Motor Drive IC L293D
Fig. 3.5: Pin Diagram of L293D
Pin Diagram shows that L293D consists of four inputs (A), which accepts TTL
logic voltage level and four outputs (Y) that gives VCC2 Voltage. That allows L293D
to be used as two "reversible" output or four "one-way" outputs. There are two more
TTL inputs (EN), which stands for enable. This means that pin 1 (1,2EN) enables
outputs 1Y and 2Y. Without pin 1 set to logical 1, the outputs will remain inactive.
The enable inputs are usually hooked to +5V to be set still. In "motor driving"
applications, enable inputs are called slow stop and it's used for speed control.
Switching from logical 1 to logical 0 causes motor to rotate according to the switching
interval.
16
Pin configuration of L293D
Pin no. Function Name
1 Enable pin for motor 1; active high Enable 1,2
2 Input 1 for motor 1 Input 1
3 Output 1 for motor 1 Output 1
4 Ground (0v) Ground
5 Ground (0V) Ground
6 Output 2 for motor 1 Output 2
7 Input 2 for motor 1 Input 2
8 Supply Voltage for motors; 9-
12V(upto 36V)
Vcc 2
9 Enable pin for motor 2; active high Enable 3,4
10 Input 1 for motor 1 Input 3
11 Output 1 for motor 1 Output 3
12 Ground (0V) Ground
13 Ground (0V) Ground
14 Output 2 for motor 1 Output 4
15 Input 2 for motor 1 Input 4
16 Supply voltage; 5V(upto 36V) Vcc1
Fig. 3.6: Pin Configuration of L293D
17
3.2.5 Optocoupler
Fig. 3.7: Pin Diagram of Optocoupler
Optocouplers (MOCs) are used to transmit signals between circuits that do not share a
power source.MOCs have a LED and a sensor inside. If the LED is turned on, it activates
the sensor and lets the current flow.
This circuit is used to isolate signal circuitry from transients generated or transmitted
by power supply and high-current control circuits. An optocoupler, also known as opto-
isolator, is a component that transfers electrical signals between two isolated circuits by
using light. Opto-isolators prevent high voltages from affecting the system receiving the
signal.
18
3.2.6 Power Supply
Fig. 3.8: Circuit Diagram of Power Supply
The ATMEGA16 requires a regulated 5 volt supply voltage. The 7805 voltage
regulator is used to provide for that. The 7805 takes in a voltage between 7 and 30
volts and regulates it down to exactly 5 volts. The first capacitor takes out any ripple
coming from the transformer so that the 7805 is receiving a smooth input voltage, and
the second capacitor acts as a load balancer to ensure consistent output from the 7805.
The 7805 has three leads. If we look at the 7805 from the front (the side with printing
on it), the three leads are, from left to right, input voltage (7 to 30 volts), ground, and
output voltage (5 volts).
19
3.2.7 Triac
A triac is basically a bidirectional electronic switch, which can conduct current in either
directionwhen it is triggered. The triggering can be either a positive or negative voltage
applied to its gateelectrode. By applying a steady state gate signal, the triac may be
triggered into a low impedancestate where conduction across the main terminals will
occur. The gate signal polarity need notfollow the main terminal polarity. Gate
requirement vary depending on the direction of the mainterminal current and the gate
current.
Fig. 3.9: Symbol & Pin Diagram of Triac
Pin 1: Main Terminal 1
Pin 2: Main Terminal 2
Pin 3: Gate
20
3.2.8 Printed Circuit Board
A printed circuit board, or PCB, is used to mechanically support and electrically
connect electronic components using conductive pathways, tracks or signal
traces etched from copper sheets laminated onto a non-conductive substrate. When the
board has only copper tracks and features, and no circuit elements such as capacitors,
resistors or active devices have been manufactured into the actual substrate of the board, it
is more correctly referred to as printed wiring board (PWB) or etched wiring board. Use of
the term PWB or printed wiring board although more accurate and distinct from what
would be known as a true printed circuit board, has generally fallen by the wayside for
many people as the distinction between circuit and wiring has become blurred. Today
printed wiring (circuit) boards are used in virtually all but the simplest commercially
produced electronic devices, and allow fully automated assembly processes that were not
possible or practical in earlier era tag type circuit assembly processes.
21
Chapter 4: METHOD
4.1 Block Diagram:
Fig. 4.1: Block Diagram of Project
22
4.2 Circuit Diagram:
Fig. 4.2: Circuit Diagram of Project
23
4.3 Working:
The circuit maintains the temperature of the system below a particular value. A fan is
used for controlling the temperature of the system. The fan RPM increases with increase in
temperature and vice versa. The current temperature within the greenhouse is measured by
using a temperature sensor. When the current temperature is above the set maximum
temperature, the system is cooled by using a fan. When the current temperature is below the
set maximum temperature, no control action is needed. The current temperature of the room
is continuously displayed on the LCD. This makes user aware of current temperature of the
system.
The Temperature Sensor detects the temperature of the system. The Temperature
Sensor consists of an LM35 IC. The temperature sensor is connected to the ADC input of the
microcontroller. It converts the analog input to a digital value. The microcontroller generates
the corresponding PWM value according to the sensed temperature.
If using AC motor as the load, we use an optocoupler to isolate the 230V circuit from
the microcontroller circuit.The switching device (triac) is connected to the microcontroller
through the optocoupler. The firing angle of triac is changed according to the PWM value of
the microcontroller; hence, changing the speed of the fan.When using DC motor as load, the
PWM generated output control signals are sent to the Motor Driver IC L293D. Motor Driver
IC L293D is fed with the PWM generated output from microcontroller. The speed of the fan
is controlled by the ON time of the PWM generated by the controller. With increasing ON
time, the speed of the fan reduces the temperature of the system. The LCD module is also
connected to the microcontroller. The LCD module displays the currenttemperature and
PWM value in terms of percentage.
24
4.4 Algorithm:
1. Initialize Ports & LCD.
2. Sense temperature.
3. Display temperature on LCD with corresponding PWM.
4. If temperature<28ºC
Then PWM=0
Motor OFF
5. If 28º C<temperature< 38ºC
Then PWM=31
Motor ON and run at low speed
6. If temperature>38º C
Then PWM=98
Motor ON and run at full speed
7. Goto step 2
25
4.5 Program:
#define F_CPU 8000000UL
#include <util/delay.h>
#include <avr/io.h>
#include <string.h>
#include <avr/interrupt.h>
/*Global Variables Declarations*/
/*LCD function declarations */
voidLCD_send_command(unsigned char cmnd);
voidLCD_send_data(unsigned char data);
voidLCD_init();
voidLCD_goto(unsigned char y, unsigned char x);
voidLCD_print(char *string);
void Convert1(unsigned int value);
void Convert(unsigned int value);
voidbin_to_ascii_two(unsigned char);
voidInitPWM();
#define LCD_DATA_PORT PORTC
#define LCD_DATA_DDR DDRC
#define LCD_DATA_PIN PINC
#define LCD_CNTRL_PORT PORTD
#define LCD_CNTRL_DDR DDRD
#define LCD_CNTRL_PIN PIND
#define LCD_RS_PIN6
#define LCD_RW_PIN5
#define LCD_ENABLE_PIN 4
#define FREQ 8000000
#define prescaler 8
unsigned int Count=0;//,d1,d2,d3,d4,x1,x2,x3,x4;
void main(void)
{ unsignedinti,brightness,tempC,display;
DDRC=0xff;
DDRD=0xf0;
26
LCD_init();
InitPWM();
LCD_goto(1,1);
LCD_print("COT PANTNAGAR");
LCD_goto(2,8);
LCD_print("Temp:");
LCD_goto(2,1);
LCD_print("PWM:");
DDRA = 0x00; // Configure PortA as input
while(1)
{
ADCSRA = 0x97; // Enable the ADC and its interrupt feature
// and set the ACD clock pre-scalar to clk/128
ADMUX = 0xE0; // Select internal 2.56V as Vref, left justify
// data registers and select ADC0 as input channel
ADCSRA |= (1<<ADSC);
while(!(ADCSRA & (1<<ADIF)));
tempC = ADCH; // Output ADCH to PortD
LCD_goto(2,13);
itoa(tempC/10,display,10);
LCD_print(display);
itoa(tempC%10,display,10);
LCD_print(display);
LCD_send_data(0xDF);
LCD_print("C");
//bin_to_ascii_two(((brightness*100)/256)+1);
bin_to_ascii_two(((255-brightness)*100)/255);//*100);
if(tempC<=27)// &&tempC<=30)
{
for(brightness=0;brightness<250;brightness++)
{
SetPWMOutput(brightness);
}
27
} if(tempC>=28 &&tempC<=37)
{
for(brightness=0;brightness<175;brightness++)
{
SetPWMOutput(brightness);
}
}
if(tempC>=38) {
for(brightness=0;brightness<5;brightness++) //5
{
SetPWMOutput(brightness);
} }
}
}
/* This function sends a command 'cmnd' to the LCD module*/
voidLCD_send_command(unsigned char cmnd)
{
LCD_DATA_PORT = cmnd;
LCD_CNTRL_PORT &= ~(1<<LCD_RW_PIN);
LCD_CNTRL_PORT &= ~(1<<LCD_RS_PIN);
LCD_CNTRL_PORT |= (1<<LCD_ENABLE_PIN);
_delay_us(2);
LCD_CNTRL_PORT &= ~(1<<LCD_ENABLE_PIN);
_delay_us(100);
}
/* This function sends the data 'data' to the LCD module*/
voidLCD_send_data(unsigned char data)
{
LCD_DATA_PORT = data;
LCD_CNTRL_PORT &= ~(1<<LCD_RW_PIN);
LCD_CNTRL_PORT |= (1<<LCD_RS_PIN);
28
LCD_CNTRL_PORT |= (1<<LCD_ENABLE_PIN);
_delay_us(2);
LCD_CNTRL_PORT &= ~(1<<LCD_ENABLE_PIN);
_delay_us(100);
}
voidLCD_init()
{ LCD_send_command(0x38);
LCD_send_command(0x0C);
LCD_send_command(0x01);
_delay_ms(10);
LCD_send_command(0x06);
}
/* This function moves the cursor the line y column x on the LCD module*/
voidLCD_goto(unsigned char y, unsigned char x)
{
unsigned char firstAddress[] = {0x80,0xC0,0x94,0xD4};
LCD_send_command(firstAddress[y-1] + x-1);
_delay_ms(10);
}
voidLCD_print(char *string)
{
unsigned char i=0;
while(string[i]!=0)
{
LCD_send_data(string[i]);
i++;
}}
voidbin_to_ascii_two(unsigned char binbyte)
{unsigned char adc_out1;
char i=0;
char position=0xC5;
29
for(i=0;i<=1;i++)
{
adc_out1= binbyte %10;
binbyte=binbyte/10;
LCD_send_command(position);
LCD_send_data(48+adc_out1);
_delay_ms(10);
position--;
}
}voidSetPWMOutput(uint8_t duty)
{
OCR2=duty;
}
void Wait()
{
_delay_loop_2(3200);
}voidInitPWM()
{
TCCR2=0x75; //Set OC0 PIN as output. It is PB3 on ATmega16 ATmega32
DDRD|=(1<<PD7);
}
30
4.6 PCB Design:
Fig. 4.3: PCB Circuit Layout
31
Chapter 5: Results
Fig. 5.1: Waveform at 25º C
The results at 25º C(<28 º C) were obtained as given above with PWM=1.
These were matching with those obtained on the model. At this temperature, the fan
was OFF.
32
Fig. 5.2: Waveform at 30º C
The results at 30º C(28 º C< temperature < 38 º C) were obtained as given above with
PWM=31. These were matching with those obtained on the model. At this
temperature, the motor was ON and working at low speed.
33
Fig. 5.3: Waveform at 40º C
The results at 40º C(38 º C< temperature ) were obtained as given above with
PWM=98. These were matching with those obtained on the model. At this
temperature, the motor was ON and working at full speed.
34
Chapter 6: Conclusion
As displayed in the results, the prototype was successful in implementing the aims of
the project. The project model provides with a low-cost automatic temperature control
system.
The project was successful in automatically controlling and regulating the speed of
Induction Motor according to the current temperature of the surroundings thereby
increasing the air flow rate and bringing about a resultant decrease in temperature. It was
aimed at designing an integrated low cost solution that can be easily installed in external
environments of Polyhouses/Greenhouses and to remove the need for manual control of
the ventilation system, which it effectively proves to do.
35
Chapter 7: Future Scope
1. By replacing the temperature sensor with pressure sensor, we can use it in furnaces.
When large quantities of metal enters the furnace, the pressure sensor would sense
the additional weight and would run the furnace at higher output, thereby increasing
efficiency by saving energy in idle stages and reducing running costs.
2. It can be used in various industrial applications such as to control the temperature in
boilers.
3. It can be used in various industrial applications such as to control the temperature in
Refrigerators and Air Conditioners as air flow control component.
4. By replacing the fan with a heater and reversing the programming logic, it can be
used to maintain temperatures in a narrow range in incubation centres and scientific
laboratories.
36
References
Maizidi Ali, MekinlyRolin D &CarseyDenny , “Microcontroller & Embedded
System”, Pearson Education, 2nd Edition.
8051 Microcontroller and Application, 2nd
Edition, Chris Braithwaite, Fred Cowan
and HasanParchizadeh. Prentice Hall Inc. New Delhi India, 2001.
Embedded System, Raj Kamal, 3rd
Edition, Tata McGraw Hill
Electrical Machinery Fundamentals, S. J. Chapman, McGraw Hill, 2005
http://www.datasheetscatalog.com