Budget constraint

Budget constraint

Chapter

I N T R O D U C T I O N

1

BACKGROUND

Traditionally, auditoriums represent some of the most expensive spaces within schools, yet they are rarely used. Many schools seldom built large auditorium because of the budget constraint. Typically, auditorium space goes unused at least 90 percent of the time and in certain circumstances, operators may forget to switch off electrical equipment's in the auditorium.

Today, innovative auditorium systems can either convert a portion of the auditorium space into alternative performance space or usable classrooms or install occupancy sensors so that the electrical equipments, such as lights, air conditional, etc are automatically switch on or and off as needed.

The aim of this project is to build and design a power saver control system for auditoriums. This power saving system is adapted by detecting the amount of the people presence in the auditorium. This project is separated into two categories, hardware and software. In the hardware part, a microcontroller, PIC 16F876A is chosen to be the main brain of the project. When there is disturbance from the entrance and exit sensors, the PIC will send the signal to the relay and the circuit will be activated. As in the software part, the PIC 16F876A is programmed with c language as a command for this project.

AIMS & OBJECTIVES

This project deals with the design and development of detecting disturbance from the trans-receiver and correspondingly displays the number of people present inside the auditorium in LCD display.

Project Aims

1

Design a sensor circuit which is capable to detect disturbance.

2

Design a microcontroller circuit which is capable to receive and transmit the signal from the sensor.

3

Implement a LCD display board to display the total number of people in the auditorium and a buzzer for notification.

Project Objectives

1

To build 2 pairs of IR sensor using LM 358.

2

To build a control system which can automatically switch ON and OFF for the electrical appliances.

SYSTEM OVERVIEW

The main aim of the project is to design a power saver control system which includes two pair of IR sensor, a microcontroller, and a LCD display. The IR sensor is adapted for outputting a signal towards the microcontroller when there is a count of people. The microcontroller receives the signal from the sensor and correspondingly display the number of people presents in the auditorium in the LCD display. When the auditorium contains a maximum of 20 people, a signal will be sent to the buzzer by the microcontroller and it beeps. Meanwhile, when the auditorium is vacant, all electrical equipment will automatically switched off.

Chapter

L I T E R A T U R E R E V I E W

2

Infrared Sensor

IR sensors are an electronic device which is capable of measuring the radiated infrared light in its vicinity. The IR radiation is much more effective when it is reflected to a white region than the black region. It is also invisible to the human eye, but it can be detected by electronic devices designed for such purpose. In this project, IR sensors are used to detect disturbance received from the trans-receiver, and send the signal to the brain of the system (PIC).

Operational Amplifier

Operational amplifiers also known as op amps, were originally used for mathematical operations in ‘analog' computers. Typically op amps have 2 inputs terminals, the non- inverting input (+), inverting input (-), and one output terminal. An op amp is chosen as the comparator in this project, which performs the comparison of two voltages from the reference voltage given.

Relay

A relay is an electrically operated switch. Relays are used to switch on the voltage supply automatically when electronic pulses are flowing through it. Relays require no human interaction for the switching to occur.

A relay operates based on the principle of electromagnetism. It contains a coil and a set of contacts. When energized with an electric pulse, it will generate a magnetic field that pulls the contacts together and holds them there until the current flow in the coil has stopped. When the electromagnet is de-energized, the contact returns to its original position. Therefore it is suitable to use in this project for the automatically switch on and off system.

Voltage Regulator

Voltage regulator is commonly used in electronic devices. It function is to regulate voltage, limit the voltage passing through it. Each type of voltage regulator produces a different output voltage. For example, the LM7805 produces a constant output voltage of 5V. Normally, this kind of voltage regulator requires a supply voltage more than that of the output voltage. Thus, to obtain a 5V output from LM7805, it is necessary to supply more than 5V.

PIC Microcontroller

PIC 16F876A is developed by Microchip Technology under the family of Harvard architecture microcontrollers. It can be found in different type of sizes according to their memory capacity. Microcontroller is often seen as the brain in an electronic circuit, which can be defined as a highly integrated chip that contains all the components comprising a controller. A PIC microcontroller is designed for a very specific task for controlling a particular system.

This project requires the implementation of the microcontroller, PIC 16F876A (5 bit family of PIC microcontroller). It acts as the brain of the system, as well as controlling various hardware peripherals. The PIC will function when it receives input from the IR sensors thus it will then generate the required output to the Liquid Crystal Display (LCD).

Liquid Crystal Display

A liquid crystal display (LCD) is a thin, flat panel which allows the user to display text, numerical data and custom created characters. It can be seen in every day consumer devices, such as digital watches, pocket calculators and etc. Each row or column of the display has a single electrical circuit. The pixels are addressed one at a time by row and column addresses. LCD is used for the purpose of the needs to display information of the total people in the auditorium.

Buzzer

Buzzer is a device that converts electrical energy to sound. It contains and internal oscillator which is set at about 400Hz in order to produce sound. A buzzer's typical current is about 25 mA. The voltage rating of a buzzer allows a 6V and 12V buzzer used with a 9V supply. Buzzers can be found in alarms, timers and etc. In this project, a buzzer is used. The buzzer will function and beeps when the counter counts a maximum of people in the auditorium.

Chapter

METHODOLOGY

3

HARDWARE DESIGN

LCD Display

A 16 X 2 character LCD display has a built in controller and with 16 pins which we can see in the figure below. The interface pin connections are shown in the table below. In this project, a 16 X 2 LCD display is used. There are 6 pins from the LCD are connected to microcontroller which are Pin 1 to Pin 6 and Pin 11 to Pin 14. Pin 4 and Pin 6 of the LCD is connected to Pin 25 (RB4) and Pin 26 (RB5) of the microcontroller respectively. While Pin 11 to pin 14 of the LCD are each connected to Pin 21 (RB0) to Pin 24 (RB3) of the microcontroller.

The LCD will display the total number of people present in the auditoriums.

No.

Symbol

Level

Function

1

Vss

GND(OV)

2

VDD

VCC(+5V±5%)

3

Vo

Contrast ADJ

4

RS

H/L

Register Select

5

R/W

H/L

Read/Write

6

E

H.H-L

Enable Signal

7

DB 0

H/L

Data Bit 0

8

DB 1

H/L

Data Bit 1

9

DB 2

H/L

Data Bit 2

10

DB 3

H/L

Data Bit 3

11

DB 4

H/L

Data Bit 4

12

DB 5

H/L

Data Bit 5

13

DB 6

H/L

Data Bit 6

14

DB 7

H/L

Data Bit 7

15

NC

16

NC

TABLE 1 Interface Pin Connections

RELAY

A relay is anelectrically operated switch. A normal small size relay has 5 pins. There are 2 pins which act as normally close (NC) or normally open (NO) status with the common pin (COM) while the other 2 pins are connected to an electrical input. The mechanism of switching on or off in the relay is determined by the electrical input. When there are current flows through the relay coil, a magnetic field will be created and hence attracts a lever and changes the switch contacts. When there is no current flowing through, the magnetic field will curtail and the contact will return to the original status.

Relay works well in switching between AC and DC circuits, especially in high voltage circuits. Furthermore, it is a better choice and works under the condition of large currents. However it requires more power to operate as it needs extra current to sustain the magnetic field in the coil. When a relay coil is switched off, a brief high voltage is produced. In order to protect ICs and transistors from the high voltage, a protection diode is advisably connected parallel to the input pins of relay so the magnetic field can dies away quickly.

In this project, 2 relay are used as a switch to turn on and off the LED in the circuit. Pins are connected to the output pin of the microcontroller. When the microcontroller sends the signal, it will connect the circuit from the normally closed (NC) status.

The relays RY2 and RY3 are activated when the signals are received from the microcontroller PIN RC6 and PIN RC7 respectively. These circuits act as a controller circuit for the sensor thus the LED will switch on based on signal received

OPERATIONAL AMPLLIFIER

An operational amplifier is also known as op-amp. It has a very high gain and finds widespread use in many areas of electronics. Its application is not limited to linear amplification system but include digital logic system as well.

The standard op-amp consist of 2 inputs terminals, the non- inverting input (+), inverting input (-), and one output terminal. A typical op-amp operates with 2 dc supply voltages which are positive and negative. As for the ideal op-amp, it has an infinite voltage gain and infinite bandwidth, infinite input impedance, and also zero output impedance.

In this project, LM358 is used as a comparator for the IR sensor. It is used to compare 2 different voltages where a reference voltage to one of the inputs is applied. The other input will monitor a voltage from some point in the circuit. Therefore the output will go from low to high or (vice versa) as the monitored voltage crosses the reference voltage.

Pin 1 of the LM 358 is the output, as for the pin 2 and pin 3 each will be connected to the IR transmitter and receiver with resistors. Pin 4 will be connected to the GND, and pin 8 is connected to the VCC.

INFRARED SENSOR

Infrared sensors are electronic devices which measure infrared light which are radiated from the various objects in the field of view. This radiation which is generally invisible to the human eye can be easily detected using appropriate electronic devices. Therefore it is useful for being implemented in the entry and exit of the auditorium. The output from the IR sensor is directed to the microcontroller as its input, which indirectly forms the basis for its subsequent actions.

1 as a result of the radiations from the disturbance from the sensors. This generated voltage is then compared with a reference voltage (set by adjusting the potentiometer) by the comparator .The output from the comparator (ranges from 0V to 5V) is then directed to the microcontroller and fed to the RA0 and RA1 of PORTA configured to be in the input mode.

SOFTWARE DESIGN

PIC 16F876A

PIC 16F876A is developed by Microchip Technology under the family of Harvard architecture microcontrollers. It can be found in different type of sizes according to their memory capacity. Microcontroller is often seen as the brain in an electronic circuit, which can be defined as a highly integrated chip that contains all the components comprising a controller. A PIC microcontroller is designed for a very specific task for controlling a particular system.

In this project, microcontroller PIC 16F876A is used to manage the operations of input and output signals. PIC 16F876A is a CMOS FLASH based 5-bit microcontroller and the memory size is 14.3KB. The number of single word instruction is only 35 therefore it is considered easy for the programming. PIC 16F876A is divided into 3 I/O ports, which are Port A, Port B, Port C. These 3 ports are bidirectional I/O ports, while Port B can be software programmed for internal weak pull-ups on all inputs. These ports can be used as an analog input, analog reference voltage, timer and etc. This make the PIC can be used in a very wide applications. Besides that, it has other features such as high speed instruction execution, 2 capture/compare/PWM modules, 256 EEPROM data memory and etc. What makes the microcontroller a powerful device is the 20 MHz of operating frequency.

Pin RA0 (pin 2) and RA1 (pin 3) are connected to the IR sensor circuit. Pin RB0 (pin 21) to RB5 (pin 26) are connected to the LCD display which will show the total number of people remaining in the auditorium. Pin RC0 (pin 11) and RC1 (pin 12) are connected to a red and green LED each, where the red LED indicates that the auditorium has reach the maximum total of people in the auditorium While Pin RC6 (pin 17) and RC7 (pin 18) are connected to the relay, which will operates as a switch according to the signal sent by the PIC.

Pin MCLR (pin 1) is connected to a reset button with a 1k ohm resistor and connected to +9V of power supply. In the case of oscillating, Pin OSC1/CLKIN (pin 9) and pin OSC2/CLKOUT (pin 10) are connected to a 4 MHz crystal type oscillator with a 1M ohm resistor in series with two 22 pF capacitors which are grounded. The Pin VSS (pin 8 and 19) are grounded and the Pin VDD (pin 20) are connected to +9V of power supply.

PIC PROGRAMMING

The flow chart below shows the operations of the system in this project. 2 pairs of IR sensors are located as the ‘ENTRY' and the ‘EXIT'. Both sensors will detect disturbance continuously. As for the disturbance made at the ‘ENTRY', the sensor will increase the count by 1, whilst for the ‘EXIT', the sensor will decrease the count by 1.

The LCD display which is connected to the microcontroller will display the state of the state of the counter. If the count is equal to 0, the green LED is on and both relay is off. When the count is more than 1 and less or equal to 10 people in the auditorium, the microcontroller will turn on the first relay and a red LED which indicates the electrical appliances in the auditorium. Mean while, when the count is more or equal to 11, the second relay and another red LED is turn on.

If the count is more than 20, the greed LED will convert to the red LED and the buzzer will beep. This shows that the auditorium is full and no more entrance shall be made until there is space for entry.

SOFTWARE IMPLEMENTATION

In this project, PIC 16F876A is used as the microcontroller in the circuits. In order to program it, a programmer and a programming-software are needed. For the programmer, UIC00A USB PIC programmer is used whereas for the software, “mikroC” is used.

“mikroC” is a type of programming-software developed by mikroElectronika. In this project, the programming language is set to be C programming, which is very popular and well known. Programmes are written and compiled using this software and thus transfer to microcontroller using UIC00A USB PIC programmer developed by Cytron Technologies. UIC00A USB PIC programmer is a built-on-board programmer which supports 12F, 16F, 18F and 30F series of microcontroller.

Chapter

TEST & RESULTS

4

A few tests are needed to ensure that the project works efficiently. Components are tested before they are soldered into the circuits.

Relay

In this project, relays acts as a switch to turn on and off the LED which indicates the electric appliances. The relay is tested with a power supply and a LED using a simple circuit. The relay connects the LED to the power supply and will light on when there is an input signal flow throughout the input pins. When there is no input signal flow through, the relay will disconnect the LED from the power supply and thus switch off the LED

IR Sensor Circuits

The IR sensors are given a 5V supply. Due to the IR LED is invisible to human eye; it can be seen glowing using digital cameras due to its sensitivity towards the IR. When the IR detects flash light, the Vout is 4.37V. When the IR is under the ambient light, the Vout is 1.11V. The Vout of the IR is 4.09V when a piece of white paper is held near to it.

Chapter

DISCUSSION

5

PIC 16F876A

In this project, problems occurred in different part of the project. The problem faced is the malfunction of the microcontroller. It functioned well with a test programme written and tried on breadboard.

However, there was problem after the installation onto PCB board. The software was checked correctly and the microcontroller pins are soldered at the right place. At last notice that Another PIC is bought and this time it is connected to the PIC holder during testing before soldering to ensure the same problem will not reoccur.

IR Sensors

The IR sensors did not give any response during the first test on the breadboard. This is because the IR receiver is unable to receive the signal from the transmitter. It is then checked with mobile phones, and found out they were not functioning until a new pair of IR is substituted. IR sensors often associates with large amount of troubles because of the sensitivity upon ambient lights. Throughout the project, problems such as having false readings from the sensors occur. This is due to the fact that an IR Detector can sense the light directly from the Transmitter LEDs, which results in the false readings. In order to prevent distraction from surrounding lights, small piece of black rubber is used to cover both IR transmitter and receiver. The IR sensor had a difficulty in detection due to the orientation of the receiver is not adjust to an angle where it is better for detection.

Chapter

CONCLUSION

6

As a conclusion, this project design has achieved its project statement as stated above. The prototype of the control system is capable of detecting the disturbances from the IR sensors and sends the signals to the microcontroller. The microcontroller is also transmitting the correct input signal and therefore the LCD displays the information needed in this project. Thus the aim and objective of this project is successfully achieved.

Aims and Objective

Accomplishment

To design and build 2 pairs of IR sensor which is capable in detect disturbance.

The IR sensors are design and build with using LM358. Both the entry and exit sensors can detect disturbance and transmit signal to the microcontroller. (Achieved)

To build a control system which can automatically switch on and off the electrical appliances.

PIC 16F876A is used as the brain of the control system. The PIC will receive inputs from the IR sensors and will automatically activate the function of the system and information of the auditorium will be display at the LCD. It also will buzz when the maximum limit had reached. (Achieved)67

As a part of growing technology in this new green era, this project title can be use as a base line of development in saving energy. Besides that by reducing the energy consumption may meet the corporate and government mandates for green initiatives. It is very much useful if every auditorium even industries can contributes in reducing the usage of the electricity and helps the world to go green.

REFERENCES

REFERENCE BOOK

  1. Electronic Devices, Thomas L.Floyd, Sixth edition
  2. Programming Robot Controllers, Myke Predko, 2003
  3. PIC Microcontroller Project Book, John Iovine, 2000
  4. Teach Yourself Electricity and Electronics 3rd Edition, Stan Gibilisco, 2002
  5. Programming and Customizing the PIC Microcontroller, Myke Predko, 1998

APPENDICES

SCHEMATIC DIAGRAM

BOARD DESIGN

PCB DESIGN

MICRO C CODING FILE

//define pin used

#define ir1 PORTA.F0

#define ir2 PORTA.F1

#define relay1 PORTC.F6

#define relay2 PORTC.F7

#define led_red PORTC.F0

#define led_green PORTC.F1

#define buzzer PORTC.F2

//define variables

char count;

char txt[6];

void display_user(void);

//define main program

//setup i/o ports

void main()

{

TRISA = 0b00001111; // PORTA is input

TRISB = 0b00000000;

TRISC = 0b00000000;

OPTION_REG = 0b00000101;

INTCON = 0xA0; // Enable TMRO interrupt

PORTA=PORTB=PORTC = 0x00;

LCD_Config(&PORTB,6,5,4,3,2,1,0);

Lcd_Init(&PORTB); // Lcd_Init_EP4, see Autocomplete

LCD_Cmd(LCD_CURSOR_OFF); // send command to LCD (cursor off)

LCD_Cmd(LCD_CLEAR); // send command to LCD (clear LCD)

Lcd_Out(1,1, "Dynamic Power");

count=0x00;

do

{

display_user(); //display number user at lcd

if(!ir1) //if ir1 detect?

{

count++; //count + 1

while(!ir1); //wait until ir1 not detect

Delay_ms(300);

}

if(!ir2) //if ir2 detect?

{

if (count==0) //if count=0 then count is zero

count=0;

else

count--; //else count - 1

while(!ir2); //wait until ir2 not detect

Delay_ms(300);

}

}while(1);

}

void display_user(void)

{

lcd_out(2,1,"Total:"); //display Total user at lcd

bytetostr(count,txt);

lcd_chr_cp(txt[0]);

lcd_chr_cp(txt[1]);

lcd_chr_cp(txt[2]);

if(count==0) //if count equal 0 then led green on

{

led_green=1;

led_red=0;

relay1=0;

relay2=0;

buzzer=0;

}

else if(count>=1 && count<=10) //if count > 1 and < 10 then led green on & relay 1 on

{

led_green=1;

led_red=0;

relay1=1;

relay2=0;

buzzer=0;

}

else if(count>=11 && count<=19) //if count >=11 and count <= 19 then led green on & relay 1,2 on

{

led_green=1;

led_red=0;

relay1=1;

relay2=1;

buzzer=0;

}

else if(count==20) //if count ==20 then led_red on and relay 1,2 on

{

led_green=0;

led_red=1;

relay1=1;

relay2=1;

buzzer=0;

}

else if(count>=20) //if count >=20 then led red on and relay 1,2 on

{ //buzzer beep

led_green=0;

led_red=1;

relay1=1;

relay2=1;

buzzer=1;

Delay_ms(50);

buzzer=0;

Delay_ms(50);

}

}

Please be aware that the free essay that you were just reading was not written by us. This essay, and all of the others available to view on the website, were provided to us by students in exchange for services that we offer. This relationship helps our students to get an even better deal while also contributing to the biggest free essay resource in the UK!