Home

Final Report - Electrical and Computer Engineering

image

Contents

1. Alarm delay 2500 process response temp devices i PROCESS CIRCUIT ID Alarm delay 1500 lcd clear lcd println temp devices i gt name led print Assigned CID lcd print temp devices i circuit id Alarm delay 2000 add device temp devices i 39 void add device TYPE device dev 1 int circuit 0 if dev gt circuit id NULL circuit dev gt circuit id if dev gt name 0 C dev gt name 0 c if dev gt name 1 U dev gt name 1 u if dev gt name 2 R dev gt name 2 r Alarm delay 1000 lcd clear lcd print Adding current to lcd print circuit Alarm delay 2000 if current tails circuit NULL 4 current heads circuit dev current tails circuit dev current tails circuit gt prev NULL else current tails circuit gt prev dev current tails circuit dev current tails circuit gt prev NULL else 40 Alarm delay 1000 lcd clear lcd print circuit Alarm delay 2000 if relay tai relay heads relay tails relay tails else circuit circuit Is circuit lcd print Adding relay to NULL 4 de de Vi Vi circuit gt prev NULL relay tails circuit gt prev dev rela
2. Karl Fort Danish Qureshi Tom Nute Steve Smith Table of Contents Executive Summary ge cnd aa a a a ue ea le e a a i 1 PP ina a EE 2 MSU ST EE dal pa nisi iat ala dem i iati 3 ET POP Cr ciuna A e tn a n a i 3 Jr ie iai ta aaa ia a il a at aia 6 tea orra ECE sr ct nm li ta an i OO 7 CUTE ME SOS e ee i dt aaa deag ll 8 Kel d i la i mm 8 Current Sen 8 gg code nai tanc Dai apa ui pl AB dit 10 Threshold Detector eure j ne gen trai dai aia a a a n a ies 11 lee NT 13 POWER Supplies e 14 Losie Level c CE 14 A A 15 Basic Operation Theoretical Desen see sese eee 16 Basic Operation Arduino Implementation s sseesseeeeeseeesessessrseresressrssrssressersresreesesee 17 Integrating the XBee Radios Networktng Woo WWW 18 Integrating the XBee Radios Signalling WWW 19 Integrating the XBee Radios Receiving Priority Signals oooooooo 20 Advanced Operation Multiple Circuits o oom WWW 20 Recommendations and Future Enhancements oo Woo 22 Final Product ice ca a ta il diva le dia i i all a 23 Market Analysis ase p cat da e i 24 ODEN toa ag al un a anl at ac pal n iaca ia 24 eege 26 WC eeneg besteed ei Eegen 27 Appendix B E 29 LIST OF TABLES AND FIGURES Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 F
3. 0x05 Size LSB frame 3 0x08 AP D 0x01 Frame ID frame 4 frame 5 D Command D3 37 frame 6 pin frame 7 msg POWER ON or POWER OFF frame 8 calculate checksum frame 3 8 Serial write frame 9 else uint8 t frame 20 frame 0 Ox7E Frame Delimiter frame 1 0x00 Frame size MSB frame 2 0x10 Frame size LSB frame 3 0x17 AP dentifier frame 4 0x01 Frame ID frame 5 dev gt address high value 0 frame 6 dev gt address high value 1 frame 7 dev gt address high value 2 frame 8 dev gt address high value 3 frame 9 dev gt address low value 0 frame 10 dev gt address low value 1 frame 11 dev gt address low value 2 frame 12 dev gt address low value 3 frame 13 OxFF to ignore 16 bit mode frame 14 OxFE frame 15 0x02 Execute immediately frame 16 D Command D3 digital IO pin 3 frame 17 pin 38 frame 18 msg 0x05 high 0x04 low rame 19 calculate checksum frame 3 19 Serial write frame 20 Alarm delay 2000 process response NULL 0 void assign circuits int i 4 query circuit temp devices i Alarm delay 2500 process response temp devices i PROCESS CIRCUIT ID
4. buffer 21 u if buffer 22 R buffer 22 r cur sensor 1 num cur else temp device name 0 R temp device name 1 E temp device gt name 2 L temp device name 3 0 temp devices num devices temp device num devices Alarm delay 2000 Serial print ATCN r Alarm delay 2000 for int y 0 y lt Serial available y Serial read 46 Read Reply Used only for Node Discovery ND is performed in AT command mode and the reply S must be read in one char at a time x gi int readReply int max returns char c unsigned long time unsigned long start millis int i 0 int num returns 0 memset buffer N0 32 while true if Serial available c Serial read if e Net I num returns 1 if num returns gt max returns i 0 1 return i 47 else num returns 0 buffer i c else time millis if time start gt 10000 lcd print No reply return 0 Timer ISR The controller uses a time share based schedule giving each of the devices even amounts of time The ISR is called when the time interval has elapsed The device currently on is given a powerOFF signal and the next device is given powerON This ISR also takes care of removing the devi
5. 2 T n ALA Pin 10 le Figure 2 Pin layout of XBee HKN For or at RT 7 nl mme wm UART Daan 4 pe ou Duk RESET pat Mese Resa sel pulse must e ai ast 20075 PWMO RSSI Output PWM Output 0 RX Signal Strength Indicator Pi Dei SECH DTR SLEEP_RQ DIB Input Pin Sleep Control Line or Digital Input 8 E Either Iw w A GND Ground ADA DIO4 Analog Input 4 or Digital UO 4 Clear to Send Flow Control or Digital I O 7 og od Modul Stats Indico MRE Input Voltage Reference for A D Inputs Associated Indicator Analog Input 5 or Digital I O 5 Request to Send Flow Control Analog Input 6 or Digital I O 6 Analog Input 3 or Digital I O 3 Analog Input 2 or Digital VO 2 Table 2 Pin assignment for XBee Pro Either Lar Ea KS HN 10 EM NEM EUM Km ja 45 EM T 10 12 13 14 15 16 17 18 While programmed pins 1 10 interface with the computer pin 11 is used in detecting the input from the current sensor in the priority device independent of the computer and pin 4 outputs the signal that switches the relay controlled by each secondary unit The XBee modems use the 802 14 4 Protocol on a 2 4 GHz broadcast frequency and have a range of 30 metres indoors In order for the coordinator to distinguish between individual secondary units each unit is assigned a unique 64 bit ID or address Relays Relays were chosen based primari
6. and could be used for our application The graph below shows the behavior for the comparator inputs and output 12 HI Bp fe o gt Figure 12 Graph showing change in Voltage vs Time Combining Once all three parts were put together and tested separately they were combined on one breadboard Care was taken to transfer every component from each separate part and the connections were repeatedly checked for accuracy The following diagram shows the complete schematic for the current sensing circuit 1N914B Vo Figure 10 Schematic for the Complete Current Sensing Circuit Terminals Al and A2 were connected in series with the hairdryer The potentiometer was set such that the non inverting input to the comparator was 2 1V The hairdryer was set to different speed settings The voltmeter was used to take the voltage reading for both the inverting input of the comparator and ouput voltage are Tigure 5 13 Load Vininverting VO V V None 183 33 Low 1 99 3 3 High 2 66 0 Figure 11 DC Input and Output Voltages of Current Sensing Circuit It can be observed from the table that the circuit outputs 3 3V when there the hairdryer is OFF or at LOW speed However when the hairdryer is turned to HIGH speed the circuit outputs OV The output of this circuit V can thus be used as an input for pin 4 of XBEE When the appliance connected in series with terminals Al and A2 is consuming low power there would not be any cha
7. circuit If manual circuit is not on Turn off device currently on for circuit Turn on next device for circuit Initially this process seemed perfectly fine With some initial testing however one flaw was discovered Depending on when the priority device was turned on and for how long the automatic device that was interrupted may end up receiving very little on time 20 Because all the circuits were serviced by a single alarm if the priority device came on shortly after an alarm and then went off shortly before the next one the automatic device on that circuit would get swapped only having received a short amount of time The main consideration when thinking about whether this was a problem that needed fixing was the fact that the current implementation of the system had no way of getting feedback from automatic devices such as temperature although this is certainly a possible future enhancement The standard use case for the system uses heaters for automatic devices Not giving each heater the right amount of time would likely result in temperature issues Without a feedback it was decided that it was important each device receive the specified amount of time To solve this issue there were two possible solutions After returning from being interrupted by a priority device the disabled automatic device would have its time on reset to the original amount The other choice was the give the automatic device the time remaining of its total whe
8. frame 17 S frame 18 0x01 frame 19 Serial write frame Alarm delay 5000 NN 20 calculate checksum frame 3 19 process response dev PROC void node discover ESS CIRCUIT ID Register a device that is the local device CH TYPE device local temp device CH TYPE device malloc sizeof TYPE device Lg local temp device gt isLocal local temp devic local temp devic local temp devic local temp devic temp devices 0 num devices 1 gt name 0 gt name 1 gt name 2 gt name 3 local temp Serial print readReply 1 Alarm delay 1000 local temp device gt circuit id 0 LNG device 43 Serial print ATND r int r 1 int cur_sensor 0 while r gt 0 cur sensor 0 Alarm delay 5000 r readReply 2 LE MESOJ break CH TYPE device temp devic CH TYPE device malloc sizeof TYPE device temp device source 0 temp device gt source 1 temp device gt source 2 temp device gt source 3 convert temp device gt sourc temp device gt address h temp device gt address h temp device gt address h temp device gt address h temp device gt address h temp device gt address h igh igh
9. heads i NULL 4 send signal relay heads i POWER ON DEFAULT RELAY PIN xpectedTime i now TIME INTERVAL 1 else if expectedTime i 0 1 Alarm timerOnce expectedTime i now timer ISR 50 else 1cd print Manual device on Alarm delay 1500 reset the time interval Alarm timerOnce TIME INTERVAL timer ISR void convert char values uint8 t output int length uint8 t bytesread 0 uint8 t tempbyte 0 uint8 t val 0 int i 0 while bytesread lt length val values i if val lt 9 val val 0 else val 10 val A if bytesread amp 1 1 output bytesread gt gt 1 val tempbyte lt lt 4 else tempbyte val bytesread uint8 t calculate checksum uint8 t frame int start int finish int sum 0 for int i start i lt finish i sum sum framelil sum amp OxFF Sum sum OxFF sum return uint8 t sum TYPE device process response TYPE device dev int toProcess Rx64loSampleResponse ioSample Rx64IoSampleResponse 52 xbee readPacket lcd clear Alarm delay 1500 lcd print Packet Read Alarm delay 1500 lcd clear if xbee getResponse isAvailable if xbee getResponse getApild RX 64 IO RESPONSE
10. however this was much more difficult For whatever reason the data the Arduino was receiving never matched up to the template provided in the user manual After much frustration and work it was discovered that a library for the XBee API was available through the Arduino community This library provided a simple interface for extracting data from sample signals With the use of the library it became trivial for the Arduino to know when the priority device was turned on and turned off Advanced Operation Multiple Circuits Late in the project it was decided that the system should be able to coordinate multiple circuits with a single controller system Basically the idea was to allow a single automatic device to be on per circuit Each circuit could have a manual device which while on would disable the automatic devices on the same circuit only This alteration to the system specifications required changes some trivial and some more difficult ones The first thing to change was the Switch Devices state in the earlier design Originally the system simply turned off the device currently on and then powered on the device next in the list To accommodate multiple circuits this on off switch simply needs to be executed multiple times once for each circuit For each circuit the routine must also check whether or not the priority device associated with that circuit is on or off This simple routine is given in pseudo code below For each
11. low address low gt address low value 2 address low address low address low address low gt address low value 3 Alarm delay 3000 ss low value 0 8 55 lcd clear lcd print response low lcd setCursor 0 1 lcd print address low if address low response low if sample 4 0x00 Device ON current on circuit id check else Device OFF current on circuit id NULL return check else check check gt prev else lcd clear if xbee getResponse getApild REMOTE AT COMMAND RESPONSE I RemoteAtCommandResponse RATCR RemoteAtCommandResponse xbee getResponse getRemoteAtCommandResponse RATCR 56 if RATCR isOk I if RATCR getValueLength gt if toProcess PROC uint8 t val 0 t ESS C RCU RATCR getValue RATCR getValueLength 1 val val 0x07 int circuit_id switch val case 0x07 circuit_id break case 0x06 circuit_id break case 0x05 circuit id break case 0x04 circuit id break case 0x03 circuit id break case 0x02 circuit id 0 break 57 case 0x01 circuit id 1 break case 0x00 circuit id 0 break default circuit id 0 break if toProcess PROCESS CIRCUIT ID 1 dev gt circuit_id circuit id retur
12. operation of an appliance attached to this module causes all the other modules to switch off their attached appliance This module incorporates a current sensor for sensing the on state of an attached appliance The prototype worked according to specifications but more refinement and development is necessary to achieve a marketable product The cost to build this prototype was only 100 compared to the cost of rewiring a house which on average is more than 6 000 Using Happy Plug therefore is a very cost effective alternative to rewiring a home if there are issues with breakers tripping due to overloaded circuits Introduction Currently houses are built with several different circuits to run various high powered appliances Each of these circuits has a dedicated circuit breaker that protects against current overload When the current or load in the circuit exceeds a certain maximum typically 15 Amps the circuit breaker or circuit switch will trip or turn off the current automatically to protect wires from overheating and potentially causing a fire In houses built say 50 or more years ago typical circuit layouts were not designed to accommodate many of the high powered appliances used today Therefore the number of different circuits included in a single unit was much less than houses built today Asa result lights a heater a microwave and a clothes iron may all be powered by the same circuit If these appliances are used all at once
13. order to produce a DC output the AC output from the current sensor needed to be rectified Rectifier The rectifier circuit was needed to convert the AC output from the current sensor to DC As the application did not require a strict DC rectification a basic half wave rectifier was designed The figure below shows the schematic for the circuit D1 B1 10 kQ 10 KQ B2 2 2yF 10 kO Figure 7 Schematic for Rectifier 10 The AC voltage is applied at the terminal B1 and the rectified DC output is obtained at the terminal B2 In order to test the circuit the output terminal V out from the current sensor was connected to the terminal B1 of the rectifier circuit The hairdryer was plugged in and the output at terminal B2 was observed using a multimeter by toggling the hairdryer between OFF LOW and HIGH settings The following observations were recorded in Table 4 below Vout DC Load V Noe 1830 Low 1 999 High 2 660 Table 4 DC Output Voltage of Rectifier The results obtained showed that increasing the speed or load caused an increase in the DC voltage output of the circuit The circuit was thus outputting a linear increase in voltage with increasing input current The next step was to design a threshold detector circuit which would change states when the rectified voltage passes a reference voltage Threshold Detector Circuit A Threshold detector circuit is a simple voltage switch It compares two voltages and switches the out
14. the correct polarity being used according to signal direction and protection requirements With this method if wires are plugged in incorrectly a very real possibility when dealing with circuits on a breadboard the XBee radios would be rendered useless The circuit shown in Figure 12 acts as a bi directional level converter seamlessly allowing the Arduino s 5V serial transmit and receive pins to be connected to the XBee s corresponding 3 3V i oe Figure 13 Bidirectional logic level converter receive and transmit pins The circuit works using a pull up resistor on each side of a MOSFET The MOSFET s inherent body diode prevents the higher 5V voltage from appearing on the 3 3V side while the MOSFET itself allows current to be sunk when either side is pulled low bringing the opposite side low For our purposes a simple circuit consisting of two of these modules was created on a piece of veroboard using surface mount components to reduce size and cost The circuit worked exactly as planned allowing seamless communication between the XBee and Arduino while preventing costly hardware failure Software When approaching the code the main objective was to create a system that could periodically turn devices on and off as well as receive aperiodic messages from a priority device Once a satisfactory system was developed capable of these two processes the system needed to be extended to perform the communication via external components Thi
15. the risk of exceeding the load capacity of that circuit becomes significant As a cost effective alternative to rewiring such a house our group designed a power management device that wirelessly controls the number of appliances connected to a particular circuit at any one time thus maintaining the load on that circuit below acceptable limits and avoiding the inconvenience of a tripped breaker This solution was accomplished in two stages A basic system consisting of master and slave units was constructed Once it was working the design was modified to incorporate added features and autonomy The slave functioned as a remotely controlled switch that turned an attached appliance on or off and the master incorporated a control schedule that evaluated and decided which appliances would be turned on or off based on circuit loads and need to use criteria The report discusses the major components of the device in separate sections Radios Relays Micro Controller Current Sensor Power Supplies and Software then it address the device as a complete and functional entity Discussion Radios A major feature of the Happy Plug is that it manages electrical outlets wirelessly Even though there are many options to achieve wireless communication XBee Pro Series 1 radios were used This choice was based on the fact that XBee Modems are relatively inexpensive simple to use low power and are very popular among hobbyists who generally provide eas
16. Function mainLoop For each circuit set first device s expectedExpiry to time interval now create Alarm for time interval given Function priorityDeviceON power off device on this circuit 21 remember how much time the device had remaining Function priorityDeviceOFF power on device on this circuit retrieve how much time the device had remaining set expectedExpire to remaining now create Alarm for time remaining for device Function AlarmExpiry For each circuit If manual circuit is not on If current device s expectedExpiry before now Turn off device currently on for circuit Turn on next device for circuit Set device e expectedExpiry to interval now End For Create Alarm for time interval only if ANY device was swapped The first thing that needed to be added was the variable expectedExpiry one for each circuit This is the time that the device will need to be swapped It is an absolute time as opposed to an interval and is created initially by adding the time interval to the current time returned by now function Initially all the circuits will be serviced by a single Alarm that is scheduled to go off after the time interval The circuits will continue to be serviced by a single alarm until one is interrupted by a priority device After the interruption ends a new Alarm is created to go off after the time remaining for the automatic device on the given circuit In this way the additional overhead of multipl
17. I Detail amp name 2N2222AUA ND http search digikey com seripts DkSearch dksus dlI Detail amp name MCP1700T3302ETTTR ND http search digikey com scripts DkSearch dksus dll Detail amp name 738W X2 02 ND Power Supply po 000 PCB Total A O AAA Sensor Unit Total Z Notes Quantity Total y Notes in Partii r Manufadurer v Supplier IX Supplier Partii v price Iv Digi Maxstream Digi Key XB24 ACI 001 ND 20 91 1 20 91 http www sparkfun com commerce product info php products id 8664 Current Sensor ACS712ELCTR 20A T Allegro Microsystems Digi Key 620 1190 2 ND 1 82 1 search digikey com scripts DkSearch dksus dll Detail amp name 620 1190 2 ND 3 3V SMD Voltage Regulator MCP1700T 3302E TT Microchip Technology Digi Key MCP1700T3302ETTTR ND 0 31 1 search digikey com scripts DkSearch dksus dlI Detail amp name MCP1700T3302ETTTR ND Outlet NEMA 5 15R 738W X2 02 Qualtek Digi Key 738W X2 02 ND 0 44 1 search digikey com scripts DkSearch dksus dll Detail amp name 738W X2 02 ND Comparator AP331AWRG 7 Diodes Inc Digi Key AP331AWRGDITR ND 0 13 il search digikey com scripts DkSearch dksus dll Detail amp name AP33 1AWRGDITR ND PCB Enclosure Total 28 Appendix B Control Program struct TYPE device int isLocal int circuit id char address low 8 uint8 t address low value 4 char
18. MSB LSB API specific Structure 1 Byte API Identifier Identifier specific Data 0x17 cmdData Ni N Figure 16 XBee AT Command Request Frame layout It turned out that the creation and sending of these frames was relatively straight forward At this point the only use for the remote command request was to execute a digital output command The Arduino simply needed to specify which pin ranging from 0 4 and whether the change should be too high or low Sending the frame merely consisted of writing the byte array to the serial port connected to the local XBee With a simple function to create and send these frames the Arduino was able to remotely signal other XBees to set a pin which we had connected to a relay high or low essentially allowing the Arduino to turn on and off an outlet remotely 19 Integrating the XBee Radios Receiving Priority Signals The XBee connected to the priority device had been setup to automatically send out a signal to the coordinator XBee the local XBee connected to the Arduino whenever one of its digital input pins changed The signal it sent was a standard sample signal These samples that the XBees are able to send consist of a value for all pins configured as inputs along with some metadata It was expected that the Arduino would simply receive a sample via the local XBee and read the specific byte related to digital pin 3 the pin on the radios we had connected to the priority device In practice
19. UT void loop I Alarm delay 0 CIRCU TS i NULL NULL NULL ULL L 0 Tred print Startupssx Alarm delay 8000 node discover lcd clear NULL lcd print Turning off ALL 33 for H int x 0 x lt num devices x temp devices x gt nam Alarm delay 2000 lcd clear Lcd print Off to Y lcd print x 0 send signal temp devices x Alarm delay 1500 assign circuits 0 Alarm delay 1500 assign circuits 1 Alarm delay 1500 assign circuits 2 ted Ted Let lcd tedi lcd clear 7 pri pri pri pri pri t num devices E PONI tln devices registered t with t num cur E cur devs P ER OFF D EFAULT R ELAY PI N 34 Alarm delay 2000 led elear for int i 0 i MAX CIRCUITS i if relay heads i NULL 4 lcd clear lcd print Turning on lcd print i Alarm delay 2000 send signal relay heads i POWER ON DEFAULT RELAY PI relay on i relay heads i xpectedTime i now TIME INTERVAL 1 Alarm timerOnce TIME INTERVAL timer ISR for int y 0 y lt Serial available y Serial r
20. University of Victoria Department of Electrical and Computer Engineering CENG ELEC SENG 499 MAY AUGUST 2010 Final Report Project Number 02 Project Title SNA2 Wireless Distribution of Electric Loads Date 30 July 2010 Submitted To Dr Subhasis Nandi Names Karl Fort V00243637 kfort Quvic ca Danish Qureshi V00174865 danishr uvic ca Tom Nute V00219861 tomnute Quvic ca Steve Smith V00215982 smiths uvic ca Dr Subhasis Nandi Associate Professor Electrical and Computer Engineering University of Victoria P O Box 1700 Victoria B C V8W 2Y2 July 30 2010 Dear Dr Nandi Please accept the accompanying report entitled Wireless Distribution of Electric Loads submitted as a required component of the ELEC SENG 499 course for May August 2010 This report results from the design project completed during term where our group developed and built a device that wirelessly managed the load on an electrical circuit We were engaged in the various steps of converting a concept to functional product This report provides details of how that task was accomplished This course gave us an opportunity to apply technical knowledge develop team building skills and cultivate a sense of the economic justification involved in realizing an engineered product We would like to thank you for your proposal that was the basis of our project and for your patience and commitment in supervising us Sincerely
21. address high 8 uint8 t address high value 4 char source 4 uint8 t source value 2 char signalStrength 2 uint8 t signalStrength value char name 4 struct TYPE device prev y struct queue list ti int size struct TYPE device head struct TYPE device tail queue list t next 29 Copyright 2010 Thomas Nute All rights reserved This software makes use of XBee Arduino Copyright 2009 Andrew Rapp under the GNU General Public License tinclude tinclude tinclude tinclude tinclude tinclude define lt LiquidCrystal h gt lt String h gt device h lt Time h gt lt TimeAlarms h gt lt XBee h gt MAX C RCUITS 8 define MAX D EVICES 8 define READREPLY TIMEOUT 9000 define NTERVAL 30 Amount of time a device gets in define DELAY ONOFF 1500 Delay between powerOFF and poveroN R in MILLISECONDS 30 define PONI E R OFF define POWER ON define DEFAULT RELAY PIN define PIN 3 define PIN 4 define PROCESS CIRCUIT ID 0x04 0x05 210 define PROCESS MANUAL SIGNAL 211 TYP TYPI TYPI B TYP LYP TY PI I TYPI int T G B e G Global Variable d
22. and consumer friendly manner possible By using plug and play units that perform unique functions there is almost zero 24 programming required by the end user other than plugging in their devices and setting the circuit number switch The use of Digi s XBee radio units based on the IEEE 802 15 standard allows the devices to form their own wireless network with a range that should be large enough for any home By using three different units Coordinator Secondary and Priority Sensor hardware costs are minimized as each unit only contains the hardware required to do its job The coordinator contains an XBee radio microcontroller relay and power supply that allow 1t to manage all of the other devices in the system Its job is to keep a schedule based on the other units in the system as well as turn on and off its own relay The secondary devices simply turn on and off their relay according to instructions from the coordinator The priority device is for the situation when a consumer wants to use an appliance at the same time as another less important device is running Using a Hall Effect current sensor to detect the operation of whatever is plugged into it the priority sensor simply sends out a signal for other units on the same circuit to turn off The priority sensor does not contain a relay and thus is incapable of switching local loads The prototype presented in this report serves as an excellent demonstration that the concept works and i
23. arch digikey com scripts DkSearch dksus dll Detail amp name 541 10KJTR ND TT Electronics Digi Key 2N2222AUA ND http search digikey com scripts DkSearch dksus dll Detail amp name 2N2222AUA ND 3 3V SMD Voltage Regulator CP1700T 3302E TT http search digikey com scripts DkSearch dksus dlI Detail amp name MCP1700T3302ETTTR ND Outlet NEMA 5 15R 738W X2 02 Digi Key 738W X2 02 ND i y digikey i dil Detail amp namez738W X2 02 ND CAP CER 1 0UF 6 3V 1096 GRM155R60J105KE19D Murata Digi Key 490 1320 2 ND d p search digikey com scripts DkSearch dksus dll Detail amp name 490 1320 2 ND Power Supply PCB estimate based on 2 x2 i p www goldphoenixpcb biz special price php Enclosure estimate Total Relay Unit Relay SPST NO Sealed 30A T9AS1D12 5 Potter amp Brumfield Digi Key PB1014 ND 3 02 1 3 02 http search digikey com scripts DkSearch dksus dli vendor 0 amp keywords T9AS1D12 5 XBee 1mW Chip Antenna XB24 ACI 001 Digi Maxstream Digi Key XB24 ACI 001 ND 20 91 1 20 91 http www sparkfun com commerce product info php products id 8664 Resistor 1 8K 1 16W 596 SMD CRCW04021K80JNED Vishay Dale Digi Key 541 1 8KJTR ND 0 005 1 0 01 http search digikey com scripts DkSearch dksus dll Detail amp name 541 1 8KJTR ND 2N2222 SMD Transistor 2N2222AUA TT Electronics Digi Key 2N2222AUA ND 0 13 1 0 13 http search digikey com scripts DkSearch dksus dl
24. ce at the head of the queue and moving it to the end x Performs 48 I Power off the device currently on x 2 Move the currently on device from the head of the queue to the rear x 3 Delay for some number of milliseconds x 4 Power on the device at the head of the queue EU 25 Set the new currentlyOn device void timer ISR 4 lcd clear lcd print Entered TimerISR Alarm delay 2000 lcd clear TYPE device temp device for int i 0 i MAX CIRCUITS i if current on i NULL if now gt expectedTime i amp amp expectedTime i 0 if relay heads i relay tails i 4 send signal relay on i POWER OFF DEFAULT RELAY PIN lcd print relay on i gt name lcd printlin OFF Move the head device to the tail temp device relay heads i relay heads i relay heads i gt prev relay tails i gt prev temp device 49 temp device gt prev NULL relay tails i temp device Delay Jg Alarm delay TIME DELAY ONOFF send signal relay heads i POWER ON DEFAULT RELAY PIN lcd setCursor 0 1 led print relay heads i name lcd println ON relay on i relay heads i else lcd print None One device Alarm delay 1500 if relay
25. d Both the switching voltage current issue and the lifetime issue could be eliminated by the use of solid state relays SSRs but prices for these devices are still significantly higher than for mechanical relays at the ratings we require Microcontroller It was clear early on in the project that a microcontroller would be required to get the kind of functionality desired As the brain of the system the micro controller is tasked with knowing at all times what other units are present in a system and building a load sharing schedule based on this information These tasks are not terribly complicated or intensive so standard inexpensive 8 bit microcontrollers were looked at for use in the design Atmel s 8 bit AVR and Microchip s PIC microcontroller were looked at first as they are the most popular choices for high volume low cost embedded systems To further simplify development there are platforms built on these chips that allow them to be easily programmed and interfaced with external devices One option the Basic Stamp is widely used for prototyping as well as hobbyist applications and is based on the PIC microcontroller Similarly the Arduino development platform is based on Atmel s AVR microcontroller Both platforms are available in a variety of forms depending on the end user requirements The Arduino platform was chosen primarily due to its low startup cost and extensive support Due to the popularity and open source nature o
26. e alarms is only added on an as needed basis a separate alarm is only created when a circuit has its first interruption via a priority device At maximum there could be one alarm per circuit Recommendations and Future Enhancements The system implementation uses three distinct methods for communicating with the XBee radios AT Command mode API mode manually and API mode with the Arduino XBee library The first thing to change in future revisions of the system would be to refactor all operations to use the library calls for API mode This will increase the readability of the code both through consistency and the simplicity of library calls while 22 also improving maintainability A possible future enhancement would be a feedback from automatic devices indicating things such as temperature Though primarily a hardware change the software s scheduling would have to change In the current implementation all devices are scheduled in a basic queue The only major alteration would be to allow for a signal indicating a temperature threshold for example to move a given device to the head of the queue possibly interrupting the device currently on The reading of the signal could be done during the polling for priority signals The system could just poll for any message and do different handling based on the type Final Product 11 a Having a prototype that demonstrates ma e how the final product will look and operate was a
27. e the power supply relay microcontroller logic level converter and Xbee needed for the control unit Despite such challenges however the project was a success The system successfully switched secondary devices on a time schedule when the priority device was off and switched off all other devices when the priority device was switched on The system was not tested on a circuit that was likely to become overloaded and trip a breaker but it was able to turn off all appliance within a forty second time limit which is a design constraint based on the time it takes to trip a breaker at 30 Amps Market Analysis The cost to build this prototype was 200 With streamline mass production and economy of scale the end product could sell for less than 50 Similar products exist XBee Smart Plug for example at a cost of 100 It has very similar features and uses Digi s technology A survey of Electricians in Victoria indicated that rewiring a house to add circuits for an 80 year old home on average costs more than 6 000 Victoria has a large number of old houses and rewiring jobs are a common occurrence Conclusion The inconvenience of overloaded household circuits is an issue most people can relate to Up until now the only solution was the costly and often impractical upgrade of existing wiring by a qualified electrician This project is aimed at providing a marketable product that solves the problem in the most inexpensive flexible
28. e time Typically a circuit in a home has a 15 amp capacity If too many appliances are attached to one such circuit the load on the circuit may exceed the current capacity of the circuit causing the breaker to trip Happy Plugs prevents this inconvenience by automatically turning off non essential appliances based on a power sharing regime and using wireless technology The added advantage is that a home owner averts the cost of rewiring a house and saving thousands of dollars The device has six major components Bee radios which provide wireless capability for the various modules to communicate Relays the manual switches that are controlled by the Bee which in turn controls the appliance plugged into the module e A Micro Controller Adriano processing centre for the device A Current Sensor which detects when a priority device is in use Power supplies which convert high voltage source to 5 volts supply for the micro controller and Bee Modems e Software This controls the operation of the Adriano processor The system has multiple modules One functions as a coordinator and contains the Adriano processor an XBee modem and a relay so it also has the same capabilities of switching off an attached appliance The secondary units contain an XBee and a relay and are able to switch an attached appliance on or off All secondary units are controlled by the coordinator One of the secondary units may be a priority unit and the
29. ead while 1 lcd clear Alarm delay 0 TYPE device man NULL man process response man PROCESS MANUAL SIGNAL if man NULL manual device man Servicing a manual device void manual device TYPE device man if current on man gt circuit id NULL lcd clear lcd print Man device went off if relay on man gt circuit id NULL 4 Alarm delay 2000 send signal relay on man gt circuit id POWER ON DEFAULT RELAY PIN xpectedTime man gt circuit id expectedTime man gt circuit id now 1 Alarm timerOnce expectedTime man gt circuit id timer I Alarm delay 2000 process response NULL 0 else if current onlman gt circuit id man SR 36 1cd clear lcd print UH OH else 1cd clear 1cd print Man device on if relay on man gt circuit id NULL send signal relay on man gt circuit_ id POWER OFF DEFAULT RELAY PIN xpectedTime man circuit id expectedTime man gt circuit id now Alarm delay 1500 Send signals to devices CH void send signal TYPE device dev uint8 t msg char pin if dev gt isLocal 1 uint8 t frame 12 frame 0 Ox7E Frame delimiter frame 1 0x00 Size MSB frame 2
30. eclarat ion _device temp devices MAX CIRCUITS MAX D m i device relay tails MAX CIRCUITS G m i device relay heads MAX CIRCUITS _device current heads MAX CIRCUITS m m E G pa G _device current tails MAX CIRCUITS _device current on MAX i device relay on MAX C xpectedTime MAX CIRCU int num devices int num cur CIRCUITS RCUITS T3 I int ISR circuit char buffer 32 Pin Assignments for LCD const int LCD DO pin 2 const int LCD Dl pin 3 const int LCD D2 pin 4 const int LCD D3 pin 5 const int LCD RW pin 6 const int LCD EN pin 7 LiquidCrystal lcd LCD EN pin LCD RW pin LCD D3 pin LCD D2 pin LCD Dl pin LCD DO pin Initialize function void setup I Serial begin 9600 xbee begin 9600 led begin 20 4 setTime 0 0 0 1 1 10 num devices 0 32 num cur 0 for int i 0 i lt MAX relay headslil relay tailslil current heads i current tails i current onlij N relay on i NUL xpectedTime i pinMode 8 OUTPUT pinMode 9 OUTPUT pinMode 10 INPUT pinMode 11 INPUT pinMode 12 INPUT pinMode 13 INP
31. een removed since there is now no need for an interrupt service routine The actions performed in that state were simply moved into the transition between Ready and Disabled The polling for messages is shown has diamond decision branches The Switch Devices state and transitions would be exactly the same 17 Init Timer Alarm Interrupt Ready Yes Switch Devices Disabled lt __ Figure 15 Basic System Design implemented on Arduino Integrating the XBee Radios Networking To incorporate wireless communication the system needed to be connected to XBee radios See the XBee section of the report for more information regarding the radios themselves The XBee radios operate in either AT Command mode or in API mode In both operational modes the XBee and Arduino communicate via the serial channel In AT mode the Arduino sends commands comprised of ASCII encoded characters ie ATND or ATIS The XBee responds with strings of characters in specified formats terminated by multiple carriage returns This is the simplest way to communicate with the radios so the first step was to use this mode to implement the part of the Initialization state that required the system to establish the network Sending the node discovery command ATND from the Arduino to the local XBee local refers to the radio physically connected to the Arduino causes
32. f this platform the hardware itself is readily available in a huge number of configurations For the purpose of this project size and cost were of greatest concern over feature set The version used Arduino Pro Mini 328 vll contains only the microcontroller external clock and reset button on a pcb measuring only 18x32mm To program the microcontroller on a modern computer all that is needed is a serial to usb converter Other versions of the Arduino have this feature built in but do so with an increase in size and cost For the project a single usb to serial converter board made by FTDI was used to program the Arduino as well as the XBee radio units For the Arduino platform software development and chip programming is all done through the free Arduino Integrated Development Environment IDE Programming is covered in detail in a separate section but is done using a modified version of the standard C language All of these benefits made the Arduino an excellent choice to get a prototype running quickly and cheaply to demonstrate to potential investors Although the Arduino platform is great for rapid inexpensive prototyping it is unsuitable for final production designs Size and cost are the main issues when looking at using the Arduino in a commercial product For the final product a custom PCB needs to be designed and the code either translated or rewritten from scratch Basing the final design on the same chip Atmel 8 bit AVR would simplify the
33. for the periodic switching would have been more difficult so an interrupt system would have been required for device switching For readability maintainability and convenience it was decided to keep both operations using similar ideas so interrupts were settled on With the implementation of the operations decided on a basic system design was drawn up As detailed in Figure 14 the system consists of four basic states plus the initialization state All red transitions indicate transitions caused by interrupts The Init state would consist of the setup of all the interrupt service routines ISRs the timer and powering on the starting device The system would spend most of its time in the Sleep state where is simply waits for interrupts The Swap Devices state is simply the periodic timer s ISR In this ISR the signals to power off a device and power on a device would be sent and then control would be returned to the Sleep state The Priority state represents the ISR called from the priority message interrupt This ISR would first power off a device and then put the system in a disabled state Inside the disabled state any timer interrupts would be ignored Once the priority message is received indicating the device is off the ISR would return the system to the Sleep state 16 Interrupt Init Disabled lt Swap ee i gt Devices Slee
34. igh igh igh igh 31 s V t mp devic nor Vy trs buffer buffer buffer buffer gt source value 4 44 temp device gt address high 6 buffer 8 temp device gt address high 7 buffer 9 convert temp device gt address high temp device gt address high value 8 temp device address low 0 buffer 10 temp device address low 1 buffer 11 temp device gt address low 2 buffer 12 temp device gt address low 3 buffer 13 temp device gt address low 4 buffer 14 temp device gt address low 5 buffer 15 temp device gt address low 6 buffer 16 temp device address low 7 buffer 17 convert temp device gt address low temp device gt address low value 8 temp device gt signalStrength 0 buffer 18 temp device gt signalStrength 1 buffer 19 convert temp device gt signalStrength amp temp device gt signalStrength value 2 temp device gt name 0 buffer 20 temp device name 1 buffer 21 temp device gt name 2 buffer 22 temp_device gt name 3 M0 temp device gt isLocal 0 temp device gt circuit id 0 45 temp device gt prev NULL if buffer 20 C buffer 20 c 4 if buffer 21 U
35. igure 19 Network topology of project oooooo W WWW mom ee ven ce enne enses 3 Pin layout ot XBee c ti ders d r cil angan oi anna Ee 4 KOQE e 6 Transistor based relay i nia NAN i eta vendes r r aie dacia Naa 6 Pin Configuration Tor ACS 714 dis s sas s kia aaa aa ae zota aaa Ca eh enis dosido alang 9 Schematic for Current Sensor eiecerunt ne Pekin ar se sdo etic in 9 Scher atic tor Recufiet eret rte t t de Pate rupe dre teh aa Kesan 10 Pin Layouts for the LM 393 Comparator eese 12 Schematic for Threshold Detector Circuit eee 12 Schematic for the Complete Current Sensing Circuit esee 13 DC Input and Output Voltages of Current Sensing Circuit ooo 14 Logic level converter schemapncg sees nene 14 Bidirectional logic level converter 15 Basic System Design eoe a caca ee ERE o Caes ok cel FU TER EI FR a a neve al dit 17 Basic System Design implemented on Arduino eene 18 XBee AT Command Request Frame layout eee 19 schematic of enclosure design irr aaa ana tete ee raras 23 Completed prototype hte derent NE tette ea area Hi ca NN 23 Breadboard View of the Complete Current Sensing Circuit 27 Executive Summary This report details the development and construction of the Happy Plug device Happy Plug manages the electric load on a circuit by controlling the number of appliances that are turned on at any on
36. ily accessible information on how to use and program these devices The XBee Pro Series 1 suited the functional needs of this project well Secondary Coordinator Figure 1 Network topology of project The design of Happy Plugs reguired communication between a coordinator device that controlled the schedule of switching times and secondary devices that were switched in response to the commands from the coordinator see Figure 1 above The coordinator device was attached to an Adruino micro controller the processing centre for the system All commands were issued through the XBee radio attached to it and received by other XBee radios attached to the secondary units one of which was a priority unit that was configured to return a signal from the current sensor attached to it Each secondary unit controlled the appliance plugged into it To achieve the necessary functionality each XBee was configured using the X CTU software running on Windows The parameter setting for the XBee modems are outlined in Table 1 Channel C D Pan ID E499 E499 Destination Address 13A200 13A200 High Destination Address 4049247B 4049248F Low 16 Bit address FEFE FFFE Serial high 13A200 13A200 Serial flow 40640C6D 4069248F Coordinate Enable 0 0 Node ID Yellow Red Table 1 XBee parameter settings using X CTU software Figure 3 shows the pin layout of the XBee and Table 1 gives a description of the various pins Pin 1
37. ly on cost Given that a standard household circuit breaker is rated for 15A and that the purpose of our project is to switch devices that draw almost this amount of current the relays themselves had to be rated similarly This meant handling both soft and hard loads resistive and mixed resistive inductive up to 15A Additionally the relays had to be rated for use on the 120V AC line voltages used in North American household electrical systems In order Figure 3 Relay to market the product internationally this rating must be increased to 240V AC For the prototype a relay rated for 30A resistive load at 240V AC from Tyco s Potter amp Brumfield T9A series was used The T9AS1D12 5 has a minimum coil voltage of SV and pulls approximately 180 mA at this level from our testing This makes direct switching by the Arduino or XBee impossible as the outputs of these devices are rated for less than 25mA The solution to this problem is to use a transistor based relay drive circuit as shown in Figure 4 below Unfortunately these relays are only rated for K1 Taasipi25 100 000 y Operations been corresponding to a CG ADO DI DOUT A D lifetime of only 2 85 years if used to switch a load on and off in 15 ON SLEEP CTS DIO7 AD4 DIO4 GND Figure 4 Transistor based relay minute cycles This could be a major issue and is one that must be worked out before a final product design is reache
38. n dev else if xbee getResponse getApild AT COMMAND RESPONSE AtCommandResponse ATCR AtCommandResponse xbee getResponse L getAtCommandResponse ATCR if ATCR isOk I if ATCR getValueLength gt 0 4 if toProcess PROCESS CIRCUIT ID 1 58 uint8 t val ATCR getValue ATCR getValueLength 1 val val 0x0 switch val case 0x07 dev gt circuit_id 7 break case 0x06 dev gt circuit_id 6 break case 0x05 dev gt circuit id 5 break case 0x04 dev gt circuit id 4 break case 0x03 dev gt circuit id 3 break case 0x02 dev gt circuit id 2 break case 0x01 dev gt circuit id 1 break case 0x00 59 dev gt circuit id 0 break default dev gt circuit id 0 break Alarm delay 2000 return dev else lcd print Expected IO Sample got Fi Ee lcd print xbee getResponse getApild HI Alarm delay 3000 return NULL else if xbee getResponse isError 1 lcd clear lcd print xbee getResponse getErrorCode Alarm delay 3000 return NULL return NULL 60
39. n important part of the 4 project The initial concept of the o project was to have multiple units that would plug directly into standard outlets and that the consumer would plug their device into the bottom of the unit An initial sketch was drawn up and can be seen in the figure on the right Figure 17 Schematic of enclosure design e SME DWG NO REV pep AControl Unit For the demonstration prototype it was impractical to have a custom built unit manufactured to specifications and so alternatives had to be examined Looking at devices on the market that are of a similar form small box male connector on one side female connector on another it was determined that the best solution would be to re purpose the enclosures from one such device Devices such as single outlet surge protectors multi tap outlets X 10 units and digital mechanical outlet timers were Figure 18 Completed prototype 23 researched to find an enclosure that would suit our requirements The use of project boxes from electrical suppliers as well as surface mount outlet boxes was also looked at For the demonstration prototype the GE 15271 mechanical outlet timer was selected Available locally for 15 00 a unit this was one of the most economical options and required the least amount of modification to adapt the enclosure for the project Removing one of the unit s two outlets as well as the mechanical switch assembly left enough room to hous
40. n interrupted The first solution is good in situations where the priority device is on for an amount of time that is relatively large compared to the time an automatic device gets However if priority devices are expected to be on for fairly short periods of time then this poses a problem If the automatic device was on for the majority of its allotted time only to receive another full allotment after being interrupted for a short time you may run into over use issues over heating in the case of heaters The best solution for the system was to give the automatic device the amount of time it had remaining when interrupted So if the device was interrupted 10 minutes into a 30 minute total it would receive 20 minutes after interruption While a good solution to device starvation this idea also introduced another potential problem of its own Devices could no longer be swapped all at the same time as their durations could end at differing times depending on priority device use The initial reaction to this was to have each circuit have its own alarm After some analyzing though this idea adds far more overhead than is necessary At system start up and for some time after all device switching will be performed at the same time Therefore a single alarm can be used up until a priority device is used Afterwards alarms need to be created on the fly This system sounds complicated at first but 1t can easily be described using the pseudo code below
41. nge to the pin 4 of the XBEE However when the appliance connected will start consuming high power the input to pin 4 will change from high to low Power Supplies To provide power for the units AC DC converters were needed From measurements taken the relays draw approximately 180mA at 5V DC the Arduino 80mA and the XBees 60mA for a combined total of 320mA To maintain acceptable efficiency and minimal size for the units it was decided that the best option was to use off the shelf solid state switching power supplies Re purposing discarded cell phone 5V power supplies yielded appropriate parts for all three demonstration units Logic Level Converter The logic level converter is necessary to enable communication between the microcontroller and XBee radio components due to the different signal voltages these component uses The Arduino uses logic signals of SV and OV while the 1 XBees use 3 3V and OV and will suffer permanent Jer damage if 5V 1s applied to al their pins The ideal Figure 12 Logic level converter schematics solution would be to use 3 3V throughout the system but due to time constraints it was better to simply introduce a logic level converter circuit between the XBee and Arduino Level conversion is a common problem in digital systems as more and more chips switch to using 3 3V so there are many documented methods available The use of protective diodes is one of the most common methods but it depends on
42. o our application An average microwave uses 15A current when running This current sensor has a range of magnitude up to 20 A Other advantages for this device included precise low offset and linear functionality and low power loss due to very small 1 2mQ internal resistance Figure 5 Pin Configuration for ACS 714 Figure 5 shows the basic pin configuration for the current sensor This figure was studied and used as the basis for the current sensing circuit Pin 1 and 4 were used to connect the ACS714 IC in series with the power appliance Figure 6 below shows a schematic for the circuit 3 3V C Ei Ground ACS714 Figure 6 Schematic for Current Sensor The power appliance was connected in series with points Al and A2 Output from a power supply set to 3 3V was made to the screw terminals and the output at V out was observed using a multimeter For experimental purposes a hairdryer with 2 speed settings was connected instead of the microwave Tabe 3 below shows the results of the observations Vout AC Load mV None 2 3 Low 220 High 820 Table 3 AC Output Voltage of Current Sensor It was observed that the output at Vout was AC instead of the expected DC This was a problem as a DC output was required for the correct functioning of the circuit Upon troubleshooting it was found that the current sensor was working as it should and it was outputting AC voltage because the input at Al and A2 was also AC It was decided that in
43. p Priority via via Interrupt Interrupt Figure 14 Basic System Design Basic Operation Arduino Implementation The original design is what was used when first attempting to implement the system on the Arduino microcontroller The first problem encountered was the difficulty in accessing and extending the Serial Interrupt Service Routine on the Arduino This extension would be necessary because the Arduino like most embedded processors already has a built in ISR to support the UART Universal asynchronous receiver transmitter To implement an interrupt driven system for the priority messages the Serial ISR would need to be altered to include a check to see whether the message is a priority signal or not With the inability to alter the Serial ISR the design was altered to poll for messages from priority devices The interrupt system for the periodic switching of automatic devices was much easier to develop The operation was implemented utilizing a user created date and time library obtained through the Arduino community The TimeAlarms library which is a companion to the Time library allows for the creation of periodic or one time alarms It allows you to specify a function to run when the Alarm goes off This library essentially takes care of all the interrupt setup work and coding allowing for easily implemented timers Figure 15 shows the updated system design The Priority stage from the earlier design has b
44. pr 2004 8 Allegro Microsystems Inc Automotive Grade Fully Integrated Hall Effect Based Linear Current Sensor IC with 2 1 KVRMS Voltage Isolation and a Low Resistance Current Conductor ACS714 Datasheet 2010 9 National Semiconductor Corporation LM193 LM293 LM393 LM2903 Low Power Low Offset Voltage Dual Comparators LM393 Datasheet August 2002 10 Fairchild Semiconductor Corporation IN FDLL 914 A B 916 A B 4148 4448 Small Signal Diode 1N914B Datasheet January 2007 26 Appendix A 3 3V 1nF 0 1 UF eec ENN GND 10 kO 10 kQ MI ba OKO eee in An An An Gr rn add es av A S setez el namas falas mazas 10 kO Fu kQ 4 5kQ Figure 19 Breadboard View of the Complete Current Sensing Circuit 27 Bill of Materials Coordinator Name Parti Y Manufacturer Supplier Supplier Partii Y Price T iaa Note 2 60 http search digikey com scripts DkSearch dksus dll Detail amp name ATMEGA328 AUR ND Atmel Digi Key ATMEGA328 AUR ND 2 60 1 Potter amp Brumfield Digi Key PB1014 ND 3 02 1 3 02 http search digikey com scripts DkSearch dksus dll vendor 0 amp keywords T9AS1D12 5 Digi Maxstream Digi Key XB24 ACI 001 ND http www sparkfun com commerce product info php products id 8664 http search digikey com scripts DkSearch dksus dll Detail amp name XC1505TR ND http search digikey com scripts DkSearch dksus dll Detail amp name 541 1 8KJTR ND http se
45. put to indicate which voltage is larger A common device used to perform this function is the comparator which is equivalent to an operational amplifier with two NPN transistors added to the output of the amplifier The output is switched ON or OFF depending on the relative voltages at the inverting and non inverting inputs of the comparator LM393 is a common dual comparator chip used in a number of applications It provides high precision and has a wide voltage range which made it suitable for our application and was chosen as the comparator chip The pin connections for LM393 are given in Figure 8 below 11 Output A H 8 Vec a Output B Inputs 5 E d ene Taj muse Figure 8 Pin Layouts for the LM 393 Comparator As our application reguired the use of just one comparator pins 5 to 7 were left unconnected The following diagram shows the schematic of the circuit that was put together for test purposes before the actual circuit was implemented Figure 9 Schematic for Threshold Detector Circuit The potentiometer was used to set a reference voltage of 1 85V at the non inverting input A potentiometer was connected at V and a separate power supply was then connected to the Vin terminal with the initial voltage set to OV The voltage was steadily increased and it was observed that the output V changed from high 3 3V to low OV when voltage at Vi crossed the 1 85V marker This showed that the comparator was performing as expected
46. s a marketable product At this stage the design and functionality of the product has been worked out in detail and is at the point where the design must be optimized in terms of size and cost in order to bring it to market Tasks remaining include designing a custom PCB for each of the three unit types that integrates all of the components that were previously on discrete PCBs Simultaneously an enclosure must be created that will be able to fit the components and be attractive to consumers The testing and certification of the device is another issue that will need to be addressed Overall this is a very solid product with excellent marketing potential thanks to its unique design solutions 25 References 1 Philips Appl Note 97055 pp 10 16 2 Digi International XBee XBee PRO RF Modules Product Manual Sept 2009 3 ATmel ATmega48A 48PA 88A 88PA 168A 168PA 328 328P Product Summary Apr 2010 4 ATmel 8 bit AVR Microcontroller with 4 8 16K Bytes In System Programmable Flash ATmega 328 Datasheet Oct 2009 5 Tyco Electronics DC Coil 30 Amp PC Board or Panel Mount Relay TIA Series Datasheet Mar 2003 6 Allegro Microsystems Inc Automotive Grade Fully Integrated Hall Effect Based Linear Current Sensor IC with 2 1 KVRMS Voltage Isolation and a Low Resistance Current Conductor ACS714 Datasheet 2010 7 Sharp IT rms 16A Non Zero Cross type SIP 4pin Triac output SSR S116501 Series Datasheet A
47. s software section will detail the original on paper design as well as 1ts changes and implementations on the Arduino microcontroller Afterward the integration of XBee radios and how the system uses them will be detailed Third the alteration of the system to account for multiple circuits will be explored Finally a summary of the final software system is shown 15 Basic Operation Theoretical Design The following describes the system in an ideal setting Afterwards the restrictions and limitations of the Arduino microcontroller are considered and the changes to the design are discussed When considering the periodic priority messages the system could implement one of two solutions Either the system could continually poll for a message or the message receipt could generate an interrupt Similarly handling the periodic device switching could be accomplished through either time delays sleep or through the use of a timer interrupt Any combination of these solutions should in theory accomplish the desired results In the end the decision was to use interrupts to implement both tasks This decision was made based on a couple of factors Firstly by using interrupts for both the system can be put into a sleep mode while waiting This would drastically reduce the power consumption of the system which is a major factor to consider in real time embedded systems Secondly if polling were used for the priority messages implementing a time delay
48. the radio to broadcast to all other XBees asking for information Each XBee receiving this request responds with their name unique address network ID and signal strength The local XBee then retransmits this information over the Serial port to the Arduino The system reads a number of bytes of the serial input corresponding to the length of the information for a single device The system creates a struct to store the information and then repeats the 18 process with the next device s information creating a list of data structures representing the radios on the network Finishing this the system enters the Ready state Integrating the XBee Radios Signalling Once the network was established and the Arduino had all the information necessary the system needed a way to actually send messages to remote radios Remote commands commands that are passed on from the local radio to a remote one cannot be executed using the simple AT mode of operation Remote commands require the use of the API operation mode which was not something originally anticipated when implementing the node discovery operation using AT mode API mode requires the creation of a message frame This frame is simply an array of bytes with certain indexes having pre defined uses Figure 3 is taken from the XBee user manual It lays out how a Remote AT Command Request should be formulated Start Delimiter Length Frame Data Checksum 0x7E
49. transition stage from prototype to production This would require a considerable amount of resources to build Current Sensing Circuit Requirement The current sensor circuit was used in the Happy Plug Priority unit It was required particularly to sense current threshold when an appliance plugged into the Priority unit was turned ON The output from the circuit would then serve as the input to the XBEE radio that would transmit this information to the micro processor in the coordinator device The task to design the circuit was difficult because of another design constraint The circuit had to function such that the output would change states when the input current would pass a particular predefined threshold value This constraint was put into place because the unit was to be used with a microwave or a similar application which requires power all the time Even when the appliance is not in use the clock will still require power to work The current drawn by the appliance just to keep the clock running will not cause an output state change It will however change output state when the appliance turns on and the current passes a particular threshold value Current Sensor The current sensor used was the ACS714 which works on the principle of the Hall Effect This particular current sensor was chosen because it fulfilled all the requirements for the circuit The sensor operates at 5 V normally but can operate at 3 3V which was better suited t
50. xbee getResponse getRx64IoSampleResponse ioSample if ioSample getSampleSize 1 amp amp ioSample containsDigital 1 uint8 t sample 8 for int i 0 i lt 8 i sample i ioSample isDigitalOn i 1 uint8 t val sample 0 sample 1 lt lt 1 sample 2 lt lt 2 int circuit_id 0 switch val case 0x07 circuit id 7 break case 0x06 circuit id 6 break case 0x05 53 circuit Solas 53 break case 0x04 circuit id 4 break case 0x03 circuit id 3 break case 0x02 circuit ol 2 break case 0x01 circuit id 1 break case 0x00 circuit rd 07 break default circuit_id 0 break if toProcess PROCESS CIRCU dev gt circuit id circuit id lcd clear lcd print dev circuit id lcd setCursor 0 1 54 lcd print val HEX Alarm delay 3000 T toProcess Alarm delay 2000 lcd print man sig CID lcd print circuit id Alarm delay 2000 PROCESS MANUAL SIGNAL 1 TYPE device check current heads circuit id uint32 t response low uint32 t address low while check NULL response low getRemoteAddress64 getLsb address low check gt addr address low address low address low address low gt address low value 1 address low address low address
51. y tails circuit de Vi relay tails circuit gt prev NULL void query circuit TYPE device dev T dev gt isLocal seul 3 uint8 t frame 12 frame 0 Ox7E Frame delimiter frame 1 0x00 Size MSB frame 2 0x05 Size LSB frame 3 0x08 AP D frame 4 0x01 Frame ID frame 5 I Command D3 41 Serial write frame 9 Alarm delay 5000 process response dev PROC else uint8 t frame 19 frame 6 S frame 7 0x01 POWER ON or POWER OFF frame 8 calculate checksum frame 3 8 ESS CIRCUIT ID frame 0 Ox7E Frame Delimiter frame 1 0x00 Frame size MSB frame 2 0x10 Frame size LSB frame 3 0x17 AP dentifier frame 4 0x01 Frame ID frame 5 dev gt address high value 0 frame 6 dev gt address high value 1 frame 7 dev gt address high value 2 frame 8 dev gt address high value 3 frame 9 dev gt address low value 0 frame 10 dev gt address low value 1 frame 11 dev gt address low value 2 frame 12 dev gt address low value 3 frame 13 OxFF to ignore 16 bit mode frame 14 OxFE frame 15 0x02 Execute immediately frame 16 I Command D3 digital IO pin 3 42

Download Pdf Manuals

image

Related Search

Related Contents

Operating Instructions Fire Alarm System EBL512  30681 Spitfire MK IX Multi Manual.indb  i-cut Layout+ User Manual - Product Documentation  complet - Acti City  Operation & Installation Manual 05/2009  MODE D`EMPLOI - Migros  Vedere la - JR International  Maquillaje neoliberal de la economía georgiana  

Copyright © All rights reserved.
Failed to retrieve file