Title: Home Wireless Control
1Home Wireless Control
Project A - 044167
Part A Final Presentation
Students Ehud Ravitz Lee Blum Instructor Konstant
in Sinyuk
2Project Goals
Create a data and control network over household
appliances.
Should be implemented on cheap software.
Should be friendly to both users and application
developers.
Check future interfacing of the System with
external Controllers (iPaq, CAN2USB)
3General Block Design
4Network Structure
- Each household appliance will have an End Point
embedded within it. - In Each room in the house, an Access Point will
control over all the End Points in the room using
a Bluetooth wireless connection. - All the Access Points will communicate with one
another through a wired CAN network.
5Design Tools
- Microchip PIC18F452/8 on PICDEM2 boards.
- MCC18 compiler using MPLab IDE.
- Philips Bluetooth units.
6End Point Design
- A Microchip PIC18F452 controls a Philips
Bluetooth unit using UART. - The application on the PIC controls the
appliance, according to Bluetooth data transfers
with the Access Point.
Household Appliance
PIC18F452
UART
Philips Bluetooth Unit
BT
7End Points could also be
- CAN2USB control over a PC connected to the web
(Control Protocols over the Internet)
- An iPaq unit, setting as a remote control (using
BT)
8Access Point Design
- A Microchip PIC18F458 (with CAN support) controls
a Philips Bluetooth Unit using UART. - Each Access Point, located in a different room of
the house, can communicate with up to seven local
End Points using Bluetooth. - Extra E2PROM memory stores the Access Points
database of local and total End Points
(controlled with I2C). - The PIC uses CAN 2.0B to communicates between
different Access Points, enabling control of an
Access Point on End Points in different rooms.
9Access Point Design
CAN controller
PIC18F458
BT
10Specifications
Microchip PIC18F452/8
DC 40 MHz Operating Frequency
32KBytes Internal Program Mem.
1536 Bytes Data Memory
256 Bytes Data EEPROM Memory
2 18 8 21 Interrupt Sources
A, B, C, D, E I/O Ports
4 Timers
Addressable USART, MSSP ( CAN on 8) MSSP, CAN, Serial Communications
Yes Parallel Communications (PSP)
8 input channels 10-bit Analog-to-Digital Converter
2 0 8 2 Analog Comparators
2 No 8 Yes Analog Comparators VREF Output
Yes Programmable Low Voltage Detect
Yes Programmable Brown-out Reset
2 No 8 Yes CAN Module
75 Instructions Instruction Set
Yes 40-pin PDIP
11Specifications
Phillips Bluetooth Philips Components V1.1
2.4GHz to 2.4835GHz Operating Frequency
Class 2 (0 dBm nominal) Transmit Output Power
Up to 15m (with integral antenna) Operating range
Less than 80dBm _at_ 1E-3 BER Receiver Sensitivity
Embedded software stack supporting an HCI interface Embedded Software
Point to Multipoint (up to 7 slaves) Master/Slave switching supported Network Topology
USB v1.1, UART at up to 921 kbps (low voltage serial interface) Interface
3 to 3.4V (or direct power from USB connection) Power Supply
Idle lt 2mA File transfer 70mA Peak lt 100mA Current consumption
-10 to 55C Operating Temperature
-40 to 85C Storage Temperature
45 x 48 x 7mm Dimensions
12Work Frequencies
- CAN max. freq. is 1Mbps.
- Bluetooth effective freq. is 750KB/sec.
- PIC to BT UART connection is in 115,200 bps.
- PICs effective throughput is 10MIPS.
- Therefore, the CAN connection can support a
system with four Access Points, each one
transferring one End Points data, as expected.
13Systems Advantages
- The Bluetooth Protocol is a standard. Making
generic as possible to produce. Should be
embedded in all household appliances, of all
manufacturers. - Strong enough to handle intended rate of
communications (previous slide), mainly short
data transfers for control functions. - Cheap Hardware.
14Communication Algorithm
- Access Point (AP) is always Master.
- End Points (EP) are always Slaves.
- AP Scans for updated EPs in area every X sec.
- AP Calls EP when found.
- EP stores APs BD Address to know who is his
Master. - EP refuses other APs trying to connect him when
is with a Master. - Packets sent from APs to EPs
- Command
- Inquiry for Data
- Packets sent from EPs to APs
- Data in response to inquiry / command
15Debugging Methods
- The MPLab Debugger, supplied with the PIC
Development Kit.
- The LCD, supplied on the PICDem 2 board, for
faster, easier and specific tests.
16Final System Block Design
- Opaque Background implemented modules
17Part A status
- Modules to control the PIC UART, LCD.
- A Bluetooth module (BT stack on PIC
implementation). - A Server (Access Point) Application.
- A Client (End Point) Application.
181. UART module
- An initialization function.
- Read / Write functions.
- Close UART function (closes UART after waiting
for all data to be sent / received). - An interrupt service routine to control the UART
module. - This module was compiled to be a standard EUART
library.
192. LCD module
- An initialization function.
- Functions to write Strings and Constants to the
LCD screen. - This module was compiled to be a standard LCD
library.
203.1. Bluetooth module HCI Layer
- An Initialization function.
- Bluetooth stack commands functions
- Reset
- Write Scan Enable
- Accept Connection Request
- Disconnect
- Inquiry
- Create Connection.
213.1. Bluetooth module HCI Layer Cont.
- A Get Event Routine to handle incoming events
- Reset complete
- Read buffer size complete
- Write scan enable complete
- Accept connection request status
- Disconnect status
- Disconnect complete
- Create connection status
- Connection complete
- Connection request
- Inquiry status
- Inquiry result
- Inquiry complete
- Number of complete packets
223.1. Bluetooth module HCI Layer Cont.
- Error Handling
- Recognizing errors and sending appropriate return
values - TRANSMIT FREE SPACE ERROR
- RECEIVE FREE SPACE ERROR
- CMD BUFFER ERROR
- DATA PACKET BUFFER ERROR
- VOICE PACKET BUFFER ERROR
- DATA PACKET SIZE ERROR
- VOICE PACKET SIZE ERROR
- UNKNOWN COMMAND STATUS EVENT ERROR
- SUCCESS
233.2. Bluetooth module Functional API Sublayer
- Init
- Search (Inquiry)
- Connect / Accept Connection
- Send / Receive Data
- Disconnect
- This module will be implemented in Part B
244. The Applications
- EP and AP demo apps to show BT stack layer
functionalities - AP functionality
- Inquiry
- Create connection
- Select Desired Data using LCD and Buttons
- Send data
- Terminate Connection
- EP functionality
- Write Scan Enable
- Accepts Connection
- Receives Data
- Shows Data on LCD
25Module dependency diagram (Current State)
End Points also handle input from the
appliance. In part B, the main module in Access
Points will handle input/output from CAN module
routines as well.
26DEMONSTRATION
27Difficulties we have encountered
- The PIC has many limitations
- One process only.
- Very small RAM (1.5K).
- Using ROM as RAM not possible (mcc18).
- 10Mhz effective CPU freq.
- Only 32K ROM to store program.
- Still, need to handle high frequency data
transfers. - For all of the above reasons, conversion from PC
and iPaq projects was not in question. All had to
be written from scratch. - Moreover, no PIC modules were available for UART
and LCD, and had to be developed.
28Solutions we came up with
- The emphasis when writing the code was on smart
and efficient code (space and time). - Thus, the current apps take only 12.5K of the 32K
program memory. - Thus enough space left for the CAN module (15K).
- All the UART code, and thus the BT events, is
interrupt driven. - Façade of C routines for LCD Assembly code.
29Final System Block Design
- Opaque Background implemented modules
30CAN issues
- There are two alternatives
- DeviceNet module available from Microchip
- CANopen module by Konstantin Sinyuk
- We will probably develop with the DeviceNet
module since it doesnt have the extra features
of the CANopen, that we do not need for HWC.
31Time Table
- 01/12/03 - BT Functional API Sublayer
- 15/12/03 - I²C module
- 01/02/04 CAN-LOW CANopen or DeviceNet module
- 01/03/04 HWC Scheduler module
- 15/03/04 - AP / EP apps
- April 2004 - Presentation Book
- Army Service July 2004
32To be continued