Вы находитесь на странице: 1из 12

The Guys Next Door Team 8 Critical Design Review

Laboratory 3: Building a Security System

Matt Lees Tyler Ridder Ahmed Elgharmool EE 300w Fall 2013


Table of Content:
Introduction2 Rationale2 Implementation3 Verification Testing..3 CAN bus interface3 Mbed and LabVIEW Debugging.4 Validation Testing..5 Results from Integrated System5 Bill of Materials.6 Value Statement..6 Conclusion.6 References6 Appendices7 APPENDIX A: PROJECT BLOCK DIAGRAM7 APPENDIX B: IMPLEMENTATION DIAGRAMS..7 APPENDIX C: FINACIAL PAGE..10

A system of systems is a collection of specific systems that are connected together to form a larger system to perform a task. This project takes advantage of the system of system qualities to design a security system. The security system performed many functions including voice recognition, PIN code, fingerprint recognition, and user image recognition. The system has a main LabVIEW VI that communicates with a main mbed microcontroller via RPC serial protocol. The main LabVIEW VI has a front panel that allows the user to select a sensor to use. When the user selects a sensor the main mbed sends a command, via CAN, to the corresponding subsystem to perform the task. The subsystem performs the function and then sends a conformation CAN message back to the controlling mbed. Our group designed was the user image recognition system. Our design consisted of a LabVIEW VI, an mbed microcontroller, a LinkSprite SEN-10061 JPEG camera, and a CAN transceiver. When the controlling mbed sent a command to our system it was received by the mbed microcontroller. Then the user must press the Take picture. Once this button is pressed, the LabVIEW sends an RPC command to the mbed to take the picture. The camera takes a picture and stores it on the mbed. After the picture is taken and stored the LabVIEW refreshes the current picture on the front panel, allowing the user to compare the current picture to a reference picture. Finally, the mbed sends a conformation message via CAN back to the main mbed. A block diagram of the overall system is shown in Appendix A.

Security systems can we very complicated with multiple components depending on where it is being used and how the user would like it to perform. With the components we were given, our system consisted of a security camera which captures and stores an image. When running the program the camera will take an image, store it, and compare it to a previously saved image. The two images can be compared to determine if access should be granted. With the tools available to us through Penn State and with our prior knowledge, this is the best possible solution. We are making the assumption that an operator will be using the system and be able to visually compare the two images. With our combined knowledge of writing C++, implementing LabVIEW and circuit construction we used these concepts to reach our end goal. C++ code was chosen because it is the easiest to work with and is compatible with the Mbed microcontroller. The written code allows us to communicate with the camera through the Mbed and also LabVIEW. The second function of this system is the implementation of LabVIEW. This program is used to serve as the control to run the system. It also gave us the ability to store and compare the images. Once these components were finished we used our general knowledge of circuit construction to connect the camera module to the Mbed.

1. Verification Testing:

The second level requirements for the camera security system are: The subsystem shall record users image before the user gains access to the system and the subsystem shall store the users image as a jpeg. The initial code we wrote does just that. The file was saved locally as a JPEG file as soon as the image is taken. At first, pressing the reset button captures the image. See figure 1 Our colored cameras number code is SEN-10061 and it has a TLL interface model, which has the following features: VGA/QVGA/160x120 resolution Support capture JPEG from serial port Default baud rate of serial port is 38400 5V power supply Size 32X32mm Current consumption: 80-100mA

Before taking the picture the camera must be initialized according to the following block diagram: see figure 2 in appendix B. After initializing the camera, we can capture the image and output the JPEG image through UART as follows: See figure 3 in appendix B. We wrote two separate LabView codes; one for controlling the camera and the other was just for display. When combining the two LabView codes we added a sequence structure in order to display the image only when its been saved and ready to view. See LabView VI figure 4 and 5 in appendix B for the code and the friendly user interface, respectively. With respect to the other sensors in the project, the user must first pass the image recognition test to gain access. Using LabView we can display both images( original and current) side by side and compare them. The integration team sends us the order to take the picture and mbed waits for that message that is send through CAN bus. Once the message is received, the camera captures the image and LabView automatically displays it as soon as its been saved. See figure 6 in appendix B for the full integration process for the camera. CAN Bus Code: The CAN bus code is as follows: CAN canbus(p30, p29); // Transceiver pin assignment CANMessage msg; //CAN bus variable that holds CAN bus message char access; //Variable to change dependent on sensor int DeviceID = 1003; //ID of a particular sensor ( ours is 1003) canbus.read(msg); // command to read in the message from the master pc if(msg.data && (msg.id == 1003)) { // executes when the message is received access=1; // sends 1 when successful 3

access=0; // sends 0 in case of failure canbus.write(CANMessage(1003, &access, 1)); // command to send the access variable ( 1 or 0) As mentioned earlier we had to place the last line inside the if loop in order to send the message. Other than that we didnt alter our code much. To see the full code please go to the C code lab_3_c_code attached with this document. C code and LabView debugging: As a starting point, we used the sample code provided by mbed.com but it hd many impracticalities. First, It saves 40 pictures, which is way more than we need. Second, It takes pictures when reset is pressed. Third, there is no alert that the picture was saved ( I.e LED on .) We had to introduce RPC and add extra lines of code in order to fix these problems.

RPC code: int ledAction =0; // capturing int ledStat=0; // image stat

RPCVariable<int> rpcLEDAction(&ledAction, "labviewSnapShot"); //initializing RPC variables RPCVariable<int> rpcLEDStat(&ledStat, "labviewPicStat"); ledStat= ledAction; if (ledAction==1){ // if the take picture command is pressed do the rest of the if statement

Reset button elimination: We had to take out these following lines in order to control the code only through the RPC

if (cam1.reset() == 0) { DEBMSG("Reset OK."); NEWLINE(); } else { DEBMSG("Reset fail."); NEWLINE(); error("Reset fail."); }

When building the RPC LabView code we had lots of timing problems. At first we followed the same structure of the RPC demo, but the image was all grey. We concluded that the camera didnt have enough time to save the image. That issue was fixed by adding a delay function. With some error and trail, we ended up with a min of a 9 second delay. The next challenge was to combine both VI: the display Vi and the Capture VI. We knew that the display JPEG function cannot be put randomly, so we used an event structure in order to display the image only when the file has been saved and ready to view. 2. Validation testing:

Having the picture saved as a JPEG file makes it easy for this data to be used later in face recognition software. Face recognition is beyond the scope of this class but the data we collected using the mbed is definitely useful for such complex software. When it comes to gaining access, using facial features is more accurate than card or pin codes. Asking the user to use their face definitely adds more reliability and security to the system as a whole.


Results for Integrated System:

When we hooked up our design to the integration team, we had to alter our c code because the sendmassage command was misplaced in the code and therefore they didnt get a message that says the picture was taken. Once this was fixed, the system worked fine. We ran the LabView code on a pc next to the master pc and clicked capture ( see Fig 5 in appendix B ). The mbed then waits for the message from the integration team through CAN bus. Once received, the LabView code saves the image and displays it side to side to the original image taken beforehand. Once the image is displayed, the mbed sends out a check message back to the integration team. Otherwise, a message of failure is sent. Due to the delay of 13 seconds (time for the camera to take and save the JPEG file), the integration process took around 15 once the integration team sent the action message. One way to make this process faster is to get a faster colored camera. Another observation we noticed was that the CAN bus is a very simple and yet fast communication protocol. Once its been hooked up to the system and the code downloaded to the mbed we where good to go. There are other alternatives such as RS485 which are much faster.

Bill of Materials
This section reports the total prices used to build and operate the security system. Parts are priced based on the assumption that only one system will be built and used. The total price is calculated on what our team will be charging to complete the project. The final project will be presented with all physical components including the breadboard it is constructed on. The price for the breadboard is the price at the Penn State bookstore. The LabVIEW software will not be included in the product deliverable or calculated in the final price. The purchaser must own their own registered copy of the software. Our system will work with any computer that has the LabVIEW software installed. The program used to write the C++ code can be found Mbed.org. It is free and therefore it will not be included in the deliverable or the final price. The parts price is listed at $85.13. See Table 1 in appendix C for a list of parts, quantities and prices. Taking into consideration a company paying us $35/ hour per engineering, total cost of labor, and contingency the total price is $2,612.95. See Appendix C for full cost assessment.

Value Statement
This project can be used by anybody wishing to secure their surroundings. The features designed into this project surpass those of other similar products currently available. This system has been made extremely user friendly. The LabVIEW code that was made allows the user to take, save, and compare a picture at the press of a button. The simplicity of this design is also shown in the use of limited resources. Our system was implemented with the use of an mbed, CAN transceiver, two resistors and a LinkSprite SEN-10061 JPEG camera.

The end design was completed using a camera, CAN transceiver, and an mbed microcontroller. A LabVIEW front panel was created to allow the user to take the picture and compare the new picture with a current picture. The design was able to save and update the new picture all behind the scenes and without any effort from the user. The CAN transceiver was able to receive a command from the main mbed microcontroller initializing the picture being taken. Once the picture was taken and saved properly, our mbed microcontroller sent a conformation message to the main mbed microcontroller.

References http://mbed.org/ https://www.sparkfun.com/ http://www.newark.com/


APPENDICES Appendix A: Project Block Diagram

Appendix B: Implementation Diagrams and captures

fig 1. SEN 10061 (Sparkfun.com)

Fig 2. Camera initializing (Sparkfun.com)

Fig 3 image capture and save of JPEG file (Sparkfun.com)

Fig 4: LabView code

Fig 5: User Interface

Fig 6: Integration process diagram Appendix C: Financial Page

Item Description Mbed Microcontroller *Camera Module CAN Transceiver

Part Number Mbed NXP LPC1768 SEN-10061 MCP2551

Price for one $49.00 $34.95 $1.18

Amount Used 1 1 1

Total Price $49.00 $34.95 $1.18

*Current model has been retired and is no longer for sale. This is not current replacement for it but similar models can be bought for roughly the same price.

Total Parts Est. ($)


Cost of Labor Est. Labor ($) Engineering rate: $35/hr



(3 Engineers, 14 hours each) Fringe ($) 15% of Est. Labor Overhead ($) 40% of (Labor + Fringe) Total Labor Est. ($) 220.50 676.20 2,366.7

Contingency ($) 10% of (Parts + Total Labor):


Total Price: