Difference between revisions of "F15: Laser Security System"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Hardware Interface)
(Hardware Design)
Line 272: Line 272:
  
 
[[File:CMPE146_F15_LaserSecuritySystem_bluetooth2schematics.jpeg|600px|thumb|centre|Figure 8. Second SJSU One Board connected to Bluetooth module circuit schematics]]
 
[[File:CMPE146_F15_LaserSecuritySystem_bluetooth2schematics.jpeg|600px|thumb|centre|Figure 8. Second SJSU One Board connected to Bluetooth module circuit schematics]]
 +
 +
 +
[[File:CMPE146_F15_LaserSecuritySystem_secondcircuitInterface.jpeg|600px|thumb|centre|Figure 9. Second SJSU One Board connected to Bluetooth module, cellular shield, and Arduino board schematics]]
  
 
=== Hardware Interface ===
 
=== Hardware Interface ===

Revision as of 17:16, 17 December 2015

Laser Security System

Final hardware design for master board
Final hardware design for second microcontroller, bluetooth module, cellular shield and Arduino board

Abstract

The Laser Security System allows to maintain security in a room as an example by shining a laser across a door's entrance to a photo-resistor inside a box and alerting via bluetooth communication by sending a text message to a smart phone that security has been compromised.

Objectives & Introduction

This security system will be using GPIO pins from the SJSUOne Board to connect to the RN42-XV Bluetooth Module using serial communication and another pin to the Arduino. The two bluetooth modules each connected to a SJSUOne Board will communicate with each other sending a message via text message using the Arduino module alerting that security has been compromised.

Objectives for this project:

  • Research and design the schematics to connect a light detection circuit to one of the SJSUOne Board and showing the output by lighting an LED
  • Research bluetooth communication and implement it to the light detection circuit
  • Complete hardware design
  • Test functionality of the system
  • Able to send and receive text messages to smart phone via bluetooth
  • Detect and connect to other bluetooth devices


Team Members & Responsibilities

Emmanuel Gonzalez: Software Implementation and Report Writer

Irlanda Altamirano: Hardware Implementation and Report Writer

Schedule

Week# Date Planned Task Actual
1 10/12-10/18

• Project Approval

• Project Research

• Purchase all required parts

• Project Research

2 10/19-10/25

• Build Schematics

• Order all parts

• Test individual components

• Schematics for the overall system is done

• Order all parts

3 10/26-11/1

• Begin hardware design interfacing a laser, photo-resistor and SJ One Board

• Test the hardware design

• Hardware design implementation started

4 11/2-11/8

• Trouble shoot hardware design with

• Test the hardware as a whole

• Hardware design implementation interfacing a laser, photo-resistor and SJ One Board completed

5 11/9-11/15

• Research about Bluetooth communication

• Build Bluetooth circuit

• Test the hardware design

• Starting software interfacing previous hardware implementation

• Read data sheet for Bluetooth communication

6 11/16-11/22

• Interface Bluetooth communication with SJ One Board

• Test the complete hardware interface

• Order another board for Bluetooth communication

• Research more about Bluetooth communication

7 11/23-11/29

• Test Bluetooth communication with SJ One Board

• Hardware design implementation interfacing a laser, photo-resistor, bluetooth communication and SJ One Board started

8 11/30-12/6

• Complete the software interfaces for laser, SJ One Board and Bluetooth communication

• Implement text message feature with Bluetooth communication

• Debugging bluetooth communication interface

9 12/7-12/13

• Finish Debugging text message communication feature

• Start writing project report

• Test system design

• Started implementing SMS feature with bluetooth communication

• Continued the project report

10 12/14-12/16

• Complete system testing

• Finish project report

• Debugging SMS/ bluetooth communication

• Completed system testing

• Created video for presentation

• Finish project report

11 12/17

• Demo Project on Thursday, December 17, 2015

• Demo Project completed

Parts List & Cost

Quantity Item Cost
2 SJ One Board $80.00
1 Quad-band Cellular Duck Antenna SMA $7.95
2 RN42-XV Bluetooth Module - PCB Antenna $24.95
1 Mini Photocell $1.50
1 SparkFun Cellular Shield - MG2639 $69.95
1 Arduino Uno R3 $24.95
1 LED $0.10
1 Resistors 8.2K, 2.7K and 1K ohms $0.20

Design & Implementation

The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.

Hardware Design

Figures 1-5 show the modules need it for this project as listed in the Parts list. The security system is design by creating two circuits to be. Figure 7 is the first circuit that includes the master SJSU One Board and is connected to a bluetooth module by using UART communication. These two modules are connected to a transistor that detects when the current is low or high and the photocell that is used for laser sensing. When there is light or the laser shining to the photocell then it is of high resistance meaning that the LED connected to the microcontroller will turn on. When the laser has been interrupted and is not hitting the photocell then this produces low resistance, more current and the LED output from the microcontroller will turn off, then the bluetooth module will get notified through UART communication and will send the information to the other bluetooth module from the second circuit. The second circuit showing in Figure 8 shows the SJSU board #2 again connected to another bluetooth module to receive information when the laser has been interrupted. The One board #2 connects to the Arduino and communicate through GPIO. When the Arduino gets an input from board #2 it then by commands uses the cellular shield to send a text message.


Figure 1. SJSU One Board


Figure 2. Bluetooth Module


Figure 3. Cellular Antenna


Figure 4. Cellular Shield


Figure 5. Arduino Uno R3


Figure 6. System Block Diagram


Figure 7. Master SJSU One Board and Bluetooth schematics with light sensor circuit


Figure 8. Second SJSU One Board connected to Bluetooth module circuit schematics


Figure 9. Second SJSU One Board connected to Bluetooth module, cellular shield, and Arduino board schematics

Hardware Interface

To sync our the devices and connected them via bluetooth we used an app called "AT command" from the Android store which can be downloaded for free. First we make sure our circuits are powered on. Then we open the App and scan near by bluetooth devices. Then we connect to the master SJSU board thru bluetooth communication. Then we typed in5 to search for the bluetooth module #2. After in searches for 5 seconds then we connect to the second module by typing a c character and click ok. After we connect to the second board, this will be fully operational sending a text message when detecting the laser has been interfere with or not.

Implementation

The first step was to initialize the GPIO pins for the laser detection. Then we initialized the micro controller for UART communication. We Created to one function for the master to transmit and another for the slave to receive. Within our run function for the master, we are continuously checking if the light has been block. If the light is block the master will transmit data to the slave via Bluetooth. Note that the Bluetooth devices need to be initialized using AT commands, one Bluetooth device needs to be set to master so it can transmit to the other. Once the Bluetooth's are initialized, the master will search for any nearby devices it can communicate. once we see our slave Bluetooth device we need to record its name in the master Bluetooth device so it can easily pair with the device next time we setup communication. Once the Slave receives data that the laser has been trip, the slave will the communicate with the Arduino one board. The Arduino board initializes the cellular shield and provides power to the board. If the Arduino receives the signal from the slave micro controller, the Arduino will sent commands to the cellular shield. cellular shield will then to send a text message to the prefined phone number. If the Arduino does not receive the signal from the slave micro controller, it will stay idle until it is triggered by the slave micro controller.

Testing & Technical Challenges

The following difficulties were encounter during this project but were able to successfully overcome them to delivery a functional project. Most of the time spent in this project was testing and debugging our program.

My Issue #1

At the beginning of the project we encounter some problems since we never had worked with bluetooth communication and interfacing it with laser detection circuit and between two microcontrollers. This was challenging but not impossible to solve this problem so from our part we conducted a lot of research before even building the first circuit in this project which was the light detection sensor circuit. One way to solve this problem was to break our project into 3 parts and make sure the first part of the project was performing its functionality before moving into the other part of the project.

My Issue #2

Another of the problems we encounter in this project was that a pin in the cellular shield was not giving enough power for two boards when trying to incorporate text messaging. To solve this problem we connected an external power supply to the Arduino board and connected the voltage pin to the SJSU one board and the cellular shield board.

My Issue #3

Sending a text message to a smart phone via bluetooth was challenging especially when trying to incorporate AT commands since we had not learn much about them. More research was done but we were running out of time in trying to debug the code and to not sacrifice the functionality of the device we decided to incorporated the Arduino board.

Conclusion

After overcoming the problems associated with this project and a lot of software debugging was performed we were able to successfully complete this project. Through out this project we learn about how to implement bluetooth communication between two microcontrollers from the hardware and software side. Understanding data sheets for the devices and obtaining the information needed to implemented such as bluetooth module, Arduino board, SJSO one board and cellular shield was crucial in order to obtain a successful outcome and functionality of the security system.

Project Video

Project Demo: https://youtu.be/Z2P5bmgPy7c

Project Source Code

References

Acknowledgement

We would like to thank the following people for their contributions and support during this project:

Preetpal Kang and Dr. Haluk Ozemek

References Used

Appendix

Bluetooth Module

https://www.sparkfun.com/products/11601

LPC1759 Datasheet

http://www.nxp.com/documents/data_sheet/LPC1759_58_56_54_52_51.pdf

LPC176x/5x User manual

http://www.nxp.com/documents/user_manual/UM10360.pdf

RN42XV Bluetooth Module

http://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/RN42XV.pdf

General Purpose Transistor

file:///Users/Irlanda/Downloads/410427.pdf