qwertyuiopasdfghjklzxcvbnmqw ertyuiopasdfghjklzxcvbnmqwert yuiopasdfghjklzxcvbnmqwertyui opasdfghjklzxcvbnmqwertyuiopa YouWatchMyStuff sdfghjklzxcvbnmqwertyuiopasdf Final Report ghjklzxcvbnmqwertyuiopasdfghj klzxcvbnmqwertyuiopasdfghjklz xcvbnmqwertyuiopasdfghjklzxcv bnmqwertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcvbnmq wertyuiopasdfghjklzxcvbnmqwe rtyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuio pasdfghjklzxcvbnmqwertyuiopas dfghjklzxcvbnmqwertyuiopasdfg hjklzxcvbnmqwertyuiopasdfghjk Team: Richard ,Amrutha, Randy,Hussain, Raed Sponsor : Chris Wikernson, Adviser: Malgorzata Jeske Date: 5/31/2013 YouWatchMyStuff 1/20135/2013 Contents 1. Abstract …………………………………………………………………………………………………………………….2 2. Introduction……………………………………………………………………………………………………………….. 2 2.1 Problem Identification …………………………………………………………………………………...2 2.2 Motivation……………………………………………………………………………………………………2 2.3 Objective………………………………………………………………………………………………………3 3. Agenda ………………………………………………………………………………………………………………………3 3.1 Team Introduction …………………………………………………………………………………………3 3.2 Requirements………………………………………………………………………………………………...3 3.3 Approach………………………………………………………………………………………………………4 3.4 Project Management………………………………………………………………………………………4 3.5 Budget……………………………………..……………………………………………………………………5 4. Design………………………………………………………………………………………………………………………..6 4.1 Hardware design and implementation…………………………………………………………….6 4.2 Software design and implementation…………………………………………………………….11 4.3 IP and prior work…………………………………………………………………………………………16 5. Testing and Outstanding Issues…………………………………………………………………………………17 5.1 Testing Plan………………………………………………………………………………………………….17 5.2 Project Issues…………………………………………………………………………………………….....20 6. Individual team members contributions……………………………………………………………………21 7. Next Steps…………………………………………………………………………………………………………………22 8. Conclusion……………………………………………………………………………………………………………… 25 https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 1 YouWatchMyStuff 1/20135/2013 1. ABSTRACT The purpose for this project is to have a wireless portable security device that people can monitor their personal possessions such as a laptop, backpack, or piece of luggage while away from it. 2. INTRODUCTION 2.1 Problem Identification Theft is a common occurrence, particularly among college students. Today students can’t guarantee that their laptops will not be stolen in a university library if they leave for a couple of minutes. Moreover, people don’t want to carry all their belongings every time they have to leave their study table. Therefore, a security device that will alert the user and keep a thief from stealing is a necessity these days. 2.2 Motivation To create an innovative new product those meets the needs of an untapped market segment, and provide security for personal possessions. 2.3 Objective To design and create a working prototype of the security device that can be monitored through a smart phone and act as a viable alarming system for the user. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 2 YouWatchMyStuff 1/20135/2013 3. AGENDA 3.1 Team Introduction Richard and Randy as Computer Engineering students has been helpful in the software development of the app. Amrutha, Hussain and Raed as Electrical Engineering has equally helpful on the hardware development of the overall device. 3.2 Requirements: A prototype that ensures security with an audible alarm controlled via a phone application. Either an Android or iOS application could be used for this purpose. The device will be developed according to the below specifications: Base requirements: Accelerometer Speaker - ~80dB and less than or equal to 0.03 watts Bluetooth – Possibly use a Class 2 (2.5mW and ~10m range) At least 1 LED Interface: Remote activation with phone only Batteries – 9V Battery AVR Processor – 32 bit AVR microcontroller Case – Plastic case Software: Android Application Code to run the AVR and the additional features (Bluetooth, Speaker, etc.) App functionality: Activate/Deactivate alarm Arm device Phone plays sound alarm and vibrates when alarm activates. Possible additional features: GPS location tracking and logging App functionality: Pin location of device Record locations in last X hours Record location when Bluetooth losses connection. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 3 YouWatchMyStuff 1/20135/2013 Specific design requirements: Must: 1- Device must work for a minimum of 5m from phone. 2- Device sounds an alarm for a motion detected on the accelerometer. 3- The phone should receive a signal once the alarm goes off. Should: 1- Have a sleek and aesthetically pleasing appearance. 2- The PCB should be 3x3 inches maximum. 3- The device should be able to be enabled or disabled using the phone App. 4- The source of power should last for a convenient amount of time, such as 3 weeks in standby. 5- The device should work in typical weather conditions. May: 1- GPS tracker feature on the app. 2- Packaging could be waterproof. 3- When out of the device’s range the app should inform the user and disable its functions. 3.3 Approach: The team support and enthusiasm made the project possible. Brainstorming ideas and following up with the Sponsor on the initial project proposal was our first step. Constant communication with the Sponsor and the Advisor on ideas helped behind the development of the security device. To create the project schedule we used Microsoft Project to create a Gantt chart. Additionally we maintained a wiki page in order to organize the project requirement and provide easy access to our documentation for all team members. 3.4 Project Management Weekly meetings provided an opportunity for status updates among team members. This was accomplished by scheduling a one hour administrative meeting and a 3 hour work meeting. Weekly progress reports for each team member and a weekly progress summary were posted on our wiki page. A repository was setup to implement a document version control system. Roles Richard: Team Leader – Android Application Amrutha: Project Management Randy: Arduino code Hussain: Hardware Raed: Concept Research and iOS https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 4 YouWatchMyStuff 1/20135/2013 3.5 Budget: To create YWMSy we spent under $500 for parts. It took around six months to complete and improve YWMSy. There was approximate 5% mistake which is about Bluetooth part we bought the wrong one at the beginning which cost 27 $. The table below shows all cost total numbers. Total Amount Spent Mistakes cost Price 487.63 27 Notes Working four PCBs and one demo Bluetooth device for the demo Cost / PCB Conceptual (Pen) 90.17 6.9 Actual cost for each PCB For each device (Pen) part package quanitity Price Vendor Capacitor 10 uF C0805 2 0.32 Digikey Capacitor 20 pF C0805 2 0.58 Digikey Capacitor 0.1 uF C0805 5 0.22 Digikey Diode DO4110 2 0.1 Jameco Resistor 22k C0805 1 0.23 Digikey Resistor 330 C0805 1 0.23 Digikey Crystal 16 MHz HC49/US 1 0.81 Digikey Buzzer F/CM12P 1 2.49 Jameco Accelerometer ATMEGA 328 P-PU w/ Bootloader LFCSP16 ATMEGA 328 PPU 1 6.07 1 6 Digikey surplus gizmos Connector Terminal 1 0.39 Jameco LM7805 1 0.45 Jameco Connector Unshrouded Header 6 1 0.29 Jameco female pcb header 1 0.99 Jameco 28 pin socket 1 1.09 Jameco Bluetooth 1 8.95 total https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki 29.21 Page 5 YouWatchMyStuff 1/20135/2013 4. DESIGN 4.1 Hardware design and implementation The hardware consists of two systems. A main system which has all components related to the device functionality and a second system is the power distribution system which regulates the voltage supplied to the system. Main system: In order to design the hardware for the main system, the components had to be selected according to the minimum functionality required of the device. The required components are: a. Microcontroller (Atmega328). The microcontroller will be programmed to control and send signals to power up the other components of the circuit. In addition, it will respond to signals coming from these components. b. Accelerometer (adxl335). The accelerometer will sense the movement of the device and will send a signal to the microcontroller. c. Buzzer. The buzzer will sound an alarm when it receives a high signal from the Microcontroller. The signal will be applied when the microcontroller receives a specific signal from the accelerometer. d. RGB LED. The LED will monitor the state of the device. It will light green when the device is powered up and Bluetooth connection is initiated. The LED will light Blue when the device security function is initiated. In addition, it will alternate between blue and red when alarm sounds or panic mode is initiated. e. MOD-BT Bluetooth Model (employs BGB203 Philips Bluetooth chip). Bluetooth model establish connection between the device and another Bluetooth device mainly a cell phone. The parts above are the final parts that were chosen in hardware design. Some parts had to change because they either were difficult to use or had some functioning issues. The original accelerometer that was going to be used needed to be programmed in order to function correctly. This would have resulted in an additional programming time; therefore, the decision was to use another accelerometer which was available at no extra cost. Figure1 below shows the parts that were used in the main system. The Bluetooth device also had to be changed because it had issues maintaining connections. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 6 YouWatchMyStuff 1/20135/2013 Figure1Individual Components Power distribution system: This is a simple system which employs the LM7805 linear voltage regulator to step down the DC voltage from range 0f 9-12 VDC to 5 VDC. Elementary hardware testing was conducted to check the expected functionality of the parts and power consumption was measured as well. The tables below show these tests results. Device power (mille Amps/Hour) Bluetooth(searching mode) 20 Bluetooth(data sending/ receiving) 23 Bluetooth (device search) 20 speaker(minimum) 8.3 speaker(maximum) 20 LED 20 20 accelerometer 0.35 0.35 Average Power 21 14.15 Table 1 (power consumption for individual devices) Prototype Device(1) power (mille Amps/Hour) Power ON(alarm OFF) 54 Power ON(alarm ON) 63 low power mode 4.1 Average Power 40.38 Table2 Power consumption for device https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 7 YouWatchMyStuff 1/20135/2013 The tables show the result of measuring currents using a multimeter. The measurements in Table 2 were average to compensate for current fluctuations which were likely caused by the Bluetooth module. However, in our testing device we used a 9Vbattery to power it up and we have been using the device every day for almost 3 months now and the battery is still working. Thus, the power consumption conclusion for this device is that it will work for a minimum of 2 months on low power mode and a maximum of 30 days on heavy use for at least 6 hours a day. Hardware implementation: For testing purposes the device was first implemented in a breadboard, and jumpers were used to connect the components to the Arduino UNO programming board. Figure-1 below shows the testing device. Figure1 Testing device Schematic and Board layout: The schematic and board layout were both done by using the EAGLE-CAD software. All components including resistors, capacitors, and necessary elements for the circuit to function correctly were chosen according to data sheets associated with the main components. Figure 2 through figure 3 below shows the schematics of the systems of the hardware. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 8 YouWatchMyStuff 1/20135/2013 Figure2 Microcontroller system schematic Figure3 Power system schematic The board layout had all the components implemented on the board except the Bluetooth module since it would take extra time and money to finish the design. The board design was sent to Sunstone Circuitry for fabrication. Figures 4 through 6 will show the EAGLE-CAD board layout, unpopulated PCB (printed circuit board), and the populated PCB. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 9 YouWatchMyStuff 1/20135/2013 Figure4 EAGLE-CAD board layout Figur5 Pre-Soldering PCB The hardest component to solder to the board was the accelerometer because it only came in QFN package. All surface mount components were soldered to the board using the reflow oven in the prototyping lab at Portland State University. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 10 YouWatchMyStuff 1/20135/2013 Figur6 Soldered PCB 4.2 Software design and implementation When planning how to interact with YWMSy it soon became apparent that one of the best ways to control it would be through an application on a phone or tablet. Once we decided to write an application, the next major decision was: should we make an application for either Android or iOS? If this device was put on the market, we would of course offer both Android and iOS support, but for the sake of prototyping we needed to pick one to start with. Surprising the choice was not made based on our personal preferences between iOS or Android, but instead simply on the fact that developing on Android is free so we could start right away while iOS requires a payment to develop applications for it so for the sake of cost and time we started with Android. Since this was our first attempt at writing an Android application we spent a significant amount of time setting up Eclipse and building the applications provided in the tutorials so that we could better familiarize ourselves with the software. The next phase of development lead us to the Bluetooth example code on: http://developer.android.com/guide/topics/connectivity/bluetooth.html. Unfortunately, there are some missing portions of the code and setup in the guide, which resulted in our attempts being unsuccessful when trying to follow those examples. We were able to find some very helpful examples on Youtube.com, but we still struggled to adapt these examples to our needs. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 11 YouWatchMyStuff 1/20135/2013 Figure7 MIT App Inventor One video had an example of a basic Android application that covered Bluetooth communication with very similar functionality to what we were looking for with our application. This program is called “Blue Moon” and being it was programmed using a MIT beta program called “App Inventor”. This method of application development is set up with a strong focus on a simple user interface and visual coding. Code is “written” by assembling puzzle piece-like shapes into functions and dragging segments of code into the desired locations. With the groundwork laid out for us in the “Blue Moon” application we removed almost everything else from that application except the core functionality and then we build our application on that framework. Since the initial work had been done in “App Inventor” we continued to use this program and found that it worked very well for our needs. The final functionality of our application was designed to be simple and intuitive while still providing all of the functionality that a user might desire. Below are the flowcharts outlining how the application actually works: https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 12 YouWatchMyStuff 1/20135/2013 1. Find Devices Turn on App No On? YES Main Screen BACK YES Find Device Device Selected NO Figure8 Part1 Android Flowchart https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 13 YouWatchMyStuff 1/20135/2013 Press to Connect BT No Connected? Yes Main Screen Power on Device PANIC No No Button Pressed Button Pressed Yes Yes Alarm Disarmed (Press to Arm) Power OFF Device PANIC No No Yes Main Screen Button Pressed Button Pressed Alarm Armed (Press to Disarm) No Device Moved Yes Alarm – Play Sound/ Vibrate https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 14 YouWatchMyStuff 1/20135/2013 During the design process we ran into many challenges, including the Bluetooth chip on YWMSy having connection issues with the application, the alarm going off at the wrong time or not at all, and many others. Despite these setbacks we were able work through each of them to deliver a complete functional Android application to use with YWMSy. iOS Software: Since there is 35% of smartphones users worldwide using IOS, we see it is important to do basic IOS app connecting to BLE and ready to improve the YWMSy Ideal design. IOS environment works only with Bluetooth low energy, for this reason we order extra kit, which is TI SendorTag to test our IOS app. This app has basic requirements like searching for devices and connects to them and there is alarm working in iPhone for any move to this kit. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 15 YouWatchMyStuff 1/20135/2013 4.3 IP and Prior work: Research played a crucial role in the hardware and software development process of the project. Experience gained from the practicum projects was also helpful in developing this project. Here are the links to some of the resources used: http://developer.android.com/guide/topics/connectivity/bluetooth.html [ Android – Bluetooth] http://developer.android.com/training/basics/firstapp/index.html [First Android App] http://wiring.org.co/learning/basics/accelerometer.html [ Accelerometer –Arduino] http://bildr.org/2011/04/sensing-orientation-with-the-adxl335-arduino/ [ Arduino – Accelerometer] http://arduino.cc/en/Hacking/PinMapping168 [ Pin Mapping Arduino – Atmega 328] https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 16 YouWatchMyStuff 1/20135/2013 5. TESTING and OUTSTANDING ISSUES: 5.1 Testing Plan Hardware I. II. III. Power Supply (Voltage Regulator) Test A. Equipment needed: Power supply DMM Wire B. Functionality Test: Must supply a stable 5V output when 9V is applied Must supply at least 54mA (with max load test) C. Environment Test: Must supply enough Power for device to be ‘ON’ > 24 hours D. Module test: Kept device on for more than 24 hours Buzzer Testing A. Equipment: Oscilloscope BNC cables Power Supply Power supply connectors B. Functionality Test: Buzzer must make noise when an audio signal is provided C. Environmental Test: Buzzer must be capable of making sound loud enough to hear in a loud room D. Module Tests Used the function generator at different frequencies to test for a pitch Used Arduino predefined Tone() function (see software section) Motion Sensor(Accelerometer) Test A. Equipment: Oscilloscope Power supply Wire connections B. Functionality Test: Motion sensor must sense a small movement of gravity force in the x, y and z direction C. Environment Test: Motion sensor must be able to trigger the alarm when moved as a unit D. Module Test: https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 17 YouWatchMyStuff 1/20135/2013 IV. V. Made several physical tests to measure the sensitivity of the sensor compared to physical movement using a power supply and an oscilloscope. Bluetooth device Test A. Equipment: DMM Power supply Power connections B. Functionality Test: Bluetooth device must be able to communicate with any cell phone with Bluetooth connection C. Environment Test: Bluetooth must connect to our test cell phone with a username and password setup D. Module Test: Used predefined Arduino function called SoftwareSerial to comminute to and from Bluetooth device and phone Used app SENA Bterm to send and receive data to and from phone to Bluetooth device Multi-Color LED Test A. Equipment: DMM Power supply Power connections B. Functionality Test: LED must light the color Red, Blue and Green C. Environment Test: Must blink and keep a steady light for Red, Blue and Green using the I/O ports from the Arduino Uno D. Module Test: Used power supply at 5V 27mA to test the LED colors. Used an Arduino Uno to test blinking LED for Red, Green and Blue Software (all black box testing unless noted) I. Buzzer Testing A. Software/Hardware: Arduino IDE Function Tone() from Arduino predefined library Arduino Uno microcontroller B. Module Tests https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 18 YouWatchMyStuff 1/20135/2013 II. III. Used Tone () generator to make different types of tones. This was done to search for the best tone that can provide a loud noise Motion Sensor(Accelerometer) Test E. Equipment: Arduino IDE Arduino IDE Tool Serial Monitor F. Module Test: Made several physical tests measuring the sensitivity of the sensor versus physical movement. Used a print out from the Serial Monitor window of the g values from x, y and z motion. The values where obtained from the Arduino Uno Analog to digital converter. Bluetooth device Test G. Software/Equipment: Arduino Uno Arduino IDE Arduino IDE Pre-defined function SoftwareSerial H. Module Test: Used predefined Arduino function called SoftwareSerial to comminute to and from Bluetooth device and phone Used app SENA Bterm app on phone to send and receive data to and from the Bluetooth device Used internal Command codes to setup Bluetooth Device name, Bandwidth and Password https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 19 YouWatchMyStuff 1/20135/2013 5.2 Project issues: Subject Issue Resolution Group/Individual Git Repository The group was not able to neither upload nor download files from the repository. Change the repository setting from Git to Subversion Individual Wiki page Organization The sections were not organized making it difficult to look for documents and links Communication between group and advisor/sponsor Did not kept advisor/sponsor update with progress Team member outlined and reorganized links for a better flow to search Assigned a team member to have a constant communication with advisor/sponsor Accelerometer not available Bluetooth Not searchable via phone Bluetooth Intermittent connection Alarm not working Alarm turns on when it has not been moved No accelerometer available on the specific vendor website The Bluetooth device was going to command mode instead of communication mode The Phone was not able to connect to Bluetooth part of the time The Alarm was not going to the enable function witch is the part that makes the alarm work The accelerometer has a drift deviation of ± 3g Individual Group Gave website a week for vendor to stock with new merchandise Group Found the setting to enable communication mode Individual Replaced the Bluetooth device Individual Change the Enable alarm Implementation Individual Implemented an acceptable deviation to Arduino code so the alarm is not triggered by drift Individual https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 20 YouWatchMyStuff 1/20135/2013 6. INDIVIDUAL TEAM MEMBER’S CONTRIBUTIONS I. Richard Atwood contributions are as follows: Team Lead Android Application Programming and Design Android Application Algorithm and Flow Handled scheduling of events and meetings Routine tasks on the project Contributed to writing documentation and reports Coordinated group and Sponsor discussions and interactions Amrutha Doosa contributions are as follows: Wiki page organizer Project Management Communicate with Advisor and Sponsor on weekly progress reports. Project Schedules and organizing among group members. Test Plan, Project Design Specifications and Eagle Cad schematic Android Application Algorithm and Arduino algorithm Initial Android application development to recognize Bluetooth device. II. III. Hussain Alsaffar contributions are as follows: Routine tasks on the project Program the Bluetooth device using Arduino code Power calculations of the design and sizing the battery to power the device Completed schematic on the Alarm Project Designed the board layout for the PCB Soldered Project’s components into the PCB Randy Duran contributions are as follows: Accelerometer Speaker Bluetooth device Multi-Color LED Contribute to Building the Prototype Contribute Writing Documentation Raed Alkhaldi contributions are as follows: IPhone Application Algorithm IPhone App Coding connecting IPhone with Acclamatory through BLE Design Concept Device Calculate Concept Device Cost Researching for device’s Improvement IV. V. https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 21 YouWatchMyStuff 1/20135/2013 7. NEXT STEPS: The following designs are the examples of the final vision for the device. Alarm Device 1 YWMSy Board Twist To Lock Device RGB LED Power ON Touch Sensor Speaker RGB LED https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 22 YouWatchMyStuff 1/20135/2013 Alarm Device 2 Battery Cover Batteries YWMSy Board Speaker Muli-Color LED https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 23 YouWatchMyStuff 1/20135/2013 The following tables below are the required components and the cost per device: Part name Microcontroller Bluetooth Low Energy Battery Part number PIC12LF1552 CC2540 CR2032 Size 2X3 mm 6mm X 6mm diameter 20mm ,high 3.2 mm Table 3 Ideal Design components PART Capacitors Diode Accelerometer BLE resistor Buzzer microcontroller Battery PCB Total cost Table 4 Cost/ Ideal Design. Quantity 9 2 1 1 2 1 1 1 1 https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Price 0.27 $ 0.1 $ 1.4 $ 2.5 $ 0.012 $ 0.7 $ 0.7 $ 0.28 $ 1 6.9 $ Page 24 YouWatchMyStuff 1/20135/2013 8. CONCLUSION: Talk about project issues: ethical professional social issues, discussions of projects weakness and strengths - Issues - Weakness and strengths https://projects.cecs.pdx.edu/projects/wi2013ece412-watchstuff/wiki Page 25