Presentation on theme: "House of the Future: Network/PC ECE 345 Summer 1999 Ari Pernick, Michael Upham, Matthew Hinterscher Group #5 TA: Purvesh Thakker."— Presentation transcript:
House of the Future: Network/PC ECE 345 Summer 1999 Ari Pernick, Michael Upham, Matthew Hinterscher Group #5 TA: Purvesh Thakker
Introduction zObjective: To create a home automation system which can be easily controlled from any home PC. zMultiple microcontrollers will be used to collect data from sensors throughout the house. They will also be used to control any devices which are attached. zThe microcontrollers communicate with the PC via a multi-drop RS 485 serial bus. This allows for up to 31 microcontrollers in the house at a time.
System Components zMC68HC11 microcontroller yaccepts inputs from sensors, outputs to lights, doors, etc. ycommunicates with computer over RS-485 network zRS-232 to RS-485 converter yallows for longer network runs which are useful in a full-scale operation yallows for multiple devices to communicate on the same network zComputer yrunning Java GUI client and Bus Master
Network Adapter Takes RS-232 from serial port and passes it on to RS-485 serial bus. Timer only enables drivers for a single character length at 9600 baud. Otherwise it receives all characters sent. RS 485 Bus Driver Enable RS 485 Driver One Shot Timer RS 232 Driver TTL Serial Data RS 232 To Host Trigger Timer
Microcontrollers zEach microcontroller contains the code for communicating with the PC. zThree microcontrollers connect the sensors to the network. yEach microcontroller contains customized code for the sensors that are attached to it. x1 - Temperature in Fahrenheit from remote group x1 - Manual light switches, light outputs, beam entry sensor x1 - Motion detection and temperature in Celsius
Microcontroller Code Initialize Get sensor and output status Commands in table? Send commands to outputs Communication from PC? ID# match assigned ID? Send and receive packets to and from PC yes no
Memory Table Format Command Table Status Table
Real Time Interrupt zSet Interrupt rate at ms zInterrupt Handler yReads temperature and motion counters and stores values in variables. yThen resets counters to zero to begin next count cycle. yUses a multiplexor to provide multiple inputs to Port C.
ADP Primary Functions Polling - Standard way of communication between PC and Microcontrollers. Commands and status updates are sent each polling cycle. Microcontroller sends a fixed state each time it is polled by the PC. Probing - Every 15 seconds the PC sends a packet with Device ID zero and payload byte also zero. This is identified by the Microcontroller as a probe signal. It then reports back to the PC with a current list of all devices which are currently connected.
ADP - Packet Structure Main Header Device Header Second Device All 8 bit fields beginning with 0 except Address
Bus Master Architecture Serial Handler Serial Handler Bus Master Bus Master Dispatcher Light ADPDevices ADP Bus output timeout control input Input Device Message Input Device Message Input Device Message Input Device Message Input Device Message Java Serial Support Running Thread
Problems Encountered zNoise due to unconnected serial lines was causing corrupt data to appear on the network. The problem was solved by adding resistors to load down open lines. zOn start-up the computer would occasionally find microcontrollers that were not actually present. This problem is corrected by removing devices which timeout over 25 times in ten seconds. zIf a byte was not read properly a microcontroller would stay in a read loop indefinitely. By adding timeouts and transmitting extra zeros this was alleviated. zIt was more time consuming then it should have been to write new device support that was similar to existing devices. The objects and supporting code was rewritten to provide rapid device coding.
Development Cost Analysis Parts for Network Adapter (4) $ ea. Microcontrollers (3) $ ea. Computer (1) $ 2, ea. Labor (5 hrs a day, 5 days a week) Salary ($30 /hr) (x 2.5) (3) $ 7, ea. Grand Total $ 26,540.00