University of Huddersfield Repository Waddington, Jon Design of an information system to provide home control for the elderly and disabled Original Citation Waddington, Jon (2010) Design of an information system to provide home control for the elderly and disabled. Masters thesis, University of Huddersfield. This version is available at http://eprints.hud.ac.uk/11046/ The University Repository is a digital collection of the research output of the University, available on Open Access.
DESIGN OF AN INFORMATION SYSTEM TO PROVIDE HOME CONTROL FOR THE ELDERLY AND DISABLED JON WADDINGTON A thesis submitted to the University of Huddersfield in partial fulfilment of the requirements for the degree of Master of Science by Research The University of Huddersfield December 2010
Jon Waddington Contents Abstract ............................................................................................................. 5 1 Introduction .................................................................................................... 6 1.1 Aims and Objectives ..................................................................................... 6 1.2 Target Market............................................................................................... 7 1.
Jon Waddington 3.9 Infra-red Remote Controller....................................................................... 47 3.9.1 IR receiver .............................................................................................. 48 4 Evaluation of the Information System ........................................................... 51 4.1 TV Circuit ................................................................................................... 51 4.2 The User Interface ................................
Jon Waddington Copyright Statement i. The author of this thesis (including any appendices and/or schedules to this thesis) owns any copyright in it (the “Copyright”) and s/he has given The University of Huddersfield the right to use such Copyright for any administrative, promotional, educational and/or teaching purposes. ii. Copies of this thesis, either in full or in extracts, may be made only in accordance with the regulations of the University Library.
Jon Waddington Abstract This report describes the development of an Information System which aids the elderly and disabled perform home control. The Information System acts as a set-top box which generates video signals to display a graphical user interface (GUI) on a television. The GUI can be navigated by the user through a remote control. The Information System can communicate with X10 modules, therefore being capable of turning lights and appliances around the home on and off.
Jon Waddington 1 Introduction The aim of this project is to design an information system which can provide home control to the elderly and disabled to realise their wish to remain independent at home while reducing health care costs [1]. Research has shown that 17% of all UK adults spend ‘all or nearly all’ of their leisure time at home. This rises to 37% in people aged 65 and over and increases further with people who have a disability, those aged 75 or over, and those living alone [2].
Jon Waddington with televisions for years. Ideally, no re-wiring should be needed, making the information system simple enough to be installed and customised by the user. This should also make the Information System more cost effective as a specialist is not required to install it. 1.2 Target Market The Information System is aimed at assisting the elderly and disabled with performing simple tasks around the home by providing a means of home control.
Jon Waddington assistance from friends, family or professionals. The aim is to aid the user with simple, repetitive tasks, reducing the required personal assistance with technological assistance. This reduces the strain on the helpers and makes the user feel more independent [5]. Since the interface of the Information System is completely visual, usability is reduced in those with more serious visual impairments.
Jon Waddington 2 Review of Current Technology Home automation refers to devices which are used to control elements in the home, either remotely or automatically. This can include turning lights on or off remotely, by phone, remote control or from a computer. The lights could also be set on a schedule to be turned on at night when it starts to get darker and switch off later at night while the user sleeps.
Jon Waddington familiar with computers and the interface is not aimed specifically aimed at them. A home automation setup using this software would also require a computer to be switched on constantly to schedule events. The software is also quite expensive at £141.00 [12] in addition to the cost of a computer if one is not already owned. 2.4 Easytouch Panel10 The Easytouch Panel 10, made by Marmitek, has a 10 inch touch screen to wirelessly control appliances round the home.
Jon Waddington for a microcontroller to control the display. The Parallax Propeller is a microcontroller which contains an internal font ROM and is capable of generating PAL and NTSC video signals [18]. The Propeller contains 8 processors, called cogs, which means that the video signal can be generated by a cog while the rest of the Propeller can manage the user interface. The Parallax Propeller was chosen to be the central component of the Information System due to its video capabilities. 2.
Jon Waddington 3 Design of the Information System The central component of the Information System is the Propeller chip. This is connected to all the separate features of the system, which are the television circuit, clock, temperature sensors (indoor and outdoor), the IR receiver and the X10 controller. A schematic of the Information System can be seen in figure 3.1.
Jon Waddington 3.1 The Parallax Propeller The Parallax Propeller is a powerful chip capable of high speed processing (up to 80MHz). The chip has eight processors, called cogs, which can perform independently or cooperatively, as the program dictates. This eliminates the need for interrupts as a cog can be dedicated to a single task, leaving the main program to continue undisturbed [21].
Jon Waddington 3.1.1 Propeller Demo Board The Propeller demo board is a prototype board for the Propeller chip. It includes a Propeller chip, connected to numerous peripheral devices. The board includes audio out, composite video out, VGA out, 8 LEDs, a microphone, keyboard and mouse inputs and a USB port. There is also a breadboard on the board for prototyping and there are 8 input/output pins to add functionality. A photograph of the Propeller board can be seen in Figure 3.1.1. Figure 3.1.1.
Jon Waddington 3.1.2 Propeller Software Two pieces of software were used with the Propeller chip. These were the Propeller Tool and the Parallax Serial Terminal. 3.1.2.1 The Propeller Tool The Propeller Tool provides a free development environment [22] for the Propeller chip which is capable of compiling SPIN and PASM and downloading the code to the Propeller or to the EEPROM. Figure 3.1.2.1 . Screenshot of the Propeller Tool Figure 3.1.2.1 shows a screenshot of the Propeller Tool.
Jon Waddington 3.1.2.2 Parallax Serial Terminal The Parallax Serial Terminal is a piece of software which can help when debugging a program. The Propeller can send information to it through the USB port, using the “Parallax Serial Terminal” object which is included in the Propeller Tool. The information is sent to the Parallax serial terminal through the same USB cable which is used to download code to the Propeller.
Jon Waddington 3.2 PAL Video Video signals are displayed on a television screen by drawing each line from left to right, from top to bottom. The amplitude of the waveform represents the brightness of the screen with a high voltage being white and a low voltage being black. The video signal drops below the black level after each line has been displayed. This is the horizontal sync pulse, used to inform the television that a new line is to be drawn [25].
Jon Waddington Equalizing pulses Broad pulses Equalizing pulses Figure 3.2.2 Vertical Blanking Waveform Interlaced video means that two fields of alternate lines are drawn and interleaved to show a single frame. This means that there are two blanking intervals for every frame which is displayed. Interlaced scanning reduces flicker by appearing to double the frame rate from 25 frames per second to 50 frames per second [27].
Jon Waddington 3.2.1 TV Cirtcuit Each cog of the Propeller has an integrated video generator that makes generating video signals possible. Access and control of the video generator are provided by two registers, the Video Scale register and the Video Configuration register. The value in the Video Scale register determines the number of clock cycles before the next frame of data is fetched and it also indicates the number of clock cycles there are for each pixel.
Jon Waddington 3.3 Menu System A menu is displayed on the television which shows four items for the user to choose from. Navigation of the menu is done using the Remote control. The up and down arrows control which item is selected and pressing the “stand-by” button enters the item. The current time and date is constantly displayed along the top of the menu. Figure 3.3 shows the hierarchy of the Information System’s menus. Main Menu Home Automation Temperature X10 Settings Settings Figure 3.3.
Jon Waddington 2 : text.str(string($0A,7,$0B,5,"1.")) text.str(string($0A,7,$0B,7,"2.")) text.str(string($0A,7,$0B,9,"> ")) text.str(string($0A,7,$0B,11,"4. ")) 3 : text.str(string($0A,7,$0B,5,"1.")) text.str(string($0A,7,$0B,7,"2.")) text.str(string($0A,7,$0B,9,"3 ")) text.
Jon Waddington 3.4 Home Automation The first item, “Home Automation”, allows the user to directly control the X10 devices. A full list of devices in the Propeller’s memory can be listed or, if required, the devices can be listed by the room which they are in. Once a device is selected, the user can select whether they wish to turn the device on or off. In the case of a lamp module, there is an option to dim the light.
Jon Waddington 3.4.2 Serial Interface The CM12 X10 controller has a PC interface which uses RS232 serial communications. The controller generates X10 signals and transmits them over the power line, performing the corresponding function on the modules, depending on the user’s input on the computer. The Information System uses an object to imitate the computer’s serial interface and communicate with the controller. The required voltage levels of RS232 signals are bi-polar.
Jon Waddington 3.4.3 CM12 Protocol The serial communications protocol for the CM12 states that the baud rate is 4800 bits per second (bps). There is a start bit, a stop bit and no parity bit. Figure 3.4.3.1, below shows how the serial communication protocol between the Propeller and the CM12 looks. The transmission is in two parts; the first part addresses the device and the second part sends the function to be performed. Figure 3.4.3.1.
Jon Waddington contain the house code and the 4 least significant bits contain the device code or the function code. The checksum is calculated by calculating the sum of the first 2 bytes. This is then transmitted to the Propeller which confirms that the data is correct by transmitting an acknowledge byte of ‘0x00’. When the CM12 is ready to receive again it transmits ‘0x55’ to the Propeller. The SPIN code below shows a method which handles the full transmission with the CM12 controller.
Jon Waddington A B C D E F G H I J K L M N O P House Codes H1 H2 H4 H8 0 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Address Codes D1 D2 D4 D8 0 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 0 Figure 3.4.3.
Jon Waddington 3.5 Temperature The “Temperature” item displays the inside and outside temperatures in Celsius on the screen until the user wishes to return to the main menu. Two temperature sensors are used in the Information System. An internal temperature sensor measures the temperature inside the home and is wired directly to the Propeller chip. An external temperature sensor measures the temperature outside the home and remotely transmits the data to the Propeller chip. 3.5.
Jon Waddington 480µs. This is the Reset pulse. The Propeller then releases the bus to be pulled high by the 4.7kΩ resistor. The DS18B20 responds to this with a Presence pulse by waiting 15 to 60µs for the bus to go high and then pulling it low for between 60 and 240µs. These pulses are shown in figure 3.5.2.1 [34]. Figure 3.5.2.1. Diagram of the 1-Wire Reset and Presence Pulses The read and write slots are issued by the Propeller and allow for one bit to be transmitted.
Jon Waddington After the Propeller issues a Read time slot, the bus is released. The DS18B20 can then leave the bus to go high to transmit a ‘1’ or pull the bus low to transmit a ‘0’. After a minimum of 60µs, the bus is released and pulled high by the 4.7kΩ resistor shown in figure 3.5.1. The DS18B20 has a unique serial number to distinguish itself from other devices which may be present on the 1-Wire bus. The lowest byte contains the DS18B20 family’s code, 0x28.
Jon Waddington Bits 11 to 15 are the sign bits. These define whether the temperature is positive or negative. If it’s positive, these bits will be logic ‘0’. If the temperature is negative, these bits will be logic ‘1’, and the temperature will be the two’s compliment of the temperature. The R0 and R1 bits of the configuration register are set to 0, meaning the temperature resolution is 9 bits. This makes bits 0, 1 and 2 of the temperature redundant and the temperature can be read in steps of 0.5°C.
Jon Waddington pulse, followed by the “Skip ROM” command. This skips the ROM transmission and the code then transmits the “ConvertT” command which notifies the DS18B20 to start converting the temperature. The code then transmits read slots on the bus and the DS18B20 continues to transmit ‘0’ until the conversion is complete and it transmits a ‘1’. The code continues by transmitting another “Skip ROM” command and the “Read Scratchpad” command.
Jon Waddington '' Show the temperature tc <<= 16 ‘shift left 16 bits if (tc < 0) ‘check temperature sign text.str(string("-")) ‘display minus sign ||tc ‘convert sign tc >>= 16 ‘shift bits back t := tc >> 4 ‘discard lower 4 bits text.dec(t) ‘display temperature text.out($B0) ‘display degrees sign text.out($43) ‘display ‘C’ 3.6 External Temperature Sensor The external temperature circuit is powered by 4 AA batteries, giving 6V to the input of the 3.3V voltage regulator.
Jon Waddington Figure 3.6.1.1. Schematic of the XBEE Transmitter The remote XBEE module is loaded with the router firmware. It samples the ADC pin and transmits the sample to the receiving module. The sensor gives a linear voltage output of 10mV/°C, meaning the temperature can be calculated using a simple equation. The settings on the XBEE modules were entered using the X-CTU software. The table below shows the relevant settings of the transmitter remote XBEE module.
Jon Waddington ATID is the PAN ID address which is, essentially, the address of the network. The router and coordinator XBEE modules share this address to allow for remote communications. ATDH and ATDL contain the corresponding serial number (ATSH and ATSL) of the XBEE module which the information is to be sent to. ATD0 is used to change the setting of the AD0/DIO0 pin. Changing this value to ‘2’ informs the XBEE that the pin is to be used as an analogue input.
Jon Waddington Coordinator Description ATID 3456 PAN ID address ATSH 13A200 Serial number (high) ATSL 403D8E44 Serial number (low) ATDH 13A200 Destination address (high) ATDL 40624DD8 Destination address (low) API (Application Programming Interface) operations are used for the communications, meaning that packets of information are sent which follow a specific structure [35]. Figure 3.6.1.3 shows the API structure for a packet containing samples of data [35].
Jon Waddington Start Delimiter Length (MSB) Length (LSB) The start delimiter has a value of 0x7E. This begins the API packet. The length is the number of bits to follow, not including the checksum. API Identifier The API identifier indicates the type of packet being sent. 0x92 indicates digital or analogue samples. 64 Bit Address The 64 bit address is the ATSH and ATSL values of the XBEE module where the packet is being sent from.
Jon Waddington The received sample is extracted from the API packet and then converted into a voltage using the following formula [35]. ( ) = (3.6.1 – 1) ∙ 1200 The voltage is then used to calculate the temperature using another formula [36]. = ( ° ) (3.6.1 – 2) Combining these equations, and rearranging them to avoid making the Propeller chip perform floating point math, gives the following equation. = × ° (3.6.
Jon Waddington 3.7 X10 Settings Adding and removing X10 devices from the information system can be done in “X10 Settings”. When adding a device, the user is first prompted to enter the name of the device via the remote control or a keyboard. The device must then be assigned to one of the four rooms; “Living Room”, “Dining Room”, “Kitchen” or “Bedroom”. The user must then specify whether the device is an appliance or lamp and the device address is then entered.
Jon Waddington The code below shows how the name of a device is input with the remote control. PRI rcname_in(i) | j, t, x code := 0 'flush code t := i 'backup device number repeat j from i to i+9 'clear bytes in name name[j]~ i := t 'i = device number text.out($00) 'clear screen showdate(0, 0) 'show date and time showtime(35, 0) text.
Jon Waddington 3.7.1 Memory backup I2C is also used by the Propeller to write to the memory in EEPROM. This can be used to backup contents of the Propeller’s RAM, meaning that when the system is reset, the backed up content is automatically restored. This is used in the Information System when the user adds an X10 module to the system, the Propeller writes all the associated information to the EEPROM. The same process is undergone if the user deletes or edits an X10 module.
Jon Waddington 3.8 Settings The fourth item allows the user to set the time and date using the remote control. 3.8.1 Real Time Clock Keeping the date and time on the information system required a Real-Time Clock (RTC). A PCF8563 is used for this purpose. It provides the month, date, day, hour, minutes and seconds, based on a 32.768kHz crystal. The circuit diagram for the RTC is shown below in figure 3.8.1.
Jon Waddington 3.8.2 I2C The I2C bus allows for bi-directional communications using a Serial Data (SDA) line and a Serial Clock (SCL) line. Both of these lines are connected to the positive line via a 4.7kΩ resistor, as shown in figure 3.8.1. One bit of data is sent on every clock pulse and the SDA line must be stable during the high state of the SCL line. In the Information System, the Propeller chip acts as the master as it controls the messages on the I2C bus.
Jon Waddington The address and contents of the registers are shown below in figure 3.8.2.1 [37]. Figure 3.8.2.1. The addresses and Contents of the PCF8563’s Registers The values in the registers are in Binary Coded Decimal (BCD), meaning that each digit, from 0 to 9, is represented by 4 bits. The lower 4 bits in the registers represent the units digit and the upper bits represent the tens digit. The Table below shows a decimal value of 34 in BCD.
Jon Waddington In this example, the Propeller transmits the Start Condition, followed by the read address for the PCF8563. An acknowledge bit is received and the Propeller sends the address of the minute register. The PCF8563 acknowledges the request and then sends the value of the register. The PCF8563 then leaves the SDA line high to inform the Propeller that no more data will be transmitted and the Propeller transmits a Stop Condition. 3.8.
Jon Waddington The code first displays the time in white text and then the hours value changes to yellow, indicating to the user that this is the value currently being modified. The value of the hours is then modified by the user using the ‘up’ and ‘down’ buttons on the remote control until ‘enter’ is pressed. The hours then turn white again and the code repeats for the minutes. 3.8.4 Displaying date and Time The SPIN code below shows a method which shows the time on the screen.
Jon Waddington PRI wait : c | m, i {{waits for key press while updating time}} rc.flush m := getminute 'flush RC5 'get minute value repeat until rc.getcommand repeat i from 0 to 19 waitcnt(cnt + 4_000_000) if rc.getcommand i := 19 'repeat until button is pressed 'repeat 20 times 'wait 50ms 'if button is pressed 'exit repeat if m <> getminute showtime(35, 0) showdate(0, 0) m := getminute c := rc.getcommand rc.
Jon Waddington 3.9 Infra-red Remote Controller Infra-red (IR) remote controls are commonly used to control home entertainment systems as they are simple to implement, very cheap to manufacture and make it easier for the consumer to use devices as they can be operated from a distance. The main disadvantage of infra-red is that the signal cannot penetrate opaque objects. Remote controls use an IR LED to emit pulses of IR light.
Jon Waddington 3.9.1 IR receiver The Infra-Red receiver circuit is based on a Sharp GP1UX301QS IR receiver. The device is tuned to detect bursts of IR signals at 40KHz which is capable of detecting 36KHz signals. Figure 3.9.1 shows the circuit diagram for the IR receiver. The output of the receiver is the demodulated IR signal and is connected to pin 2 of the Propeller chip where it is decoded by the program. Figure 3.9.1.
Jon Waddington The code below is written in PASM and decodes RC5 codes received at the Propellers input pin.
Jon Waddington quart long 0 'calculated 1/4 bit time tquart long 0 'calculated 3/4 bit time full long 0 ‘calculated full bit time _l long 0 delay long 5_000_000 half long 0 'timed half bit time outmask res 1 time res 1 start res 1 addr res 1 'PAR address rxcode res 1 count res 1 frame res 1 This code is split into four parts, ‘go’, ‘detect’, ‘sb2’, and ‘loop’. The ‘go’ section initializes the input pin and skips to the ‘detect’ section.
Jon Waddington 4 Evaluation of the Information System To assess the functionality of the system, a series of tests were carried out. The tests included analysing the video signal, the user interface, the remote control input, the internal and external temperature measurements, the communication with the X10 controller, the real time clock and the program’s memory usage. 4.1 TV Circuit Figure 4.
Jon Waddington The table below shows the corresponding timing measurements for the waveform in figure 4.1. The third column shows the difference from the expected times to the measured times. All the measurements are reasonably low and within the acceptable limits. Theoretical [41] Practical Error % Scan line (A) 64µs 64µs 0% Horizontal Sync (B) 4.7µs 4.52µs 3.83% Active Video (C) 52µs 52.16µs 0.3% Horizontal Blanking (D) 12µs 11.88µs 1% Subcarrier Frequency 4.43MHz 4.42MHz 0.
Jon Waddington 4.2 The User Interface Figure 4.2.1 shows a photograph of the main menu screen with the “Settings” item selected. The date can be seen in the top left corner and the time can be seen in the top right corner. Figure 4.2.1. A Picture of the Main Menu Figure 4.2.2 shows a picture of the “X10 Setup” item, where the user is able to enter, or edit, the X10 modules in the Information System. Figure 4.2.2.
Jon Waddington Figure 4.2.3 shows the name of the X10 device being entered as “123”. This is done via the remote control as there is no keyboard detected by the Information System. Figure 4.2.3. A Picture of the Device Name, “123”, being Entered Figure 4.2.4 shows the room of the device being entered. In this example, Dining room is selected. Figure 4.2.4. A Picture of the Device’s Room being Entered Figure 4.2.5 shows the device type for “123” being entered as “lamp”. Figure 4.2.5.
Jon Waddington Figure 4.2.6 shows the X10 address of the device being entered. The address entered was “02”. Figure 4.2.6. A Picture of the X10 Address being Inputted The “Edit Device” item in the “X10 Setup” item allows the user to view the modules already in the Information System’s memory. The user can also modify or delete the modules from this menu. Figure 4.2.7 shows the “Edit Device” menu with the device named “123” along with some previously entered devices. Figure 4.2.7.
Jon Waddington Figure 4.2.9 shows the “Home Automation” menu. The “All Devices” option displays all the X10 devices and the “List by room” option allows the devices to be filtered by room. Figure 4.2.9. A Picture of the “Home Automation” Menu Figure 4.2.10 shows the Information System listing all the devices from the memory. Figure 4.2.10. A Picture of the Device Listing Figure 4.2.11 shows the Information System listing the devices which are in the “Dining Room”.
Jon Waddington Figure 4.2.12 shows the menu which prompts the user to select the required function for the device, “123”. The options are to turn it on, off or dim it. Figure 4.2.12. A Picture of the Device’s Function Menu Figure 4.2.13 shows the “Settings” menu, giving the user the options to set the time and date. Figure 4.2.13. A Picture of the “Settings” Item Figure 4.2.14 shows the interface as the time is being set.
Jon Waddington Figure 4.2.15 shows the interface as the date is being set. In the picture, the day is highlighted in yellow, indicating that this is the part which is currently being edited. Figure 4.2.15.
Jon Waddington 4.3 Infra-red Remote Controller The waveform in figure 4.3 shows the input to the Propeller from the Infra-Red receiver when the ‘5’ button is pressed on the remote control. 1 Start Bits 1 1 Toggle Bit 0 0 1 0 Address Bits 1 0 0 0 1 0 1 Command Bits Figure 4.3. Waveform of Input from Infra-Red Receiver The two start bits are logic ‘1’, as expected and the toggle bit is also logic ‘1’. This toggles with every new key press. The address bits are equal to ‘5’.
Jon Waddington 4.4 Temperature Measurement The picture in figure 4.4 shows the temperature menu, displaying both inside and outside temperatures in degrees Celsius. Figure 4.4. Picture of the Temperature Menu with the Internal and External Temperatures Displayed 4.4.1 Internal Temperature To start the conversion of the temperature on the DS18B20 IC, the Propeller transmits a reset pulse and awaits the response of the DS18B20’s presence pulse.
Jon Waddington The propeller waits until the temperature conversion is complete by issuing read time slots. The DS18B20 responds to this by transmitting ‘0’ until the conversion is complete and it will transmit a ‘1’. The Propeller then transmits the Skip ROM command again, followed by the Read Scratchpad command. This transmission can be seen in figure 4.4.1.2. 0 0 LSB 1 1 0 0 1 1 0 1 MSB LSB 1 0xCC 1 1 1 0 1 MSB 0xBE Figure 4.4.1.2.
Jon Waddington Figure 4.4.1.4 shows the transmission of the 8 most significant bits of the temperature. A reset pulse is then sent from the Propeller to inform the DS18B20 that further information is not required. 1 0 0 0 0 LSB 0 0 0 MSB 0x01 Figure 4.4.1.4. Waveform of the 8 least significant bits of the Scratchpad The lowest four bits of the temperature can be ignored as they represent the fraction of centigrades which are not needed in the Information System.
Jon Waddington In this example, the first two bytes are 0x00 and 0x12, meaning that there are 18 bytes of information to follow, excluding the checksum. The 3rd byte is the API identifier. 0x92 notifies the receiver that sampled data is being transmitted. The next 8 bytes contain the 64 bit address of the remote XBEE, 0x00, 0x13, 0xA2, 0x00, 0x40, 0x62, 0x4D and 0xD8. Bytes 12 and 13 are the 16 bit network address. In this case they are 0x68 and 0xD6.
Jon Waddington 0 92 + 0 13 + 0 2 + 0 40 + 0 62 + 0 4 + 0 8+0 (4.4.2 - 3) 6 + 0 68 + 0 01 + 01 + 0 01 + 0 02 + 0 73 + 0 3 = 0 4 Taking the lowest byte gives 0xFF, as expected, verifying that the information in the API packet is correct. 4.5 RS232 Figure 4.5 shows the waveform for an RS232 signal transmitting the value 0x63 at 4800bps.
Jon Waddington 4.6 X10 The testing of the X10 commands proved that they were reliable. The modules performed their required functions without a problem although they were quite slow to respond, taking approximately one second to perform the desired function due to the data transfer speed being limited to the 50Hz mains frequency. 4.7 I2C The I2C example in this section show how the Propeller communicates with the PCF8563 IC to read the minute register. Figure 4.7.
Jon Waddington Figure 4.7.2 shows the transmission of the register address of the minute register (0x03) being transmitted. This is the register of the value which is required. SDA SCK 0 0 0 0 0 0 1 1 0x03 Figure 4.7.2. I2C Waveform Sending the Address 0x03 Figure 4.7.3 shows the transmission of the PCF8563’s read address. SDA SCK 1 0 1 0 0 0 1 1 0xA3 Figure 4.7.3.
Jon Waddington Figure 4.7.4shows the transmission of the PCF8563’s minute register to the Propeller’s input pin. The value of the 7th bit is not used in this register. The value of the register is 0x52, which converted from binary coded decimal is 52 minutes. SDA SCK X 1 0 1 0 0 1 0 Acknowledge 0x52 Figure 4.7.4. I2C Waveform Sending the byte 0x52 4.
Jon Waddington 4.9 EEPROM Memory Usage Figure 4.9 shows a screenshot of the program information which can be found by pressing F8 in the Propeller Tool. This data is loaded into the EEPROM and the Propeller loads it into the internal RAM as it boots up. The figure shows that the majority of the Propeller’s memory is taken up by program memory but there is still over 35% of memory remaining. This leaves room for adding additional features to the Information System, in the future. Figure 4.9.
Jon Waddington 5 Conclusion In this report, an Information System has been designed to provide home control, and a prototype has been developed and constructed. It was found that there is a need for this type of device among elderly and disabled people and that it is not an unrealistic situation. The Information System worked as expected, allowing the user to control X10 modules by adding devices to the device’s memory via the remote control or a keyboard.
Jon Waddington 5.2 Installation/Implementation To install the Information System into a home, it should be placed near a television in a similar way to a VCR or set-top box. The power is provided by an external, centre positive, 5V AC adapter. The television is connected via a phono lead. When the System is switched on for the first time, the user will be required to set the time and date by navigating to the settings menu.
Jon Waddington Net Item Price Quantity Cost Source Propeller IC £5.90 1 £5.90 http://www.active-robots.com/products/parallax/propeller-chip-40-pin-dip.shtml 24LC256 £1.48 1 £1.48 http://uk.farnell.com/microchip/24lc256-e-sn/eeprom-256k-i2c-2-5v-soic8/dp/1579573 AC Adapter £6.26 1 £6.26 http://uk.farnell.com/stontronics/ad-05100rbs2-1/adaptor-5vdc-1a-uk/dp/1279510 XBEE 10 pin headers £0.30 4 £1.20 http://proto-pic.co.uk/products/2mm-10-Pin-Xbee-Socket.html http://uk.farnell.
Jon Waddington Another addition to the Information System could be to add sound. This could consist of a notification sound when a button is pressed, ensuring the user knows that the press was acknowledged by the system. A useful addition to the program would be to add scheduling of tasks. This would allow the user to input an X10 task, and a date and time, and the Information System would perform the task at the inputted time. An example of this would be to turn all the lights off at a certain time.
Jon Waddington 6 References [1] George Demiris PhD, Marilytn J. Rantz PhD, RN, Marjorie Skubic PhD, Myra A. Aud PhD, RNn Harry W. Tyrer Jr PhD, “Home Based Assistive Technologies for Elderly: Attitudes and Perceptions”, Department of Health Management and Informatics, University of Missouri-Columbia, Columbia, MO, Sinclair School of Nursing, University of Missouri – Columbia, School of Engineering, University of Missouri-Columbia, 2005.
Jon Waddington [11]HomeSeer Wiki contributors, 2010, August, “HomeSeer HS2”, [Online] Available: http://www.homeseer.com/wiki/index.php/HomeSeer_HS2, [Accessed 20th July 2010] [12]Let’s Automate, “HomeSeer Home Automation Software”, [Online], Available: http://www.letsautomate.com/12014.cfm?CFID=157731&CFTOKEN=F31719C8-D40D4761-B802CD6EC1EE1B4F, [Accessed 20th July 2010] [13]Mark McCall, 2009, October, “Marmitek EasyTouch Panel10 - Inexpensive X-10 Touchscreen Control”, [Online] Available: http://www.
Jon Waddington [20] Digi International, “XBee® & XBee-PRO® ZB ZigBee® PRO RF Modules”, [Online], Available: http://www.digi.com/products/wireless/zigbee-mesh/xbee-zbmodule.jsp#overview, [Accessed 15th June 2010] [21]Jeff Martin, “Propeller Manual”, Version 1.1, [Online], Available: http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/WebPM-v1.1.pdf, [Accessed 11th June 2010] [22] Parallax Inc, “Parallax Software Policy Memo”, [Online], Available: http://www.parallax.
Jon Waddington [32] Marmitek, “Interface Communication Protocol”, [Online], Available: http://www.marmitek.com/en/download/software/cm11_x10_protocol_en/114/2, [Accessed 16th June 2010] [33] Smart Home Systems Inc, “X10 Theory”, [Online], Available: http://www.smarthomeusa.com/info/x10theory/#theory, [Accessed 16th June 2010] [34] Dallas Semiconductor, “DS18B20 datasheet” [Online], Available: http://datasheets.maxim-ic.com/en/ds/DS18B20.
Jon Waddington [43] UK Automation, “Marmitek Easyouch Panel10”, [Online], Available: http://www.ukautomation.co.uk/marmitek-easytouch-panel10-p-1401.html, [Accessed 19th June 2010] [44] Mark McCall, 2003, October, “X10 Curtain Controller for Autoglide and Swish”, [Online], Available: http://www.automatedhome.co.uk/New-Products/X10-CurtainController-for-Autoglide-and-Swish.html, [Accessed 19th June 2010] [45] Mark McCall, 2002, May, “Swish Autoglide (K400) – Review”, [Online], Available: http://www.
Jon Waddington 7 Information System Source Code 78
Jon Waddington Tv_Text_Demo CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000- 110 hA = %0110 hB = %1110 hC = %0010 hD = %1010 hE = %0001 hF = %1001 hG = %0101 hH = %1101 hI = %0111 hJ = %1111 hK = %0011 hL = %1011 hM = %0000 hN = %1000 hO = %0100 hP = %1100 d1 = %0110 d2 = %1110 d3 = %0010 d4 = %1010 d5 = %0001 d6 = %1001 d7 = %0101 d8 = %1101 d9 = %0111 d10 = %1111 d11 = %0011 d12 = %1011 d13 = %0000 d14 = %1000 d15 = %0100 d16 = %1100 '6 '14 '2 '10 '1 '9 '5 '13 '7 '15 '3 '11 '0 '8 '4 '12 Units_Off = %
Jon Waddington up = 33 down = 32 enter = 12 'RC5 code "channel up" 'RC5 code "channel down" 'RC5 code "stand-by" RD_ROM = $33 MATCH_ROM = $55 SKIP_ROM = $CC SRCH_ROM = $F0 ALARM_SRCH = $EC CVRT_TEMP = $44 WR_SPAD = $4E RD_SPAD = $BE COPY_SPAD = $48 RD_EE = $B8 RD_POWER = $B4 ' 1W ROM commands ' DS1822 commands VAR byte sel byte code byte name[160] byte dvc[16] byte addr[16] byte room[16] byte type[16] byte dvcnum byte rcflag byte snum[8] OBJ text : "tv_text" rc : "genrc5" x10 : "x10" eeprom : "Propell
Jon Waddington i:=0 repeat rc.flush text.out($00) showdate(0, 0) showtime(35, 0) text.str(string(13," Information System")) text.str(string(13,13,13," . Home Automation",13,13," Setup",13,13," . Settings")) code := 0 repeat until (code == enter) case sel 0 : text.str(string($0A,7,$0B,5,"> ")) text.str(string($0A,7,$0B,7,"2.")) text.str(string($0A,7,$0B,9,"3.")) text.str(string($0A,7,$0B,11,"4. ")) 1 : text.str(string($0A,7,$0B,5,"1.")) text.str(string($0A,7,$0B,7,"> ")) text.str(string($0A,7,$0B,9,"3.
Jon Waddington text.str(string($0A,5,$0B,8," ")) 1 : text.str(string($0A,5,$0B,4," ")) text.str(string($0A,5,$0B,6,">")) text.str(string($0A,5,$0B,8," ")) 2 : text.str(string($0A,5,$0B,4," ")) text.str(string($0A,5,$0B,6," ")) text.str(string($0A,5,$0B,8,">")) code := wait if code == up ++sel if sel == 3 sel := 0 if code == down sel := --sel <# 2 case sel 0 : AllDevices 1 : ChooseRoom 2 : sel := 0 PRI ChooseRoom text.out($00) sel := 0 text.out($00) showdate(0, 0) showtime(35, 0) text.
Jon Waddington PRI DisplayRoom(r) | dp, j, i, n {{still needs work}} text.out($00) showdate(0, 0) showtime(35, 0) dp := 0 case r 0 : text.str(string(13," Bedroom",13)) 1 : text.str(string(13," Living Room",13)) 2 : text.str(string(13," Dining Room",13)) 3 : text.str(string(13," Kitchen",13)) n := 0 repeat j from 0 to (dvcnum - 1) if room[dp] == r text.str(string(13," ")) repeat i from (dp*10) to ((dp*10) + 9) if name[i] text.
Jon Waddington dp-devcom(dp) PRI AllDevices | dp, j, i {{Method displays all devices}} sel := 0 dp := 0 text.out($00) showdate(0, 0) showtime(35, 0) text.str(string(" Home Automation", 13)) repeat j from 0 to (dvcnum - 1) text.str(string(13," ")) repeat i from (dp*10) to ((dp*10) + 9) if name[i] text.out(name[i]) else i := (dp * 10) + 9 dp++ sel := 0 code := 0 repeat until (code == enter) text.xy(2, 3) text.str(string(" ")) text.xy(2, dvcnum + 2) text.str(string(" ")) text.xy(2, sel+2) text.
Jon Waddington showdate(0, 0) showtime(35, 0) text.str(string(" ")) repeat i from (dp*10) to ((dp*10) + 9) if name[i] text.out(name[i]) else i := (dp * 10) + 9 text.str(string(13,13," On")) text.str(string(13," Off")) if type[dp] text.str(string(13," Dim")) i:=2 else i:= 1 text.str(string($0A,4,$0B,6,"Return")) repeat until (code == enter) & ((sel == 2) | (sel == 3)) case sel 0 : text.str(string($0A,3,$0B,3,">")) text.str(string($0A,3,$0B,4," ")) text.str(string($0A,3,$0B,5," ")) text.
Jon Waddington rc.flush rcflag := rc.gettoggle repeat until (rc.gettoggle <> rcflag) & ((rc.getcommand =>0) & (rc.getcommand =<9)) | (rc.getcommand == enter) if ((rc.getcommand =>0) & (rc.getcommand =<9)) code := rc.getcommand if i == 0 j := code else j := ((j*10) + code) <# 100 text.dec(code) if rc.getcommand == enter i := 2 text.str(string(" ")) text.dec(((j*22)/100)) x10.dim(addr[dp],((j*22)/100)) waitcnt(cnt + 50_000_000) PRI Temperature | m, i {{Method shows Temperature menu}} text.
Jon Waddington temp := readtc showc(temp) ' read the temperature ' display in °C else case status %00 : text.str(string("-- Bus short")) %01 : text.str(string("-- Bus interference")) %11 : text.str(string("-- No device")) waitcnt(cnt +100_000_000) ow.finalize PRI readtc | tc '' Reads temperature from DS1820 '' -- returns degrees C in 0.1 degree units ow.reset ow.write(SKIP_ROM) ow.write(CVRT_TEMP) repeat tc := ow.rdbit until (tc == 1) ow.reset ow.write(SKIP_ROM) ow.write(RD_SPAD) tc := ow.read tc |= ow.
Jon Waddington tempout := 0 repeat bit from 18 to 19 tempout += XB.dtset(bit) if bit == 18 tempout <<= 8 if (tempout < 10000) text.dec((((tempout*1200)/1023)-500)/10) PRI X10Setup {{Method shows X10 setup Menu}} repeat until ((code == enter) & (sel == 2)) rc.flush in.start(26, 27) sel := 0 code := 0 text.out($00) showdate(0, 0) showtime(35, 0) text.str(string(13," X10 Setup",13,13," menu")) repeat until (code == enter) case sel 0 : text.str(string($0A,3,$0B,4,"> ")) text.str(string($0A,3,$0B,5," ")) text.
Jon Waddington keyName_in(i) else rcName_in(i) Room_in(j) Type_in(j) Address_in(j) waitcnt (cnt + 50_000_000) {{test input}} text.out($00) showdate(0, 0) showtime(35, 0) text.str(string(13,13," ")) repeat i from (j*10) to ((j*10) + 9) if name[i] text.out(name[i]) else i := ((j*10) + 9) text.str(string(13," ")) case room[j] 0 : text.str(string("Bedroom")) 1 : text.str(string("Living Room")) 2 : text.str(string("Dining Room")) 3 : text.str(string("Kitchen")) text.str(string(13," ")) case type[j] 0 : text.
Jon Waddington text.out(name[i]) else i := (dp * 10) + 9 dp++ rc.flush sel := 0 code := 0 repeat until (code == enter) text.xy(2, 2) text.str(string(" ")) text.xy(2, dvcnum + 1) text.str(string(" ")) text.xy(2, sel+1) text.str(string(" ")) text.xy(2, sel+2) text.str(string(" >")) text.xy(2, sel+3) text.str(string(" ")) code := wait if code == up ++sel if sel == dvcnum sel := 0 if code == down sel := --sel <# dvcnum - 1 Edit(sel) PRI Edit(dp) | i sel := 0 text.out($00) showdate(0, 0) showtime(35, 0) text.
Jon Waddington text.dec(dvc[dp]) text.str(string(13," Delete")) code := 0 repeat until code == enter case sel 0 : text.str(string($0A,1,$0B,1,">")) text.str(string($0A,1,$0B,2," ")) text.str(string($0A,1,$0B,3," ")) text.str(string($0A,1,$0B,4," ")) text.str(string($0A,1,$0B,5," ")) 1 : text.str(string($0A,1,$0B,1," ")) text.str(string($0A,1,$0B,2,">")) text.str(string($0A,1,$0B,3," ")) text.str(string($0A,1,$0B,4," ")) text.str(string($0A,1,$0B,5," ")) 2 : text.str(string($0A,1,$0B,1," ")) text.
Jon Waddington 'rc.flush e := in.newkey if e <> $0D text.out(e) name[i] := e i++ in.stop PRI rcname_in(i) | j, t, x code := 0 t := i repeat j from i to i+9 name[j]~ i := t text.out($00) showdate(0, 0) showtime(35, 0) text.str(string(13," Add Device (Remote)",13,13," x := 12 repeat until ((code == enter) OR (i == t+9)) code := wait if (code =< 9) text.xy(x, 4) text.dec(code) name[i] := code + 48 i++ x++ Name: ")) PRI room_in(j) text.out($00) showdate(0, 0) showtime(35, 0) text.
Jon Waddington text.str(string($0A,13,$0B,6," ")) text.str(string($0A,13,$0B,7,"> ")) room[j] := sel code := wait if (code == up) ++sel if sel == 4 sel := 0 if (code == down) sel := --sel <# 3 sel := 0 PRI Type_in(j) sel := 0 code := 0 text.out($00) showdate(0, 0) showtime(35, 0) text.str(string(13," Add Device",13,13," repeat until ((code == enter)) case sel 0 : text.str(string($0A,13,$0B,4,"> ")) text.str(string($0A,13,$0B,5," ")) type[j] := sel 1 : text.str(string($0A,13,$0B,4," ")) text.
Jon Waddington case dvc[j] 1 : addr[j] := d1 2 : addr[j] := d2 3 : addr[j] := d3 4 : addr[j] := d4 5 : addr[j] := d5 6 : addr[j] := d6 7 : addr[j] := d7 8 : addr[j] := d8 9 : addr[j] := d9 10 : addr[j] := d10 11 : addr[j] := d11 12 : addr[j] := d12 13 : addr[j] := d13 14 : addr[j] := d14 15 : addr[j] := d15 16 : addr[j] := d16 PRI delete(dp) | i repeat i from dp*10 to ((dvcnum-1) * 10) + 9 name[i] := name[i+10] repeat i from dp to dvcnum - 1 room[i] := room[i+1] type[i] := type[i+1] dvc[i] := dvc[i+1] addr[
Jon Waddington if (code == down) sel := --sel <# 2 code := 0 case sel 0 : sett 1 : setd sel := 3 PRI sett | h, m {{shows the set time menu}} text.out($00) showtime(3, 3) 'clear display 'show current time at X, Y h := gethour m := getminute 'get hour and minute text.colour(2) 'change text colour to yellow repeat until code == enter 'repeat until enter is pressed text.xy(3, 3) text.dec(h>>4 & $03) 'show hour (BCD) text.dec(h & $0F) repeat until rc.getcommand 'wait until a button is pressed code := rc.
Jon Waddington rc.flush if code == down 'increment minute ++m if (m & $0F) => 10 m &= $70 m += 16 if (m & $7F) => $60 'loop minute m := 0 if code == up 'decrement minute if (m & $0F) > 1 --m elseif (m & $70) > 0 m -= 16 m |= $09 else 'loop minute m := $59 text.xy(6, 3) 'show set minute in white text text.colour(0) text.dec(m>>4 & $07) text.dec(m & $0F) settimebcd(h, m, 0) 'save changes of time PRI setd | date, day, m, y {{shows the set date menu}} text.
Jon Waddington text.xy(3, 3) 'move text cursor to X, Y text.colour(0) 'set text colour to white case day 'show set day in white 0 : text.str(string("Sun")) 1 : text.str(string("Mon")) 2 : text.str(string("Tue")) 3 : text.str(string("Wed")) 4 : text.str(string("Thu")) 5 : text.str(string("Fri")) 6 : text.str(string("Sat")) code := 0 'empty code (RC5) text.colour(2) 'set yellow text colour repeat until code == enter 'repeat unitl enter is pressed text.xy(7, 3) 'move text cursor to X, Y text.
Jon Waddington 8 : text.str(string("Aug")) 9 : text.str(string("Sep")) 10 : text.str(string("Oct")) 11 : text.str(string("Nov")) OTHER : text.str(string("Dec")) 'if m is out of range, set to 12 m := 12 repeat until rc.getcommand 'wait until a button is pressed code := rc.getcommand 'code = RC5 code rc.flush 'flush RC5 if code == down 'increment month ++m if m == 13 'loop month m := 1 if code == up 'decrement month --m text.xy(10, 3) 'show set date in white text.colour(0) case m 1 : text.
Jon Waddington y := $99 text.xy(16, 3) 'show set year in white text.colour(0) text.dec(y>>4 & $0F) text.dec(y & $0F) setdatebcd(date, day, m, y) 'save changes of date PRI wait : c | m, i {{waits for key press while updating time}} rc.flush 'flush RC5 m := getminute 'get minute value repeat until rc.getcommand 'repeat until button is pressed repeat i from 0 to 19 'repeat 20 times waitcnt(cnt + 4_000_000) 'wait 50ms if rc.
Jon Waddington text.out($20) 'space text.dec(date>>4 & $03) 'display the 10s of date text.dec(date & $0F) 'display the units of date text.out($20) 'space case m 'display the month 1 : text.str(string("Jan")) 2 : text.str(string("Feb")) 3 : text.str(string("Mar")) 4 : text.str(string("Apr")) 5 : text.str(string("May")) 6 : text.str(string("Jun")) 7 : text.str(string("Jul")) 8 : text.str(string("Aug")) 9 : text.str(string("Sep")) 10 : text.str(string("Oct")) 11 : text.str(string("Nov")) 12 : text.
Jon Waddington PRI getyear : y y := i2c.getbyte($A3, $08) PRI settime (h, m, s) h := ((h/10) << 4) + h//10 m := ((m/10) << 4) + m//10 s := ((s/10) << 4) + s//10 i2c.putbyte($A2, $04, h) i2c.putbyte($A2, $03, m) i2c.putbyte($A2, $02, s) PRI settimebcd(h, m, s) i2c.putbyte($A2, $04, h) i2c.putbyte($A2, $03, m) i2c.putbyte($A2, $02, s) PRI setdate (date, day, month, year) date := ((date/10) << 4) + date//10 month := ((month/10) << 4) + month//10 | $80 year := (((year/10) << 4) + year//10) i2c.
Jon Waddington Genrc5 ''IR-Receiver (RC5) VAR long rc5 'byte flag 'rc5 code received PUB init (pin) {{Launch cog to detect RC5 codes}} rxmask := |< pin 'mask input pin full := (clkfreq/562) 'calculate bit times thalf := full >> 1 quart := thalf >> 1 tquart := (thalf + quart) cognew(@go, @rc5) 'begin RC5 cog PUB getcommand : c {returns command bits} c := rc5 & $3F 'bit masking puts lowest 6 bits of rc5 into c PUB getaddress : a {returns address bits} a := (rc5 & $7C0) >> 6 a 'rc5 is shifted right until bi
Jon Waddington sub half, start 'half - start = start pulse length, should be about 71120 (80MHz * 889us) cmp lh, half wz, wc 'check that the half value is between the upper and lower limits if_nc jmp #detect cmp uh, half wz, wc if_z_or_c jmp #detect Sb2 mov count, cnt add count, tquart waitcnt count, 0 test rxmask, ina if_nz jmp #detect mov _l, #12 mov count, cnt add count, full 'wait 3T/4 to detect second start bit wz 'check second start bit 'jump to detect if zero not detected 'set up loop iteration '
Jon Waddington X10 {{ hA = %0110 hB = %1110 hC = %0010 hD = %1010 hE = %0001 hF = %1001 hG = %0101 hH = %1101 hI = %0111 hJ = %1111 hK = %0011 hL = %1011 hM = %0000 hN = %1000 hO = %0100 hP = %1100 d1 = %0110 d2 = %1110 d3 = %0010 d4 = %1010 d5 = %0001 d6 = %1001 d7 = %0101 d8 = %1101 d9 = %0111 d10 = %1111 d11 = %0011 d12 = %1011 d13 = %0000 d14 = %1000 d15 = %0100 d16 = %1100 Units_Off = %0000 'All units off Lights_On = %0001 'All lights on On = %0010 Off = %0011 Dim = %0100 Bright = %0101 Lights_Off = %0
Jon Waddington VAR byte housecode byte code OBJ serial : "simple_Serial" PUB init(rx, tx, house) {initialise X10 house code and serial communications} housecode := house << 4 serial.init(rx, tx, 4800) PUB do(device, function) | rx {method to perform a function on X10 devices} repeat until rx == (($04 + (housecode + device))& $FF) 'repeat until checksum received serial.tx($04) 'transmit header serial.tx(housecode + device) 'transmit code rx := serial.