Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

CONSTRUCTION OF A MICRO CONTROLLER BASED

AUTOMATIC ROOM LIGHTENING CONTROL SYSTEM

BY

ABASS BASIRAT ADEOLA

19/DCEN/001

SUBMITTED TO THE DEPARTMENT OF COMPUTER

ENGINEERING

FACULTY OF ENGINEERING TECHNOLOGY

IGBAJO POLYTECHNIC,

IGBAJO, OSUN STATE.

OCTOBER, 2021

i.
v
CERTIFICATION

This is to certify that this project was carried out by ABASS, Basirat Adeola with matric number

19/DCEN/001 and has been approved as meeting the requirement by in partial fulfillment for the award of

National Diploma in Department of Computer Engineering, in the faculty of Engineering, Igbajo

Polytechnic, Igbajo, Osun State.

Mrs Akinleye F.W ----------------------------------

(Head of Department) Sign and Date

Mr Adeniji ---------------------------------

(Supervisor) Sign and Date

ABASS Basirat Adeola ---------------------------------

(Student) Sign and Date

ii.
v
DEDICATION

This work is dedicated to the Almighty God, my strength and fortress.

iii.
v
ACKNOWLEDGEMENT

First of all, my profound appreciation goes to Almighty Allah who by His unflinching grace and
power has granted me the opportunity, the required strength and good health for the successful
completion of this project.
I am also grateful to my wonderful family my beloved parents MR Akeem and MRS Bayonle
Abass. THANK YOU for your prayers, parental advise, moral and financial support all
through this program.
I would like to thank profoundly the DEAN OF THE FACULTY Eng. Jooda for her motherly
advice and support throughout my course of study.
I would also like to thank the Head of Department Mrs. Akinleye for her support throughout my
course of study.
I would like to extend my gratitude to my Supervisor MR. Adeniji, who found time and patiently
go through the manuscripts and offered useful advice, made corrections and assistance despite
his busy schedules.
I am also using this medium to appreciate all my lecturers in the department who in one way or
the other, I have tapped from their reservoir of knowledge.
Although, I would like to mention by name those who have contributed to my achievement, but
it is impossible. Those who readily came to mind include; Erinfolami Iromini and Adewumi
Adeoye.
Finally, to the numerous other people who made it a worth while and memorable experience, I
say a big THANK YOU.

v
iv.

TABLE OF CONTENT
 

 
CERTIFICATION ii
DEDICATION iii
ACKNOWLEDGEMENT iv
TABLE 
 

CHAPTER ONE
1.0 Introduction 1
1.2 Problem statement 1
1.3 Aim of this project 1
1.4 Objective of the project 2
1.5 Significance of the project 2
1.6 Limitation of the project 2

CHAPTER TWO
2.0 Literature review 3
2.1 Basic historical back ground of automatic room light controller 3
2.1.1 Historical Background 3
 Theories and models relevant to the design 4
2.2 Atmega328 4
2.3 Specifications 4
2.4 Family 5
2.5 Exploring the atmega328Arduino board 5
2.6  

CHAPTER THREE
3.0 The system design, analysis and methodology 7
3.1 Methodology 7
v

3.2 Analysis of existing system 7


3.2.1 Information Gathering 8
3.3 Description of the system’s block diagram 9
3.4  
3.4.1  
3.5  
v
3.6 Principle of operation 15

CHAPTER FOUR
4.0 Introduction 16
4.1 Software development 16
4.2 Testing 16
4.3 Expected test results 16
4.4 Performance evaluation 17
4.5 Problems encountered 17
4.6 Packaging 17-18

CHAPTER FIVE
5.0  
5.1  
5.2  





v
ABSTRACT

In today’s world, there is a continuous need for automated appliances. With the increase in the
living standards, there is an immediate need for developing circuits that would change the
complexity of life to simplicity. This Project title “Automatic Room Light Controller” is
designed and presented in order to automatic on auditorium, hall, offices, malls, sports venue, etc
light. The system on and off every 10seconds there is movement from the sensor at the
auditorium or hall or other place, where it is placed. Depending upon the sensors interruption, the
system identifies the entry and exit of the visitor. On the successful implementation of the
system, it automatically on light in the auditorium or hall. This is an economical cost reducing
system when implemented in places where the visitors doesn’t have to look for switches to
switch on the light. Auto room lighing can be time consuming so it helps to maximize the
efficiency and effectiveness of employees, time saving and sales potential of an organization, etc.

vii

v
CHAPTER ONE

1.0 INTRODUCTION

Scientific discoveries delivered us luxury and comforts. Technology has become vital and essential part of

our lives. Tremendous advancement in technology is succeeded in last few years. Electrical energy has

become an crucial part of human life. In recent years the people are looking forward for the automation in

their day to day life, and even now the people are excited to save energy consumed to reduce the

expenditures. People are becoming lazy to switch off the lights while leaving the room, so the large amount

of energy is wasted if the light remains ON in the absence of human being. Generally, in public and private

sector companies, offices, school and colleges most of the people are not interested in switching OFF the

electronic machines like fan, light, etc. while going out of the room [1].

As more and more consumer electronic and home appliances are used, the size of them is becoming large;

power consumption in home area tends to grow. Moreover, unusable power consumption occurs in the

absence of human being in public and private sectors.

Using the automation in switching the home or office lighting system, the consumption of electricity can be

comprehensively reduce which will in turn save the money of the owner. Now the people are looking

forward for automation in their daily life. The people are trying to reduce human efforts.

By using this suggested system wastage of electricity can be reduced as electrical appliance will be

automatically turned ON or OFF based on the presence of the human being with the help of PIR sensor [2].

1.2 PROBLEM STATEMENT This device came to solve the problem associated with manual

control of a room light which involves labor, time wasting and waste of electrical energy.

1.3 AIM OF THIS PROJECT

To design and construct a microcontroller based Automatic Room lightening control system.

v
1

1.4 OBJECTIVE OF THE PROJECT

The objective of this project is to make a microcontroller based Automatic Room lightening system which

can sense if anybody enters the room and it lights up the room automatically and when motion stops the

light goes off. It is made to prevent electric power waste in schools, colleges, offices and houses. This

whole process is operated totally automatically by its sensors.

1.5 SIGNIFICANCE OF THE PROJECT

This project can also be used in our homes because many times we come out of our bedroom or any other

room and we forgot to turn off the room light.

1.6 LIMITATION OF THE PROJECT

This system cannot distinguish between human and other obstacles such as animals.

2
v
CHAPTER TWO

2.0 LITERATURE REVIEW

2.0.1 BASIC HISTORICAL BACKGROUND OF ROOM

LIGHT CONTROLLER

2.0.2 Historical Background:

As a result of the fast growing trend in instrumentation engineering, a good number of electronic

instruments that exists in advanced countries should also exist in our country Nigeria.

Industrial electronics is a holistic aspect of modern world technology; as such, most of the

electronically advanced countries like USA, Japan, Russia, etc cannot sustain their technological

advancement without the abovementioned subject.

The advent of microelectronics in 1959 by jack kilo byte gave rise to the birth of both linear and

digital circuits like Operational Amplifiers, Voltage Regulators, IC Timers, Combinational Logic,

Structural and Sequential Logic ICs among a host of other digital system components.

The control and automation of human counters for hotel room processes can be realized using a

microcontroller integrated with an infrared sensor which senses the passage of human beings and

detects them and on light.

The discovery of the microcontroller in 1972 marked the beginning of micro program control in

electronics. Microprocessors like 8080, 8086, 8088; Pentium, etc were employed for micro

program control of batch counters in the 20 th century but micro controllers became more preferable

for such embedded applications for control systems in contrast to the microprocessors which are

better for general purpose applications. Other devices which maybe similarly used for such control

operations are programmable logic devices (PLDs) such as Complex Programmable Logic

Devices (CPLDs), Field Programmable Gate Array (FPGA) among a host of other devices. This

automatic room light

3
controller contains a Infrared Sensor formed. The control mechanism of this automatic room light

controller is realized through a micro program control. The micro program which is the driving

software is written in C language and flashed into the Atmega328 microcontroller. By using this

sensor and its related circuit diagram can put ON/OFF lights automatically, during this project

research.

2.1 THEORIES AND MODELS RELEVANT TO THE DESIGN

The system designed was based on fundamental and principles of electromagnetism, electronic

devices, interfacing, intelligent control systems, and software systems.

2.2 ATMEGA328

The ATmega328 is a single-chip microcontroller created by Atmel in the mega AVR family

(later Microchip Technology acquired Atmel in 2016). It has a modified Harvard architecture 8-

bit RISC processor core. Atmega328 microcontroller issued in basic Arduino boards i.e Arduino

UNO, Arduino Pro Mini and Arduino Nano.[1]

2.3 SPECIFICATIONS
The Atmel 8-bit AVR RISC-based microcontroller combines 32 KB ISP flash memory with read

while- write capabilities, 1 KB EEPROM, 2 KB SRAM, 23 general purpose I/O lines, 32 general

purpose working registers, three flexible timer/counters with compare modes, internal and

external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI

serial port, 6-channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF packages),

programmable watchdog timer with internal oscillator, and five software selectable power saving

modes. The device operates between 1.8-5.5 volts. The device achieves through put

approaching1MIPS per MHz. [2]

4
2.4 FAMILY

A common alternative to the ATmega328 is the "pico Power"ATmega328P. A

comprehensive list of all other members of the mega AVR series can be found on the Atmel

website.[4]ATmega328,ATmega328P and ATmega328P-AUTOMOTIVE

ATmega328PB and ATmega328PB-AUTO MOTIVE(supersetofATmega328P)-has more

UART, I2C, and SPI peripherals than ATmega328P

2.5 EXPLORING THE ATMEGA328 ARDUINO BOARD


Microcontroller: the ATmega328 is the Arduino brain. Everything on the Arduino board is

meant to support this microcontroller. This is where you store your programs to tell the Arduino

what to do.

Digital pins: Arduino has14digital pins, labeled from 0to13 that can act as inputs or outputs.

 When set as inputs, these pins can read voltage. They can only read two states: HIGH

or LOW.

 When set as outputs, these pins can apply voltage. They can only apply 5V(HIGH)or

0V(LOW).

PWM pins: These are digital pins marked with a ~ (pins 11,10, 9,6, 5and 3).

PWM stands for “pulse width modulation” and allows the digital pins output “fake” varying

amounts of voltage. You’ll learn more about PWM later.

TX and RX pins: digital pins 0and 1.The T stands for “transmit” and the R for “receive”. The Arduino
uses these pins to communicate with other electronics via Serial. Arduino also uses these pins to
communicate with your computer when uploading new code. Avoid using these pins for other tasks other
than serial communication, unless you’re running out of pins
LED attached to digital pin 13: This is useful for an easy debugging of the

Arduino sketches.

TX and RX LEDs: these leds blink when there are information being sent between the

5
Analog pins: the analog pins are labeled from A0 to A5 and are often used to read analog

sensors. They can read different amounts of voltage between 0 and5V. Additionally, they can

also be used as digital output/input pins like the digital pins.

Power pins: the Arduino provides 3.3V or 5V through these pins. This is really useful since

most components require 3.3V or 5V to operate. The pins labelled as “GND” are the ground

pins.

Reset button: when you press that button, the program that is currently being run in your

Arduino restarts. You also have a Reset pin next to the power pins that acts as reset button. When

you apply a small voltage to that pin, it will reset the Arduino.

Power ON LED: will be on since power is applied to the Arduino.

USB jack: you need a male USB A to male USB B cable (shown in figure below) to up load programs from your
computer to your Arduino board. This cable also powers your Arduino.owerjack: you can power the Arduino
through the power jack. There commended input voltage is 7V to 12V. There are several ways to power up
your Arduino: rechargeable batteries, disposable batteries, wall-warts and solar panel.

2.6 APPLICATIONS OF ATMEGA328

ATmega328 is commonly used in many projects and autonomous systems where a

simple, low powered, low-cost micro-controller is needed. Perhaps the most common

implementation of this Chip is on the popular Arduino development platform, namely

the Arduino Uno and Arduino Nano models.

6
CHAPTER THREE

3.0 THE SYSTEM DESIGN, ANALYSIS AND METHODOLOGY

3.1 METHODOLOGY

Systems Analysis is the process of investigation of a system’s operation with a view to changing

it to new requirements or improving its current working.

A block diagram of the envisaged circuit was achieved by the use of a methodological approach

known as “TOP DOWN approach “of the development process of microcontroller-based

systems. This phase constitutes an essential step of the development process and one of the

critical issues that determines the quality of the final product. The analysis phase sets the stage

for the whole project. The necessary groundwork for understanding what the project is all about

is completed in this phase. We take the strong position that the more effort you put into planning,

the smoother the rest of the project will go and the better the quality will be of your final product.

The total design and development of any microcontroller based system typically involves three

Phases. They are as follows

i. Hardware design and development

ii. Software design and development

iii. Prototype implementation and diagnostic testing

3.2 ANALYSIS OF EXISTING SYSTEM

The existing system makes use of manual controllers, like switches, manual changeovers and

uses IR sensor with short measuring range.

7
3.2.1 Information Gathering

A lot of research work consultations were carried out before and during this project. The research

work includes past projects of higher institution of learning in the country, journals, textbooks

on electronics and telecommunication and research papers gathered from the libraries and

internet as well as conversations with my project supervisor.

3.3 DESCRIPTION OF THE SYSTEM’S BLOCK DIAGRAM

The microcontroller based automatic room lightening control system is designed with the aid of

a block diagram which serves as a guideline for the development of system’s circuit schematic

diagram.

5-12v power supply

PIR Sensor Atmega328-Pu

PIR Sensor
Relay

PIR Sensor
Bulb

Fig11: basic block diagram

8
3.4 Procedure Followed While Designing:

The system circuit was designed with PROTEUSE software. Proteuse is a circuit

designing software. After completion of the designing the circuit layer was prepared.

The microcontroller was programmed using “ARDUINO IDE” software using hex file.

Then soldering process was done. After completion of the soldering process the circuit was

tested.

9
3.4.1 List of Components:

Following is the list of components that are necessary to build the assembly the project.

 Microcontroller – Atmega328-pu

 Power regulator IC – 7805

 PIR motion sensor

 Transformer – 12-0-12, 500 mA

 5v Relay

 Disc/ceramics capacitor – 22pF

 Rectifier diode – IN4148

 Diode

 Transistor – BC 547

 Liquid crystal display

10

3.5 PROGRAMMING OF DEVICE


PIR Sensor Module: It is an electronic instrument which is used to sense certain

characteristics of its surroundings by either emitting and/or detecting infrared radiation. PIR

sensors are also capable of measuring the heat being emitted by an object and detecting motion.

It has advantage over IR sensor has it has a wider measuring range.

Features

Size: Rectangular

Output: Digital pulse high (3V) when triggered (motion detected) digital low when idle (no

motion detected). Pulse lengths are determined by resistors and capacitors on the PCB and differ

from sensor to sensor.

Sensitivity range: up to 20 feet (6 meters) 110° x 70° detection range

Power supply: 5V-12V input voltage for most modules (they have a 3.3V regulator), but 5V is

ideal in case the regulator has different specification.

11

LM7805 (Voltage Regulator)


Fig18: Voltage Regulator

Description:

The KA78XX/KA78XXA series of three-terminal positive regulator are available in the TO-

220/D-PAK package and with several fixed output voltages, making them useful in a wide range

of applications. Each type employs internal current limiting, thermal shut down and safe

operating area protection, making it essentially indestructible. If adequate heat sinking is

provided, they can deliver over 1A output current. Although designed primarily as fixed voltage

regulators, these devices can be used with external components to obtain adjustable voltages and

currents.

Features:

 Output Current up to 1A

 Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V

 Thermal Overload Protection

 Short Circuit Protection

 Output Transistor Safe Operating Area Protection

12

RELAY:
Fig 19: Relay Circuit

A single pole double throw (SPDT) relay is connected to digital pin2 of the microcontroller

transistor. The relay requires 5volts at a current of around 100ma, which cannot provide by the

microcontroller. So the driver transistor is added. The relay is used to operate the external

solenoid forming part of a locking device or for operating any other electrical devices. Normally

the relay remains off. As soon as pin of the microcontroller goes high, the relay operates. When

the relay operates and releases. Diode D2 is the standard diode on a mechanical relay to prevent

back EMF from damaging the transistor when the relay is back to low.

13
Start

Object detection
Through PIR

Starts counts from


10secs

Relay Switches On

Is the sensor
interrupted again?

YES NO

Starts counts from Relay Switches Off


10secs

Fig 20: Sequential Running of the Code

14
3.7 Principle of operation

 If the sensor is interrupted the relay goes HIGH and the microcontroller starts counting

from 10 downward.

 If sensor is interrupted during the count, count start again from 10 downward.

 The microcontroller then checks if count less than or equal to 0, if the condition is true

then relay goes LOW and the light is off otherwise if the condition is false the light

remains on.

15
CHAPTER FOUR

SYSTEM IMPLEMENTATION AND TESTING

4.0 INTRODUCTION

This chapter discusses the design implementation of the system which is the hardware structure

which comprises the infrared receiver, microcontroller and the electromechanical relay circuit.

4.1 SOFTWARE DEVELOPMENT

4.2 TESTING

Testing is a vital process in the development and realization of any design, be it hardware based,

software based or both. The various components and their circuitry have to be tested to ensure

that all the components on board are certified okay and in good working condition. The

components that did not give the required output specification where isolated and troubleshoot to

determine the nature and cause of the component failure through careful analysis, that is

examination of the working principles of the component(s).

4.3 EXPECTED TEST RESULTS

The design of the microcontroller based automatic room light controller is meant to be a system

that so that when there is no one in the room the lights, fans and gadgets are turned off

automatically. With this system the user do not need to press any button, once he/she enters the

room, the room the light turns on. To effectively carry out an intensive test, it is a good practice

to run or retest the project as many times as possible to make sure that the desired design

specification is met. The result that is expected is for the system, when the infrared rays are

blocked, the infrared sensor sends signals which will activate the relay and power the lights. The

expected test results were obtained as the infrared transmitter (entrance) communicated

successfully with the receiver on the receiver (exit) section of the control system.

The signal received was then able to activate the relay and control the lighting point successfully.

16
4.4 PERFORMANCE EVALUATION

The performance of the automatic room light control system with proved satisfactory and is

working according to expectations.

4.5 PROBLEMS ENCOUNTERED

In the course of the design and implementation of this project, some problems were encountered.

They are -

 Difficulty when writing programs, debugging and interfacing

 Component Failures

 Short Circuitry

 Inadequate and epileptic power supply.

 I also had some soldering issues which were resolved using continuity checks performed

on the hardware.

Construction of the circuit like this needs patient and diligence. The act of soldering must

be mastered and judiciously applied. It requires absolute concentration. Little mistake

could jeopardize the operation of the circuit. And it is usually difficult when one does not

have troubleshooting skills. It is refreshing as well as tedious. The connection of wires

interwoven to each other sometimes can cause discouragement, to say the least.

4.6 PACKAGING

During the packaging of the system, the size of the case was determined after the consideration

of the under mentioned factors:

 The size of the circuit board (the control circuit}


17

 The space for envisaging modification and easy accessibility to the circuit board or

maintenance if the situation calls for such.

Consequently, the following materials were considered for packaging of the system which

includes:

 Plastic packaging

 Laminated plywood packaging

 Packaging with metal sheet

For this project, the packaging was done using plastic packaging because of its durability,

portability, availability and adjustability.


18

CHAPTER FIVE

5.0 SUMMARY

For a project to be executed, one has to reason out what the design is and how the design

can be carried out and also be able to implement the design in order to achieve the aims and

objectives of the project.

In the design and implementation of this project, the Atmega328-Pu microcontroller is

programmed to coordinate the whole function of the design from when the sensor is been

interrupted to processing and sending appropriately to the relay which are connected to outputs

of our domestic appliances, lighting points, etc. This project is designed primary to automatically

switch on/off lights once there is interruption to the sensor, it can also be tailored so as to be

able to control our domestic appliances using a central controller.

5.1 CONCLUSION

The automated state of the system gives the product certain flexibility and the potential to be

integrated with some of the other household systems into a universal household and industrial

appliance. Eventually, one simple system like this has the capability to control air conditioners,

televisions, CCTV, lighten system, sockets, washing machine, and other home appliances. This

design began the framework for a more complex and more functional product. The concept of an

automatic room light controller and bidirectional counter can be built upon not just for household

usage but for such settings as hotels, schools, hospitals, industrial purpose or businesses.

Eventually this designed product can be built using less expensive components thus making it an

affordable alternative for consumers. It is a simple upgrade to an existing standard product and it

has endless expansion possibilities.


In conclusion, this project is a design which should be encouraged and put into large scale

manufacturing because of its various advantages.

19

5.2 RECOMMENDATION

Use of imaging systems such faces recognition that recognizes the identities of the target

individual. This would differentiate between an animal and humans obstructing the sensors ray.
20

5.3 REFERENCE

1. Y.C. Chang, T.Y. Chen, D. J. Wang, People Counting System for Getting

In/Out of a Bus Base on Video Processing, Elighth International

Conference on Intelligent System Design And Applications(ISDA), 2008,

vol. 3,pp.565-569

2. F. Schwartz, Performance of Narrow Field, Passive, Infra-Red Intrusion

Detector, Proceedings of the Society of Photo-Optical, Sep. 1972, pp. 51-

56

3. Electronic management system employing radar type infrared emitter and

sensor combined with counter as described in U.S. Pat. No. 499349 A

4. Automatic Room Light Controller with Visitor Counter by Microtronics

Technologies, 10 June, 2013

5. Ultrasonic Sensor. “HC0-SR04 datasheet”. (online). Available :

www.satistronics.com

6. Microcontroller Atmel ATmega328PU. “Atmel ATmega328PU”.

(online). Available: http://atmel.com/

You might also like