Smart home project technical paper [al azhar university]

1,510 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,510
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
41
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Smart home project technical paper [al azhar university]

  1. 1. AL-Azhar University Faculty of Engineering - Communication Dep. SMART HOME USING EMBEDDED WEB Supervised By: Dr. Ahmed Yahya Team Members: Ahmed Hamdy Ammar Anwar Abdel Kader Blal Saleh Sadek Mohamed abdel Hameed Omar Lotfi el Tayifa
  2. 2. Chapters: 1. INTRODUCTION 2. PROJECT MAIN BLOCK DIAGRAMS 3. COMPONENTS AND COST ANALYSIS 4. DESIGN APPROACH AND DETAILS 5. SCHEDULE, AND TASKS 6. CONCLUSION 7. REFERENCES 8. COMMENTS 9. APPENDICES
  3. 3. 1. INTRODUCTION 1.1 Preface A “smart home” is living environment embedded with a networked collection of hardware devices and software components to provide services that enhance autonomy and the quality of life for its inhabitants. Computer controlled sensors allow the home read information about people, objects, or conditions in the smart home environment, and computer controlled actuators allow the smart home to manipulate objects and appliances in the environment. General functions provided by the smart home include safety, security, and health monitoring; notification of emergencies, memory aids, and task assistance. 1.2 What Is A Smart Home? A Smart Home is a popular term for a whole-house automation system involving the integration of Entertainment Centers, Lighting and Climate Control, and a Security System into one cohesive control system for the home. This level of integration enables the most complete response to any event in the home. For example, the push of a button labeled “party”, could set the interior/exterior lighting to the desired levels, lower the temperature set point by a couple degrees, launch the desired party playlist on the multi-room audio system, and disable the security alarm system. This level of capability has been built into our home resulting in what we believe to be the only true “Smart Home” in Cypress Ridge. 1.3 Abstract The exponential growth of networking technology as well as microprocessors’ advancement drove to the development of new protocols ideally for applications such as home automation, industrial control, health monitoring etc. Moreover, with the rapid expansion of the Internet, there is the potential for the remote control and monitoring of such network enabled devices. However, the new and
  4. 4. exciting opportunities to increase the connectivity of devices within the home for the purpose of home automation remain largely unexploited. 1.4 Installed Features One consistent user interface to control entertainment, lighting, and security Automatic shut off of light in idle state Secured remote Internet access to monitor and control all nonentertainment functions Open doors or windows automatically turn off the thermostat, turned on only when all doors/windows are closed Family room lighting adjusted after sunset when TV turned on Custom heating/cooling cycles setup and altered through user interface Away mode on-screen button activates the security and surveillance systems Away mode response to zone intrusion or motion detection includes sending SMS to homeowner and flashing all lights in addition to local siren and dial out options 1.5 Proposed Work The focus of our project is on making the life more comfortable with a minimum cost of implementing such a system, for example the objective of design is to reduce the system’s complexity and lower fiscal costs. Hence, the system endeavors not to incorporate complex and expensive components 1.6 Evaluation Quantitative results will compare our work with previous work and will highlight how our application works better. Some key factors for the evaluation will include performance, reduction of cost, ease of use, and how the product makes the lives of people easier and better. Maintaining and enhancing the quality of life for both older people and people with disabilities involves making independent living as easy as possible.
  5. 5. 2. PROJECT MAIN BLOCK DIAGRAMS 2.1 Embedded web server Module As mentioned above the project will use the Ethernet so it has to understand the TCP/IP stack to function what needed from its protocols. The hardware that is used in that part: RJ45: all of us know it .it’s an ether net jack and it need to be interfaced with a small circuit that handle the deferential modulation of the ether net transmitting, for that we used a ready RJ45 module that has a build in differentiation handler circuit,this RJ45 is called BEL 0810-1xx1-03 that also has two LEDs both can be use to show the status of the network . ENC28J60 : Ether net controller that gets the frames from the Ether net and send it via an SPI interface to the responsible hardware this controller can be programmed via a SPI interface by giving it the MAC and IP addresses . this controller needs an 25 MHz crystal to operate and it gives an connection of 10 Mbps connection .but there is a problem with the ENC that is the working voltage it works on 3.3V so its outputs have to be shifted to be 0 or 1 for that we use the 74LC125 try stat
  6. 6. buffer to make shifting for the outputs to be exactly 5 volts also to cobble the serial eeprom from the ENC so the ENC can send data and the SEEPROM will ever harm the output and also the ENC cant affect the SEEPROM ,why? This will be shown later. PIC16F877A: powerful controller with (code memory) 64k Flash, 4k ram, 1k eeprom at 5 volts power supply these capabilities serve the ability of processing the TCP/IP stack and also it has 5 I/O ports 12bit ADC with 7 channels we used that controller with a 16Mhz crystal. This IC works on 25 MHz with two power supplies one is the usual one the other on is used as an temporary source when the first supplier is disconnected this IC store the date as a BCD data inside it so when writing or reading to/from it we have to convert the data from BCD to know how to deal with it. 2.2 Wireless connectivity ZigBee (IEEE 802.15.4) is a new global standard for wireless communications providing short-range cost effective networking capabilities that are suitable for applications in the industrial and home automation markets. Such applications require multi-month to multiyear battery life, lower data rates and less complexity than available from existing wireless standards. While there are many technologies and standards previously used in other projects/products, Zigbee is the cutting–edge technology for wireless sensing for at least for the next 10 years. It is the ideal standard to be used for Wireless Home Automation for its power-saving and simplicity characteristics.
  7. 7. 2.3 Sensor Network Throughout this project, we have been establishing a Home Automation System using a RF Wireless Sensor Network (WSN). The system has a centralized architecture: Locally, a centralized controller receives information from multiple sensors and, once processed generates the opportune orders for the actuators. User control and monitoring system is established through a web interface that exchanges information with the local controller using the appropriate protocols.
  8. 8. 2.4 Access Control The Smart Home system have an access control system that will provide ID-based entry into the home and trigger the activation of a usermatched lighting and mode scheme, This system will use a password authentication mechanism to communicate with a microcontroller that will release an electric door strike for access and turn on a set of lights and mode corresponding to the pre-determined path of the user.
  9. 9. 3. TECHNICAL SPECIFICATIONS 3.1 Components Qty. 4 2 Type PIC16F877A 4X4 Keypad 1 ENC24J60 2 1 1 1 4MHz Crystal oscillator 40MHz Crystal oscillator 32KHz Crystal oscillator 2X16 LCD Display LMB162A 1 4X16 LCD Display 1 3 1 4 LM35DZ LM7805 Stepper Motor Relay Variety of resistors Variety of capacitors Soldering Boards Description See page .. Input data to system Convert serial data to Ethernet data & vice versa Price in L.E 4 x 22 2 x 25 Clock generator for PIC 2x3 Clock generator for ENC 5 Clock generator for LM35DZ 3 Display password as * 25 Display events and available control functions Analog Temperature Sensor Voltage regulator to 5V See page... - 8 3 x 2.5 35 4x5 - - - - - 3 93 3.2 Cost analysis The prototype consists of an access module, sensors and Ethernet module. The parts for the prototype will total … L.E as shown in Table. The total cost for having a Smart Home product installed in a typical 3 unit home with one main Ethernet embedded server averages to.. L.E. That price includes: parts, transportation, installation, and any services that are needed during the life of the product.
  10. 10. 4. DESIGN APPROACH AND DETAILS 4.1 access control Access Control System is designed for areas where need for security is crucial. It protects human life, property and information and provides safe and comfortable environment by limiting unnecessary access to essential areas such as office, building, and factory. The use of access control is becoming very popular because it can remove the manual aspect of entry involved with keys while also increasing security due to unique identification. Using access control for entrance into a building will not only increase convenience, but also allow for tracking of who has entered the building premises at a given time. This will increase home security and thus the safety of the occupants. 4.1.1 Circuit diagram:
  11. 11. 4.1.2 Circuit Operation “Easy to install, Convenient to use” When the user hit any key on the keypad , it trigger the microcontroller that a value is being inserted ,and a “*” mark appears on the LCD display ,after the user complete the five digit password the microcontroller process the password into algorithm ,the make a comparison with a predefined value, then make an action on the output port. If the inserted pass word is wrong no action is being occurred unless the LCD is typing “access denied”, if repeated more than 3 times an intruder alarm become on. 4.1.3 Program Flow Chart
  12. 12. 4.1.4 Source Code The code is written in picbasic language DEVICE=16F877A XTAL=4 DECLARE LCD_TYPE 0 ‘these lines define LCD on MCU DECLARE LCD_DTPIN portC.4 DECLARE LCD_RSPIN PORTC.3 DECLARE LCD_ENPIN PORTC.2 DECLARE KEYPAD_PORT PORTD ‘define keypad port DEFINE KEYPAD_BUTTONS 16 ‘define keypad size DIM VAR1, VAR2, KEY as BYTE DIM A ,B,C,D,E, X DIM SerData ALL_DIGITAL = True TRISC=0 ‘port c is output MAIN: A=0 X=1 CLS PRINT "ENTER PASS:" LOOP: ‘this loop to scan the keypad VAR1 = INKEY DELAYMS 50 IF VAR1<16 THEN KEY = LOOKUP VAR1, [20,7,4,1,1,4,7,11,2,5,8,0,3,6,9,12,25] PRINT AT 1, X+11,"*" X=X+1 IF KEY=3 THEN A=3+X IF KEY=4 THEN B=4+X IF KEY=5 THEN C=5+X IF KEY=6 THEN D=6+X IF KEY=7 THEN E=7+X IF X=6 THEN GOSUB CHECK DELAYMS 500 GOTO MAIN ENDIF ENDIF GOTO LOOP CHECK: ‘this subprogram to compare the ‘Password and make an action DELAYMS 250
  13. 13. CLS IF A*B*C*D*E=45045 THEN HIGH PORTA.1 PRINT "ACCESS GUARANTEED" ELSE PRINT "ACCESS DENIED" ENDIF RETURN END 4.1.5 Power Requirements Source: 5V DC Voltage, 25 mA max input current 4.1.6 Environmental Requirements Temperature Range: 0° to +85° C
  14. 14. 4.2 Main control interface It is very crucial to have interfaces that are convenient for inhabitants to use so they can easily interact with the smart home system. Three such interfaces are the web, and a visual LCD style programming environment. 4.2.1 Circuit diagram: 4.2.2 Circuit Operation The Circuit is receiving information about events occurred in home and being read by sensors, adapting modes based on time read from the DS1307 I2C clock, it also permit the user to control home elements through the Keypad/LCD interface.
  15. 15. 4.2.3 DS1307 I2C Clock The DS1307 serial real-time clock (RTC) is a low power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I2C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12- hour format with AM/PM indicator. The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. Timekeeping operation continues while the part operates from the backup supply. FEATURES - Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the week, and Year with Leap-Year Compensation Valid Up to 2100 - 56-Byte, Battery-Backed, General-Purpose RAM with Unlimited Writes - I2C Serial Interface - Programmable Square-Wave Output Signal - Automatic Power-Fail Detect and Switch Circuitry - Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running
  16. 16. 4.2.4 Program Flow Chart 4.2.5 Source Code DEVICE=16F877A XTAL=4 DECLARE LCD_TYPE 0 DECLARE LCD_DTPIN PORTB.4 DECLARE LCD_RSPIN PORTB.3 DECLARE LCD_ENPIN PORTB.2 DECLARE LCD_LINES 4 DECLARE SDA_PIN PORTa.0 DECLARE SCL_PIN PORTa.1 DIM SEC as byte DIM MN as byte ‘define LCD on MCU ‘define serial I2C ‘ports ‘seconds variable ‘minutes variable
  17. 17. DIM HR as byte ‘hour variable DIM WKDY as byte ‘week variable DIM DAY as byte DIM MON as byte DIM YR as byte DIM SerData TRISB=0 TRISA=0 ALL_DIGITAL = True CLS PRINT $FE, $0F 'Blinking cursor on write_clock: MN=4 ‘numbers in BCD HR=6 WKDY=2 DAY=5 MON=7 YR=9 BSTART BUSOUT $D0 BUSOUT 0 BUSOUT $80 BUSOUT MN BUSOUT HR BUSOUT WKDY BUSOUT DAY BUSOUT MON BUSOUT YR BSTOP BSTART BUSOUT $d0 BUSOUT 0 BUSOUT 0 BSTOP read_clock: SEC=BUSIN $D1,0 ‘number in BCD MN=BUSIN $D1,1 HR=BUSIN $D1,2 WKDY=BUSIN $D1,3 DAY=BUSIN $D1,4 MON=BSUIN $D1,5 YR=BUSIN $D1,6 FOR X=1 TO 255 VAR1 = INKEY DELAYMS 50 IF VAR1<16 THEN KEY = LOOKUP VAR1, [20,7,4,1,1,4,7,11,2,5,8,0,3,6,9,12,25] PRINT AT 1, 1, "1=LIGHT" PRINT AT 1, 7, "2=FAN" PRINT AT 2, 1, "3=ALARM"
  18. 18. PRINT PRINT PRINT PRINT AT AT AT AT 2, 3, 3, 4, 7, 1, 7, 1, IF KEY=1 THEN SerData=%0001 SEROUT PORTA.0 ENDIF IF KEY=2 THEN SerData=%0010 SEROUT PORTA.0 ENDIF IF KEY=3 THEN SerData=%0011 SEROUT PORTA.0 ENDIF IF KEY=4 THEN SerData=%0100 SEROUT PORTA.0 ENDIF IF KEY=5 THEN SerData=%0101 SEROUT PORTA.0 ENDIF IF KEY=6 THEN PRINT AT 1,1,@ ENDIF IF KEY=7 THEN SerData=%0111 SEROUT PORTA.0 ENDIF "4=DOOR" "5=ELEC" "6=INFO" "7=RESET ALL" , 24660 , [SerData] , 24660 , [SerData] , 24660 , [SerData] , 24660 , [SerData] , 24660 , [SerData] hr,":", @ mn,":" ,@ sec] , 24660 , [SerData] ENDIF NEXT STOP END 4.3 Applications 4.3.1 Thermometer using A/D converter In this application thermometer is designed. The application can be used to display the temperature in degrees centigrade 4.3.1.1 Circuit Diagram (Note: This diagram was before merging with the Application circuit)
  19. 19. 4.3.1.2 Circuit Operation In this project a PIC16F77-type microcontroller is used. This is a 40-pin microcontroller with built-in 8 channel A/D converters, each having 10bits of resolution. The microcontroller is operated from a 4 MHz resonator. The temperature sensor used is the LM35DZ 3-pin analog sensor with a range of 0°C to 100°C. LM35DZ provides an analog output voltage which is proportional to the measured temperature. LM35 Precision Centigrade Temperature Sensors:
  20. 20. The device has 3 pins: Vs, Gnd, and Vo. Vs and Gnd are connected to the supply voltage and the ground, respectively. It is recommended by the manufacturers to use a 10_ resistor and a 1_F capacitor filter at the output of the sensor to minimize electrical noise. Vo is the analog output voltage given by Vo 10 mV/°C For example, at a temperature of 20°C the output voltage is 200mV. In this project LM35DZ is connected to analog input AN0 of the PIC16F77 microcontroller. - Supply Voltage +35V to −0.2V - Output Voltage +6V to −1.0V - Output Current 10 mA 4.3.1.3 Software At the beginning of the program LCD connections and the A/D parameters are defined. Variable Res stores the converted data. A/D conversion is started using the ADCIN statement. When the conversion is complete, the converted data is available in register Res. The contents of Res can be converted into mille volts by multiplying it by 4.93. But, since the output of the sensor is 10 mV/°C, it will be necessary to divide Res by 10 in order to find the real absolute temperature in degrees centigrade. Thus, the temperature can be obtained by the following operation: Res * 4.93/10 = Res * 0.493 = 0.5 * Res In the program, variable Res is multiplied by 2 to obtain the temperature with a 1°C accuracy (the resolution of the A/D converter is 19.53mV which is equivalent to nearly 2°C). The value of Res is then displayed on the LCD as a two-digit decimal number. The above process is repeated after one-second delay. For more accurate temperature measurements an A/D converter with a higher resolution will be required, e.g. 10-bit or higher. 4.3.1.4 Program Flow Chart
  21. 21. 4.3.1.5 Source Code Device = 16f877A XTAL = 4 DECLARE ADIN_RES 10 DECLARE ADIN_TAD FRC DEFINE ADC_SAMPLEUS 50 DIM VAR1 as WORD DIM Temp1 as Byte TRISA = 1 Delayms 500 ALL_DIGITAL = False select AN0 ADCON1 = %10000000 MAIN: ‘10-bit result required ‘RC OSC chosen ‘Allow 50us sample time ‘RA0 (AN0) is input ‘A/D clock is internal RC, ‘Turn on A/D converter ‘Set analogue input on PORTA.0
  22. 22. VAR1 = ADIN 0 ‘Place the conversion into variable VAR1 Temp1 = (VAR1-2) / 2 ‘convert to C CLS Print at 1, 1,"Temp= ", DEC Temp1," C" Delayms 1000 GOTO MAIN END 5. WORK PLAN & SCHEDULE Time Frame Work Load October 2009 – December 2009 Research January 2010 Survey for parts February 2010 June 2010 – August 2010 Start building device Continue building device and writing application to interact with device Testing and implementation August 2010 Present Project March 2010 – August 2010
  23. 23. 6. CONCLUSION Smart home technology can be extended onto applications such as security systems, entertainment systems, and the healthcare industry. The biggest asset to smart home technology is its ability to react in real time in ways that humans cannot. With the advent of cheap microcontrollers and the growing need for home interconnectivity, smart homes are no longer a goal for the future but rather a standard for new home builders and current home owners to consider. Smart home technology provides a safe, secure living space that is more energy efficient, autonomous, and flexible.
  24. 24. 7. REFERENCES TCP/IP Lean - Web Servers for Embedded Systems, Second Edition - Jeremy Bentham PIC16F877A Data Sheet http://ww1.microchip.com/downloads/en/devicedoc/39582b.pdf Discussion forum www.edaboard.com 8. COMMENTS Comments from the grader will be inserted here

×