home wireless control students ehud ravitz lee blum instructor konstantin sinyuk part b final...
Post on 19-Dec-2015
217 views
TRANSCRIPT
Home Wireless ControlHome Wireless Control
StudentsEhud RavitzLee Blum
InstructorKonstantin Sinyuk
Part B Final Presentation
Project B - 044169Project B - 044169
Project GoalsProject Goals
• Create a data and control wireless network over household appliances.
• Should be implemented on cheap hardware.
• Should be friendly to both users and application developers.
Web
iPaq
General Block DesignGeneral Block Design
Access PointAccess Point
End PointEnd Point
LegendLegend:: CANCAN
BTBT
Network StructureNetwork 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 using a wired CAN network.
HouseholdAppliance
End Point DesignEnd 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.
UART
PIC18F452
Philips Bluetooth
Unit
BT
Access Point DesignAccess Point Design
Access Point
CANComm.
to other APs
CANComm.
to other APs
CAN controller
EndPoint
EndPoint
UART
BT
Philips BT Unit
PIC18F458
• Microchip PIC18F458 controller.
• Up to 127 Aps connected using CAN2.0A (CANopen)
• APs in rooms communicate with up to 128 End Points.
SpecificationsSpecificationsMicrochip PIC18F452/8Microchip PIC18F452/8
Operating Frequency
40 MHz
Program Memory(ROM)
32KBytes
Data Memory (RAM)1536 Bytes
USARTYes
CAN2: No ; 8: Yes
Phillips BluetoothPhillips Bluetooth
Frequency2.4GHz to 2.4835GHz
RangeUp to 15m (integral antenna)
Embedded Software
HCI interface Stack
Network Topology
Point to Multipoint (up to 7 slaves)
Power Supply3 to 3.4V (or from USB)
Dimensions45 x 48 x 7mm
Pic18fxx8 - Can ModuleCan Module
Implementation of the CAN protocol CAN 1.2, CAN 2.0A and CAN 2.0B
0 - 8 bytes data length
Programmable bit rate up to 1 Mbit/sec
Low power SLEEP mode
• CAN max. freq. is 1Mbps.
• Bluetooth effective freq. is 750KB/sec.
• PIC to BT UART connection is in 115,200 bps.
• PIC’s effective throughput is 10MIPS.
Work FrequenciesWork Frequencies
System’s AdvantagesSystem’s Advantages
• CAN and BT are standards, thus the HWC can be easily accessed from outside.
• Robust enough to handle intended rate of communications, mainly short data transfers for control functions.
• Cheap hardware:– CAN: Telephone wiring– BT: Cheap unit, wireless.
CANopenCANopen
• CANopen is an application layer over the CAN physical layer.
• Transmissions using Object Dictionary.• SDO (Service Data Object) for variable data
transmissions.• PDO (Process Data Object) for real time
transmissions.
CANopen implementationCANopen implementation
• Data Link Layer: CAN2.0A
• Can be easily transformed to CAN2.0B
• Static (and not dynamic) CAN ID allocation to reduce configuration effort.
• SDO was chosen over PDO since the PDO is limited to only 8 byte data transfers.
CANopen CANopen Protocol AdvantagesProtocol Advantages
• Standard
• Up to 127 units connected
• Connection is reliable and in sequence
• Liveliness maintained and failure detected
• Unlimited data messages length
The HWC LayerThe HWC Layer
• To Combine the BT and the CAN we needed to create a higher layer, the HWC Layer.– Controls the hybrid
network structure and maintenance.
– Transparently routes messages between the different networks.
HWC ProtocolHWC Protocol
• ConnectUpdate: Informs all EPs the BD address and HWC handle of the new EP.
• DisconnectUpdate: Informs all EPs a connected EP has disconnected.
• Data: Transfers Data from anyone to anyone. Data length limited to 119 bytes.
HWC protocolHWC handle
01234567891011121314151617181920212223
• The HWC handle include the following data:– 0-11: BT handle, 12 bits– 16-22: CAN id, 7 bits– 12-15+23: Class number, 5 bits
• AP handle includes its CAN id and zeros as the BT handler.
• EP handle includes the CAN id of the AP to which it connected and the BT handle that the AP received when it connected to it.
• The class number is saved for multicast usage.
HWC protocolHWC Packet header
012345678
• The HWC packet header include the following data:– 0-2: From, HWC handle, 3 bytes– 3-5: To, HWC handle, 3 bytes– 6: OpCode, 1 byte– 7-8: Data length, 2 bytes
• OpCodes:– 7 - ConnectUpdate– 8 - DisconnectUpdate– 9 - Data
MemoryMemoryModuleModule
BT base BT base ModuleModule
Control the BT unitControl the BT unit
BluetoothBluetoothModuleModule
Manage the Bluetooth Manage the Bluetooth protocolprotocol
Interrupt-DrivenInterrupt-Driven
Module dependency diagram Module dependency diagram (AP)(AP)
CAN base CAN base ModuleModule
Control the CAN unitControl the CAN unit
CANOPENCANOPENModuleModule
Manage the CANOPEN Manage the CANOPEN protocolprotocol
Interrupt-DrivenInterrupt-Driven
HWC moduleHWC moduleManage the HWC protocolManage the HWC protocol
Memory moduleMemory module
• Memory allocation
• Shared between the different modules.
• 50 memory packets (12 bytes) in RAM.
• Managed by special FIFOs.
CAN base moduleCAN base module• Gets CAN receive buffers
interrupts and place data in CAN FIFO.
• Send CAN messages by placing in CAN buffers.
• If busy, puts message in CAN FIFO, and transmit on first interrupt.
CANopen moduleCANopen module• Checks for received CAN packets in a CANopen FIFO.• Implements the following CANOPEN layers:
– NMT – Network ManagemenT• Emergency.• Node/Life Guarding.
– SDO – Service Data Object• HWC Index 2240 / 1
BT Base moduleBT Base module
• Checks for interrupts in the UART receive register.
• When has full BT packet, places it in the BT HCI FIFO.
• On interrupt transmits 1 byte from UART FIFO.
BLUETOOTH HCI moduleBLUETOOTH HCI module• Gets received BT packets from
BT HCI FIFO.• Implements The HCI layer to
control the BLUETOOTH protocol.• Notify the HWC on any new
connection or disconnection.• Transfer to the HWC all the data
from the data packets received.
HWC moduleHWC module
• Connected to CAN and BT modules (FIFOs).• Updates any new connection or
disconnection in the HWC protocol.• Routes received HWC packets to the
designated destination.
Design ToolsDesign Tools
• Microchip PIC18F452/8 on PICDEM2 boards
• MCC18 compiler using MPLab IDE
• Philips Bluetooth units• CAN2USB
Old Debugging MethodsOld Debugging Methods
• MPLab Debugger: not reliable
• LCD module: Too big
• 3 of the 4 LEDs were blocked by CAN ports.
New Debugging MethodsNew Debugging Methods
• Accessing Assembly code, PIC registers down to hardware level.
• We have developed both CAN and BT simulators in MSDEV6.
• One LED as a blinker to present data.
PIC18F DifficultiesPIC18F Difficulties
• We reached almost all We reached almost all limitations of the PIC:limitations of the PIC:– Used all RAM (1.5k/1.5k)Used all RAM (1.5k/1.5k)– Used 80% of ROM (26K/32K). Used 80% of ROM (26K/32K). – Program calls and interrupts Program calls and interrupts
increased while limited to max 31 in increased while limited to max 31 in the return address stack.the return address stack.
– More interrupts and long interrupt More interrupts and long interrupt run time may cause loss of run time may cause loss of interrupts on big, busy networks.interrupts on big, busy networks.
MCC18 DifficultiesMCC18 Difficulties
• Most MCC18 libraries are Most MCC18 libraries are problematic and complicated to problematic and complicated to work with.work with.
• MCC18 initialization is limited MCC18 initialization is limited and cannot be trusted to initiate and cannot be trusted to initiate the static memory.the static memory.
• MCC18 has some bugs, especially MCC18 has some bugs, especially in the optimizations it makes.in the optimizations it makes.
DEMONSTRATIONDEMONSTRATION
SummarySummary
• The HWC project was much harder than anticipated, even after finishing part I. Although we had to work on it about 30 hours a week during a year and a half we are glad we’ve chosen this project.
• We learned a lot more than just the CAN and BT protocols. We learned how to work with a very limited hardware and how to find advanced solutions to problems we thought “can not be solved”.
Thank youThank you