Professional Documents
Culture Documents
SLIIT Y3E1 Embedded Systems Engineering Project - Home Automation System Using MSP430
SLIIT Y3E1 Embedded Systems Engineering Project - Home Automation System Using MSP430
SLIIT Y3E1 Embedded Systems Engineering Project - Home Automation System Using MSP430
Home Automation
System
Faculty of Engineering
Sri Lanka Institute of Information Technology
1
DECLARATION
“I declare that this is our own work and this report does not incorporate without
acknowledgement any material previously submitted for a Degree or Diploma in any other
University or institute of higher learning and to the best of our knowledge and belief it does
not contain any material previously published or written by another person except where the
acknowledgement is made in the text.
Also, I hereby grant to SLIIT the non-exclusive right to reproduce and distribute my report,
in whole or in part in print electronic or other medium. I retain the right to use this content in
whole or part in future works (such as articles or books)”
2
ACKNOWLEDGEMENT
We would like to specially recognize and thank the Module Lecturer Mr. Manaram
Gnanasekara, for his guidance, time and providing us with a systematic way to complete this
project throughout the course. We also would like to recognize his assistance in solving the
technical problems and various other problems we faced during the implementing this home
automation system.
We also would like to thank our friends and colleagues for assisting in the successful
Completion of this Home automation System Project. It was a delightful experience which all
of us accept with gratitude.
We also would like to thank our lectures and instructors for proving us assistance in various
problems encountered during course of our project.
We would like to express our gratitude towards our own group members for their kind co-
operation and encouragement which helped us in completion of this project.
We would like to express our special gratitude to all other people who have not been mentioned
here, whom helped us in various ways to make this a success.
3
1. INTRODUCTION
To accomplish the above mentioned parameter control requirements in this module project, our
group members were decided to use following microcontrollers, modules/devices as main
components of this project,
4
2. DESIGN IMPLEMENTATION
This board is a Texas instrument’s value line series board which is the most selling board
under the MSP430 series. Following are the main specifications of the board.
Additional Features
5
Figure 1- MSP430G2 Board with G2553 Chip
LDR
To read voltage levels of the LDR , a 10KΩ resistor was used in series to work as a voltage
devider, voltage across the 10 K resistor was sampled using the ADC10 module in the
MSP430 Board.
6
DHT 11 Sensor
DHT11 is a digital temperature and humidity sensor, in this sensor all the temperature and
humidit data send over an one wire using 40 bits. According to the data sheet to receive data
from the bus following process had to be done.
Request
Response
Data Reading
Request
To request the data from the DHT11 this procedure was follows. the request was sent to
DHT11 by pulling down and pulling up the connected pin for a certain time. Accrding to the
data sheet the pull down time is 18 ms and pull up time is 40 µs s.
Figure 3 – Request
Response
After receiving the request, the DHT11 acknowledges the Controller using following signal.
Figure 4 – Response
Reading DATA
After the response DHT11 Starts to send Data using the Bit array.
7
Reading Data Explained.
FC51 IR Sensor
This sensor is an obstacle detecting sensor which uses IR as the sensing media. In this sensor
there is an implemented I393 comparator IC which gives HIGH and LOW signal as output
according to the obstacle distance. This sensor give LOW output when an obstacle is in the
range.
8
3. DESIGN METHOD
When designing this home automation system, our group members had to implement
3 objectives using the MSP430
To implement the human presence detection, the IR obstacle sensors was used. The simple
theory of using IR sensors is as follows,
In the home automation system, the IR sensors were implemented in the door, one outside the
room and other one inside the room.
Entering the room- for detect entering the room, the outer IR sensor was checked for its
input. When an obstacle was detected by the outer sensor, the code waits few seconds for an
input from the inner sensor, if an input from inner sensor is received during the time period
the system recognized as one person entered the room.
Leaving the room- for detect leaving the room, the inner IR sensor was checked for its input.
When an obstacle was detected by the inner sensor, the code waits few seconds for an input
from the outer sensor, if an input from outer sensor is received during the time period the
system recognized as one person has left the room.
9
if((P2IN & BIT4)==0){ // inner sensor is checked. connected to the P2.4
hit2=1;
__delay_cycles(250000); //32ms Delay(Values are up to best optimizations)
}
while((hit2==1)&&(hit1==0)){ //hit2=1 when inner sensor was blocked
if((P2IN & BIT3)==0){ //checking for an input from outer sensor at P2.3
out=out+1; //Counter was increased for leaving
hit1=0; //hit1 and hit2 values were reset
hit2=0;
__delay_cycles(500000); //64ms Delay(Values are up to best optimizations)
}
}
System Starting-
//Main Code
To detect light intensity, a LDR is used with series to a resistor, in this case ADC10 module
in MSP430 is used to obtain Light intensity data to the controller.
ADC10CTL0 = ADC10SHT_3 + SREF_0 + REFON + ADC10ON; //64 Clock cycles,Vcc And Vss
//as reference values, ADC
//turned on, Reference Out on
//Divider by 4
10
if((in-out)>0){
To obtain temperature and humidity data, DHT11 sensor was used. The DHT11 sensor
outputs a digital array. In this DHT sensor the data was obtained using 3 steps as mentioned
in the introductions. While using this sensor it has few errors when it works in 16Mhz clock,
therefore clock speed is limited to 8 Mhz
1. Request
To request the data from DHT11, the data pin should pulled down for 18ms and
pulled up for 48µs. in the Code pin is defined as P1.7 (BIT7)
2. Response
DHT11 should send a response of 54ms pull down Time and 80ms pull up time as the
response. In here Timer is defined as 1000
11
}
}
3. Reading data
In this DHT11 should send 40bits of data containing temperature and humidity data.
char bitcount = 7;
char byte = 0;
char bits[5] = {0,0,0,0,0}; //aray to receive 5 bytes.(40bits)
unsigned int timer;
char i;
for (i=0; i < 40; i++)
{
timer = TIMEOUT; //timer = 1000 = TIMEOUT
while(!(P1IN&pin)){ //checking for pull down responses
if (timer-- == 0){
return 0;
}
}
timer = TIMEOUT;
char t = 0;
return 1;
}else{
return 0;
}
12
Complete Code
13
14
4. Conclusion
In the project we have completed every procedure of this project to successful
completion of the Power Saving Home Automation System. As a team, the team members
worked together in order to complete the objective which was given under the module of
EC3461 Embedded Systems Engineering module which was conducted by Mr. Manaram
Gnanasekara as our Subject Lecturer and Coordinator. In the field of industry the most
important component is the team work. Through this project team member worked as one
unit. Also there are many other components which is very important such as the knowledge,
principles, skills etc.
During the building process of home automation system, we were able to use most of covered
theories in the module and prerequisite modules such like Bitwise operations, shift operators,
analog to digital conversion, and digital communication theories.
15
5. References
1. http://robocraft.ru/files/datasheet/DHT11.pdf -DHT11 datasheet
2. http://www.ti.com/lit/ug/slau144j/slau144j.pdf -MSP430G2 series user guide
3. http://www.diyelectronics.co.za/store/ir/1294-infrared-obstacle-avoidance-proximity-
sensor-module-fc-51.html - FC51 Module
4. EC3461 Embedded system engineering Laboratories SLIIT
5. EC2131 Microcomputers Laboratories SLIIT
16