Embedded Systems Engineering
Home Automation System
Jayasekara J.M.S.M
EN15547934
Mudalige L.R
EN15561558
K.W.P.N. Weerawardhana
EN15536594
Premadasa T.W.M.P
EN15506276
Faculty of Engineering Sri Lanka Institute of Information Technology
1
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
DECLARATION
own work and this report does not incorporate without “I declare that this is our own 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 c ontent in whole or part in future works (such as articles articl es or books)”
EN15547934 Jayasekara J.M.S.M EN15561558 Mudalige L.R EN15536594 K.W.P.N. Weerawardhana EN15506276
Premadasa T.W.M.P
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
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 l ike 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 our project.
We would like to express our gratitude towards our own group members for their kind cooperation 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.
EN15547934 Jayasekara J.M.S.M EN15561558 Mudalige L.R EN15536594 K.W.P.N. Weerawardhana EN15506276
Premadasa T.W.M.P
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
1. INTRODUCTION
Project Requirement of the module
In this project our group was requested to implement a robot using the TI MSP430 development platform with two sensors and two actuators. This project was mai nly conducted under the requirements of third year first semester Electronics and Electrical Engineering module ‘Embedded System Engineering’ at Sri Lanka Institute of Information Technology. To accomplish the above mentioned requirements of the module, our group members were able to design a simple home automation system with various mechanical and electronic resources. Selected Project objective
Implement a simple home automation system which control following parameters,
Light Intensity inside the room
Temperature and humidity inside the room
Detection of person presence and take actions to save power.
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,
MSP430G2553 (MSP-EXP430G2 (MSP-EXP430G2 value line LaunchPad Development Tool)
LDR ( Light Dependent Resistor)
DHT11 Temperature and Humidity Sensor
FC 51 IR Distance Sensor Module
L298D motor controller
DC motors
Resistors
LEDs( Light Emitting Diodes)
Boards
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
2. DESIGN IMPLEMENTATION Sensors in the System Sensor
Output
Reading Method
LDR
Analog
Used ADC10 Module to
convert
voltage
levels to digital DHT
Digital- Output is a 40 bit array
Used a character array
1st 8 bits – bits – Temperature Temperature Integral
to extract data from
2nd 8 bits – bits – Temperature Temperature Decimal
bits.
3rd 8 bits – bits – Humidity Humidity Integral 4th 8 bits – bits – Humidity Humidity Decimal 5th 8 bits – bits – Sum Sum of previous all 8 bit packets(checksum) FC51 IR ostacle sensor
Digital (High and Low) ,
If conditions to read
When an obstacle is found output is pin status. low
Apparatus Information and Sensor implementation
MSP430G2553 Experimenter Board 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. CPU- MSP430 @ 16 MHz GPIO- 24 Pins I2C -1
16 KB Non-Volatile Memory – 16
0.5 KB RAM – 0.5
ADC10-8ch SPI- 2 UART - 1 ADC – ADC10-8ch
Timer (16-bit) – 2 2 BSL- UART
Additional Features
Internal Temperature Sensor
Watchdog
Min Vcc- 1.8 V
8 Comparators – 8
Max Vcc – 3.6V 3.6V
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Figure 1- MSP430G2 Board with G2553 Chip
LDR Following are the characteristics of the LDR
Resistance
1000 Lux
400Ω
10 Lux
9 KΩ
Total Dark
1 MΩ
Power Dissipation
100 mW Max
Current
75 mA Max
To read voltage levels of the LDR , a 10KΩ resist or 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.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
DHT 11 Sensor DHT11 is a digital temperature and humidity sensor, in this s ensor 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 Request
Response
After receiving the request, the DHT11 acknowledges the Controller using following signal.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Reading Data Explained.
Temperature = First 8 bits.Second 8 bits = 0b000100000.0b00010000 0b000100000.0b00010000 = 32.16 º C Humidity = Third 8 bits.fourth 8 bits = 0b001000000.0b00000010 0b001000000.0b00000010 =64.04% Fifth 8 bits = sum of all 8 bit series.
Figure 5- DHT11 Sensor
FC51 IR Sensor This sensor is an obstacle detecting detecti ng 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.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
3. DESIGN METHOD
When designing this home automation system, our group members had to implement 3 objectives using the MSP430 M SP430
Human Presence detection and turning on the system.
Light intensity detection and turning on turning on the lights.
Temperature detection and turning on the fans.
Human Presence Detection
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 imple mented in the door, one outside the room and other one inside the room. These IR obstacle sensors Outputs “LOW” when an obstacle is detected .
r oom, the outer IR sensor was checked for its Entering the room- for detect entering the room, input. When an obstacle was detected by the outer sensor, the code wait s few seconds for an input from the inner sensor, if an input from inner sensor i s received during the time period the system recognized as one person entered the room. if((P2IN & BIT3)==0){
// outer sensor is connected to the P2.3
hit1=1; __delay_cycles(250000);
} ((hit1==1)&&(hit2==0)){ while((hit1==1)&&(hit2==0)){ if((P2IN & BIT4)==0){ in=in+1;
//32ms Delay(Values are up to best best optimizations) optimizations) // @ 8Mhz //hit1=1 when outer sensor was blocked //checking for an input input from inner sensor at P2.4 //Counter was increased for entering
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
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 best optimizations) optimizations)
} ((hit2==1)&&(hit1==0)){ while((hit2==1)&&(hit1==0)){ if((P2IN & BIT3)==0){
//hit2=1 when inner sensor was blocked //checking for an input 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 Startingif((in-out)>0){
// main code runs when entered entered count-Left count count is >0
//Main Code }
Light intensity detection
To detect light intensity, a LDR is used with ser ies to a resistor, in this t his case ADC10 module in MSP430 is used to obtain Light intensity data to the controller.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
if((in-out)>0){
ADC10CTL0 |= ENC + ADC10SC; //ADC conversion is Started while (ADC10CTL1 & ADC10BUSY); //Waiting for finishing the conversion
ADCDATA = ADC10MEM; //converted value is copied to a variable if ((400 < ADCDATA) & (ADCDATA < 500)){ //lighting is controlled
P2OUT = 0x01; }else if (ADCDATA < 400){ P2OUT = 0x03; }else{ P2OUT=0x00; }
// according to the ADC values
Temperature and Humidity Reading 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 Code pin is defined as P1.7 (BIT7) P1DIR |= pin; // changing direction to output P1OUT &= ~pin; // pulling down the pin __delay_cycles(144000); //18ms delay @ 8Mhz P1OUT |= pin; // pulling up the pin __delay_cycles(320); //40us delay @ 8Mhz
2. Response
DHT11 should send a response of 54ms pull down Time and 80ms pull up time as the
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
} }
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; TIMEOUT; //timer = 1000 1000 = TIMEOUT while(!(P1IN&pin)){ (!(P1IN&pin)){ //checking for pull pull down responses responses if (timer-- == 0){ return 0; } } timer = TIMEOUT; char t = 0; while(P1IN&pin){
//checking for pull up responses
t++; if (timer-- == 0){ return 0; }
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Complete Code
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
4. Conclusion In the project we have completed every procedure of t his 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. Further improvement to the Home Automation
As further improvements, we would like to upgrade the existing MSP430G2 to an IOT enabled MSP430 which is called MSP432 to control the automation system using a WAN network.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
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-proximitysensor-module-fc-51.html - FC51 Module
4. 5.
EC3461 Embedded system engineering Laboratories SLIIT EC2131 Microcomputers Laboratories SLIIT