Difference between revisions of "F12: All Your Base are Belong to You"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Design and Implementation)
(Software Design)
 
(27 intermediate revisions by the same user not shown)
Line 161: Line 161:
 
<td>
 
<td>
 
$9.99
 
$9.99
 +
</td>
 +
</tr>
 +
 +
<tr>
 +
<td> <center>
 +
5
 +
</center> </td>
 +
<td>
 +
*LPC2148 Microcontroller
 +
</td>
 +
<td>
 +
$60
 
</td>
 
</td>
 
</tr>
 
</tr>
Line 176: Line 188:
 
<ol>  
 
<ol>  
 
<li>Download latest Raspbian Distribution and Win32DiskImager from RaspberryPi.org[http://www.raspberrypi.org/downloads]</li>
 
<li>Download latest Raspbian Distribution and Win32DiskImager from RaspberryPi.org[http://www.raspberrypi.org/downloads]</li>
<li>Use the Disk Imager to create a bootable SD card of the Distribution</li>
+
<li>Use the Disk Imager to create a bootable SD card of the Distribution[http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/Win32-Disk-Imager.shtml]</li>
 
</ol>
 
</ol>
 +
 +
<h4>Operating System</h4>
 +
Once the OS has been installed onto an SD card with the use of the Disk Imager from a PC, the SD card can go straight into the Raspberry Pi. The first time the Raspberry Pi has been started, it must be plugged into a ethernet cord that has internet access in order to download any necessary files that has not been installed by the image file.
 +
<ul><strong>Raspbian "Wheezy" from RaspberryPi.org</strong>
 +
<li>Debian Linux variant</li>
 +
<li>Made Specifically for the Raspberry Pi</li></ul>
 +
 +
<h4>Wireless Connectivity</h4>
 +
<p>The Raspberry Pi does not have Wi-Fi Capabilities built in, so we used an Edimax EW 71UN nano adapter to give it that functionality. This adapter was chosen because it has the following qualities:
 +
<ul><li>IEEE 802.11 b/g/n capabilities</li>
 +
<li>nano adapter, so it won't stick out</li>
 +
<li>plug and play ability for Raspbian Wheezy Linux distribution</li>
 +
<li>cheap(cost $10 at time of purchase)</li></ul>
 +
</p>
  
 
<h5>Configure Networking</h5>
 
<h5>Configure Networking</h5>
 
<p>In order for the Server to be able to connect with the sensor devices</p>
 
<p>In order for the Server to be able to connect with the sensor devices</p>
 
<ul>
 
<ul>
<li></li>
+
<li>Created a shell script that runs on boot that will sets the ip and essid to an existing network</li>
<li></li></ul>
+
</ul>
 +
 
 +
<h4>LAMP Server</h4>
 +
<ul><strong>Linux, Apach, MySQL, PHP</strong>
 +
<li>Makes Raspberry Pi a Web Server</li>
 +
<li>Hosts WebUI</li></ul>
  
 
<h5>Setting up the LAMP Server</h5>
 
<h5>Setting up the LAMP Server</h5>
Line 197: Line 228:
  
 
<h4>WEB UI</h4>
 
<h4>WEB UI</h4>
<ul>
+
<ul><strong>Gives user control over Security System</strong>
 
<li>Uses Twitter Bootstrap framework</li>
 
<li>Uses Twitter Bootstrap framework</li>
 
<li>Allows User to Activate and Deactivate the Security System</li>
 
<li>Allows User to Activate and Deactivate the Security System</li>
</ul>
+
<li>Uses Bootswatch to make it more visually appealing</li></ul>
  
<h4>Wireless Connectivity</h4>
+
<h4>SSH Tutorial</h4>
<p>The Raspberry Pi does not have Wi-Fi Capabilities built in, so we used an Edimax EW 71UN nano adapter to give it that functionality. This adapter was chosen because it has the following qualities:
+
You can use an SSH from a PC to remotely access the Raspberry Pi to install packages, firmware upgrades, or applications.
<ul><li>IEEE 802.11 b/g/n capabilities</li>
+
*Open up the terminal on the Raspberry Pi
<li>nano adapter, so it won't stick out</li>
+
*Type in ifconfig
<li>plug and play ability for Raspbian Wheezy Linux distribution</li>
+
*Enter the ip address into the putty terminal then click on open
<li>cheap(cost $10 at time of purchase)</li></ul>
+
*The default login is: pi
</p>
+
*The default password is: raspberry
 +
*Once logged in, use any Linux terminal command to remotely access the RPi
  
 
==Design and Implementation==
 
==Design and Implementation==
Line 234: Line 266:
 
The hardware implementation for the project required the use of I2C bus for establishing communication between the temperature sensor and the micro controller. Along with that, wifly modules that would relay the information to the server were interfaced with the LPC board using Uart communication protocol.
 
The hardware implementation for the project required the use of I2C bus for establishing communication between the temperature sensor and the micro controller. Along with that, wifly modules that would relay the information to the server were interfaced with the LPC board using Uart communication protocol.
  
====Sensor====
+
====Thermal Motion Sensor====
 
 
The sensor chosen to measure temperature readings was Melexis MLX90614 IR Temperature sensor. This sensor required an input voltage of 3.6 V.  .This was achieved by pulling up SDA and SCL lines by using 4.7 K resistors. In addition to that a decoupling capacitor with a value of 0.1 uF was interfaced between Vss and GND. Figure 1 shows the complete hardware circuit for the sensor.
 
  
====I2C communication====
+
The sensor chosen to measure temperature readings was Melexis MLX90614 IR Temperature sensor[http://www.melexis.com/Infrared-Thermometer-Sensors/Infrared-Thermometer-Sensors/MLX90614-615.aspx]. This sensor required an input voltage of 3.3 V which is achieved by pulling the 3.3V output from the LPc2148 microcontrollers. In addition to that a decoupling capacitor with a value of 0.1 uF was interfaced between Vss and GND. Figure 1 shows the complete hardware circuit for the sensor.
The IR sensor using a generic I2C communication protocol. I2C communication follows following steps<br />
 
1. Master kicks off communication by sending a 1 bit start condition.<br />
 
2. Master follows it up with by selecting the slave device by sending  slave address over SCL line. <br />
 
3. Following the slave address, a bit indicating where the operation is read or write(1=read, 0= write)<br />
 
4. Slave then sends an ACK bit.<br />
 
5. Master then send the address of the register that need to be either read or written to.<br />
 
6. Slave again sends an ACK bit.<br />
 
8. Data bits are send over SDA line by either master(for write) or by slave(for read). After each 8 bits or 1 packet, slave or master send an ACK depending on write or read respectively.<br />
 
9. Communication is concluded when master device sends the stop bit. <br />
 
  
The pins used for realizing this communication were Pin 0.2 for SCL and P 0.3 for SDA.
+
=====I2C communication=====
 +
The pins used for realizing this communication were Pin 0.2 for SCL and P 0.3 for SDA, which require a 4.7KOhm pull up resistor in order for the communication between SDA and SCL pins to function properly.
  
 
====Wifly Interface====
 
====Wifly Interface====
Line 256: Line 278:
 
===Software Design===
 
===Software Design===
 
The Software Design consisted of:<br />
 
The Software Design consisted of:<br />
1. Raspberry Pi server generates requests over Wifly module.<br />  
+
1. Raspberry Pi server generates requests using a WiFi microUSB adapter over the network.<br />  
2. The request comes in and is stored temporarily on the Web GUI.<br />
+
2. The Web Server on the RPi will transmit the CMD Request to the Wi-Fly device with the corresponding IP Address.<br />  
3. The GUI then send the stored request over the wifly.<br />
+
3. Request is received by the LPC microprocessor which then controls sensor depending on the command received. <br />
4. Request is received by the LPC microprocessor which then controls sensor depending on the command received. <br />
+
4. The GUI then stores the data given by sensor module.<br />
  
[[File:CmpE146_F12_AYB_Software_Block.jpg|100px|thumb|center|Figure 4. Software Block Diagram]]
+
[[File:CmpE146_F12_AYB_RPi_Sensor_Comm.jpg|200px|thumb|center|Figure 4. RPi and Trip Sensor Communication]]
  
====LPC OS====
+
===Software Implementation===
====Raspberry Pi ====
 
<h4>Operating System</h4>
 
  
<ul><strong>Raspbian "Wheezy" from RaspberryPi.org</strong>
+
====Security Trip Function====
<li>Debian Linux variant</li>
+
If the Sensor device is active, the security sensor will allow the data it receives from the MLX90614 Infrared Thermometer to activate the alarm.
<li>Made Specifically for the Raspberry Pi</li></ul>
 
  
<h4>LAMP Server</h4>
+
[[File:CmpE146_F12_AYB_Security_Function.jpg|200px|thumb|center|Figure 5. Security Function Flowchart]]
<ul><strong>Linux, Apach, MySQL, PHP</strong>
 
<li>Makes Raspberry Pi a Web Server</li>
 
<li>Hosts WebUI</li></ul>
 
  
<h4>WEB UI</h4>
 
<ul><strong>Gives user control over Security System</strong>
 
<li>Uses Twitter Bootstrap framework</li>
 
<li>Allows User to Activate and Deactivate the Security System</li>
 
<li>Uses Bootswatch to make it more visually appealing</li></ul>
 
 
===Software Implementation===
 
 
====Command Parsing====
 
====Command Parsing====
 
Upon receiving the request, the command parser decodes the incoming command which is received on the Uart RX line. The commands received manipulates security and alarm as shown in the figure below. Status of the system can send back to the server on the Uart TX line.
 
Upon receiving the request, the command parser decodes the incoming command which is received on the Uart RX line. The commands received manipulates security and alarm as shown in the figure below. Status of the system can send back to the server on the Uart TX line.
  
[[File:CmpE146_F12_AYB_Command_Parser.jpg|200px|thumb|center|Figure 5. Command Parser Decoding]]
+
[[File:CmpE146_F12_AYB_Command_Parser.jpg|200px|thumb|center|Figure 6. Command Parser Decoding]]
  
 
1. If the received byte is 0x61 or character "a", the system is armed and security is enabled.<br />
 
1. If the received byte is 0x61 or character "a", the system is armed and security is enabled.<br />
Line 331: Line 340:
 
*The change in byte value by waving a hand over the sensor will confirm the functionality of the sensor
 
*The change in byte value by waving a hand over the sensor will confirm the functionality of the sensor
  
[[File:CmpE146_F12_AYB_MLX90614 Sensor Test.jpg|200px|thumb|center|Figure 4: Command Parser Test]]
+
[[File:CmpE146_F12_AYB_MLX90614 Sensor Test.jpg|200px|thumb|center|Figure 7: Command Parser Test]]
  
 
====Raspberry Pi Communication Test====
 
====Raspberry Pi Communication Test====
Line 344: Line 353:
 
The slave will be reading all data being transmitted from the website user interface. Once the data is received, the parser function will compare the hex and set global variables or send data depending on the command it has received.
 
The slave will be reading all data being transmitted from the website user interface. Once the data is received, the parser function will compare the hex and set global variables or send data depending on the command it has received.
  
[[File:CmpE146_F12_AYB_Parser Test.jpg|200px|thumb|center|Figure 6. Command Parser Test]]
+
[[File:CmpE146_F12_AYB_Parser Test.jpg|200px|thumb|center|Figure 8. Command Parser Test]]
  
 
====User Interface Communication Test====
 
====User Interface Communication Test====
Line 361: Line 370:
  
 
[[File:CmpE146_F12_AYB_Website UI.png|center|frame]]
 
[[File:CmpE146_F12_AYB_Website UI.png|center|frame]]
<div style="text-align: center;">'''Figure 7:''' Website User Interface </div>
+
<div style="text-align: center;">'''Figure 9:''' Website User Interface </div>
  
 
===Technical Challenges===
 
===Technical Challenges===
Line 379: Line 388:
 
=====Solving the Problem=====
 
=====Solving the Problem=====
 
Once we have determined the problem came from the LPC2148, we decided to re-solder a GND pin and a Voltage Out Pin to ensure that we can capture the full 3.3 Voltage going in and out of the MLX90614 system.
 
Once we have determined the problem came from the LPC2148, we decided to re-solder a GND pin and a Voltage Out Pin to ensure that we can capture the full 3.3 Voltage going in and out of the MLX90614 system.
 +
 +
====UI Communication Problems====
 +
 +
The Javascript functions we created that sent an AJAX request that would trigger communication to the sensor module caused all of the Javascript functions to fail.
 +
 +
=====Determine the Problem=====
 +
There was a mismatch in variable names in the AJAX request, and the PHP request handler. This caused the request to be called, but not finish execution.
 +
 +
=====Solving the Problem=====
 +
By commenting out pieces of the javascript functions, and the PHP handler, adding them little by little, we were able to debug and correct the problem.
  
 
== Conclusion ==
 
== Conclusion ==
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnd from this project. How has this project increased your knowledge?
+
After completing this project, we have learned about the various issues that can come up when completing a Wi-Fi Project. Things such as hardware failures, occurred with our sensor being faulty at first, as well as it's proclivity towards reading inconsistency over a long period of time. We also ran into software errors with our UI, most of which were fixed through rigorous debugging.
 +
 
 +
More importantly, we have learned how expansive the capabilities a micro controller has, with just a few added hardware and software components. Furthermore, we learned that there is a lot of information on a wide range of subjects related to embedded systems out on the internet, if you know the right google search terms.
 +
 
  
 
=== Project Video ===
 
=== Project Video ===
Upload a video of your project and post the link here.
+
[https://www.youtube.com/watch?v=0IEUQU6GAp8[Thermal Motion Sensor Demo]]
 +
*Utilizes Raspberry Pi as Web Server
 +
*Thermal Motion Trip Sensor
 +
*Uses Laptop to access Web Server on RPi
 +
 
 +
[https://www.youtube.com/watch?v=tFXHk1WKBeU[Thermal Motion Sensor + MP3 Alarm Demo]]
 +
*Uses WAMP localhost server on a laptop
 +
*Thermal Motion Trip Sensor
 +
*Mp3 Alarm Device
 +
*Bump Speaker
 +
 
 +
[https://www.youtube.com/watch?v=9bwukeYTyvY[Thermal Motion Sensor + MP3 Alarm First Person View Demo]]
 +
*Uses WAMP localhost server on a laptop
 +
*Thermal Motion Trip Sensor
 +
*Mp3 Alarm Device
 +
*Bump Speaker
  
 
=== Project Source Code ===
 
=== Project Source Code ===
[https://sourceforge.net/p/sjsuf12-aybbty Project source code is available at SourceForge]
+
[http://sourceforge.net/p/sjsuf12-aybabty Project source code is available at SourceForge]
 +
*All code are zipped up in '.rar' files under the Files Tab
  
 
== References ==
 
== References ==
 
=== Acknowledgement ===
 
=== Acknowledgement ===
Any acknowledgement that you may wish to provide can be included here.
+
*Dr. Haluk Özemek
 +
*Preet Kang
  
 
=== References Used ===
 
=== References Used ===
List any references used in project.
+
[1] http://www.raspberrypi.org/downloads <br/>
 +
[2] http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/Win32-Disk-Imager.shtml <br/>
 +
[3] http://www.penguintutor.com/linux/raspberrypi-webserver <br/>
 +
[4] http://www.melexis.com/Infrared-Thermometer-Sensors/Infrared-Thermometer-Sensors/MLX90614-615.aspx <br/>
  
 
=== Appendix ===
 
=== Appendix ===
 
You can list the references you used.
 
You can list the references you used.

Latest revision as of 22:35, 19 December 2012

All Your Base are Belong to You

CmpE146 F12 AYB Raspberry-Pi.jpg

Abstract

The Automated Security system will monitor a home, and trip an if an intruder passes by the sensor by wirelessly sending a signal to the central unit. The system will incorporate several hardware devices, managed by a Web based GUI for easy activation and deactivation of both the alarm and the system

Objects & Introduction

This system will automate your security and home functions for a higher quality of life

Security Thermal Sensor

  • Security Thermal Sensor will capture movement and heat from intruders
  • Security Thermal Sensor will send an alarm signal to the server after the thermal value reaches a certain threshold
  • Alarm Signal from the Security Thermal Sensor will be sent to the server through Wi-Fi communication

Raspberry Pi or Receiving Server (server)

  • Server will receive data from the Security Thermal Sensor
  • Server will receive alarm signal and be set to an alarm state until it is deactivated

Team Members & Responsibilities

  • Christopher Cheng
    • Wi-Fi Hardware and Software Design
  • Tyler Gray
    • Raspberry Pi (server) Research and Web UI
  • Prateek Grover
    • Thermal Motion Sensor Hardware and Software Design

Schedule

Week Number Scheduled Items Actual

1

  • Identify Team
  • Identify Hardware
  • Acquire Hardware
  • Design Security Sensor Wire Diagram
  • Done
  • Done
  • Done
  • Done

2

  • Wire up Security Sensor to the LPC MicroController and read sensor data
  • Have Raspberry Pi Wi-Fi Connectivity
  • Set up communication from MicroController to Hercules using Wi-Fi Module
  • Done
  • Done
  • Done

3

  • Connect Server to Security Sensor Slave Module
  • Create Security Sensor Alarm Protocol
  • Establish Communication Between Raspberry Pi and Microcontroller through Wi-Fi
  • Done
  • Done
  • Done

4

  • Create Basic UI
  • Done

5

  • Integrate UI with the Server
  • Improve UI Functionality
  • Done
  • Done
Week Number Scheduled Items Actual

Parts List and Cost

Item Number Items Cost

1

  • Raspberry Pi

$86.54

2

  • 3x RN-XV WiFly Module - Wire Antenna
  • WRL-10822
  • Total = $104.85
  • Each = $34.95

3

  • Infrared Thermometer - MLX90614
  • SEN-09570

$19.95

4

  • EdiMax EW-781UN

$9.99

5

  • LPC2148 Microcontroller

$60

Item Number Items Cost

Raspberry Pi

Setting up the Raspberry Pi

Setting Up the OS
  1. Download latest Raspbian Distribution and Win32DiskImager from RaspberryPi.org[1]
  2. Use the Disk Imager to create a bootable SD card of the Distribution[2]

Operating System

Once the OS has been installed onto an SD card with the use of the Disk Imager from a PC, the SD card can go straight into the Raspberry Pi. The first time the Raspberry Pi has been started, it must be plugged into a ethernet cord that has internet access in order to download any necessary files that has not been installed by the image file.

    Raspbian "Wheezy" from RaspberryPi.org
  • Debian Linux variant
  • Made Specifically for the Raspberry Pi

Wireless Connectivity

The Raspberry Pi does not have Wi-Fi Capabilities built in, so we used an Edimax EW 71UN nano adapter to give it that functionality. This adapter was chosen because it has the following qualities:

  • IEEE 802.11 b/g/n capabilities
  • nano adapter, so it won't stick out
  • plug and play ability for Raspbian Wheezy Linux distribution
  • cheap(cost $10 at time of purchase)

Configure Networking

In order for the Server to be able to connect with the sensor devices

  • Created a shell script that runs on boot that will sets the ip and essid to an existing network

LAMP Server

    Linux, Apach, MySQL, PHP
  • Makes Raspberry Pi a Web Server
  • Hosts WebUI
Setting up the LAMP Server

With the Raspberry Pi OS set up, a few command line instructions were executed on the Pi to set it up as a Web Server. the following steps were taken from Penguin Tutor[3](an internet connection is necessary to install the LAMP elements):

  1. Update Repositories: sudo apt-get update
  2. Install Apache: sudo apt-get install apache2
  3. Install MySQL(needs password setup as part of the process): sudo apt-get install mysql-server
  4. Install PHP: sudo apt-get install php5
    sudo apt-get install php5-mysql

WEB UI

    Gives user control over Security System
  • Uses Twitter Bootstrap framework
  • Allows User to Activate and Deactivate the Security System
  • Uses Bootswatch to make it more visually appealing

SSH Tutorial

You can use an SSH from a PC to remotely access the Raspberry Pi to install packages, firmware upgrades, or applications.

  • Open up the terminal on the Raspberry Pi
  • Type in ifconfig
  • Enter the ip address into the putty terminal then click on open
  • The default login is: pi
  • The default password is: raspberry
  • Once logged in, use any Linux terminal command to remotely access the RPi

Design and Implementation

Hardware Design

CmpE146 F12 AYB TMSensorHW Diagram.png
Figure 1: Hardware design for I2C Ir Thermal Motion Sensor and UART Wifly


CmpE146 F12 AYB PIRThermalMotionSensor.jpeg
Figure 2: Implementation of Sensor/Wifly Design


CmpE146 F12 AYB RaspberryPiHW.jpg
Figure 3: Raspberry Pi Hardware

Hardware Implementation

The hardware implementation for the project required the use of I2C bus for establishing communication between the temperature sensor and the micro controller. Along with that, wifly modules that would relay the information to the server were interfaced with the LPC board using Uart communication protocol.

Thermal Motion Sensor

The sensor chosen to measure temperature readings was Melexis MLX90614 IR Temperature sensor[4]. This sensor required an input voltage of 3.3 V which is achieved by pulling the 3.3V output from the LPc2148 microcontrollers. In addition to that a decoupling capacitor with a value of 0.1 uF was interfaced between Vss and GND. Figure 1 shows the complete hardware circuit for the sensor.

I2C communication

The pins used for realizing this communication were Pin 0.2 for SCL and P 0.3 for SDA, which require a 4.7KOhm pull up resistor in order for the communication between SDA and SCL pins to function properly.

Wifly Interface

Wifly was interfaced over Uart line requiring two pins:Pin 0.8 TX for transmission and Pin 0.9 RX to receive data. A driver was Uart was already on hand(Uart 0) but it had to be modified to get Uart 1 since Uart 0 was already used by USB port.

Software Design

The Software Design consisted of:
1. Raspberry Pi server generates requests using a WiFi microUSB adapter over the network.
2. The Web Server on the RPi will transmit the CMD Request to the Wi-Fly device with the corresponding IP Address.
3. Request is received by the LPC microprocessor which then controls sensor depending on the command received.
4. The GUI then stores the data given by sensor module.

Figure 4. RPi and Trip Sensor Communication

Software Implementation

Security Trip Function

If the Sensor device is active, the security sensor will allow the data it receives from the MLX90614 Infrared Thermometer to activate the alarm.

Figure 5. Security Function Flowchart

Command Parsing

Upon receiving the request, the command parser decodes the incoming command which is received on the Uart RX line. The commands received manipulates security and alarm as shown in the figure below. Status of the system can send back to the server on the Uart TX line.

Figure 6. Command Parser Decoding

1. If the received byte is 0x61 or character "a", the system is armed and security is enabled.
2. If the received byte is 0x62 or character "b", the system is disarmed and security is disabled.
3. If the received byte is 0x63 or character "c", this means the sensor has crossed the threshold value and alarm gets enabled.
4. If the received byte is 0x64 or character "d", alarm gets disabled. It is used when the user wants to put the system out of alarm state.
5. Command "e" grabs the current alarm state status and send it to server: 1 for ON state , and 0 for OFF state.
6. Byte "f", send the current sensor value to the server.

CParse(Command, enable, alarm)
{
If (Command=0x61) // a
  Enable Security
Else If (Command=0x62) // b
  Clear Alarm bit
  Disable Alarm
  Disable Security
Else If (Command=0x63) // c
  Set Alarm bit
  Enable Alarm
Else If (Command=0x64) // d
  Clear Alarm bit
  Disable Alarm
Else if (Command=0x65)//e
  If Alarm is set
     Send 1
  Else 
     Send 0
Else if (Command=0x66)//f
  data = I2cRead
  Send data to server

}


Testing and Technical Challenges

Testing

All the testing of the All Your Base are Belong to You Home automation and security system will be described in this section.

Testing Data of MLX90614 Thermal Sensor

First we must determine that we are gathering all 3 bytes gathered from the I2C read function, and ensure that it can be usable data for a security system. Then determine the distance of the Thermal sensor for the possible use as a motion sensor.

  • The change in byte value by waving a hand over the sensor will confirm the functionality of the sensor
Figure 7: Command Parser Test

Raspberry Pi Communication Test

For the Raspberry Pi, we will use a Linux OS and download a telnet software that is usable by the terminal program.

  • First set up a Ad-hoc connection between the Raspberry Pi and the Motion Sensor Module
  • Use telnet on a linux terminal to directly connect to the motion sensor module's IP and port for a direct communication
  • Using hercules and the linux terminal, type in messages and hit enter on either hercules or the linux terminal to send a message
    • Hercules should send a message to the Linux Terminal
    • The Linux Terminal should send a message to the Hercules terminal
Testing the Slave Command Parser Function

The slave will be reading all data being transmitted from the website user interface. Once the data is received, the parser function will compare the hex and set global variables or send data depending on the command it has received.

Figure 8. Command Parser Test

User Interface Communication Test

With the use of a User interface to control the Motion Sensor, we will be using socket programming embedded in a website. The website will act as a user interface to enable to disable the device.

  • Enable Button is pressed
    • The sensor will be armed
      • When the sensor is armed, the sensor can go into an alarmed state if there is motion
  • Disable Button is pressed
    • The sensor will be disabled
      • Nothing will happen, even is there is motion
  • Panic Button is pressed
    • When the sensor is enabled, the sensor will be put into an alarm state and turn on an LED
    • When the sensor is disabled, nothing will happen
CmpE146 F12 AYB Website UI.png
Figure 9: Website User Interface

Technical Challenges

In this section, we will describe all the technical challenges that we ran into while building and testing this project.

Infrared Thermometer MLX90614

The sensor would not output data therefore the testing of the network connections between the motion sensor module and the raspberry pi could not be tested.

  • Could not continue the utilization of the design and could not test and verify the usability of the MLX90614 Thermal Sensor as a motion sensor.
Determine the Problem

The wrong voltage was being passed into the MLX90614 was determined with the use of a multimeter.

  • Requires around 3.3V but was getting voltage under 1V
  • While minimum pressure was applied to the GND and V_out pins on the LPC2148 microcontroller, the correct voltage was being sent into the MLX90614.
    • We have determined that the problem was with the LPC2148, the pins were not correctly soldered
Solving the Problem

Once we have determined the problem came from the LPC2148, we decided to re-solder a GND pin and a Voltage Out Pin to ensure that we can capture the full 3.3 Voltage going in and out of the MLX90614 system.

UI Communication Problems

The Javascript functions we created that sent an AJAX request that would trigger communication to the sensor module caused all of the Javascript functions to fail.

Determine the Problem

There was a mismatch in variable names in the AJAX request, and the PHP request handler. This caused the request to be called, but not finish execution.

Solving the Problem

By commenting out pieces of the javascript functions, and the PHP handler, adding them little by little, we were able to debug and correct the problem.

Conclusion

After completing this project, we have learned about the various issues that can come up when completing a Wi-Fi Project. Things such as hardware failures, occurred with our sensor being faulty at first, as well as it's proclivity towards reading inconsistency over a long period of time. We also ran into software errors with our UI, most of which were fixed through rigorous debugging.

More importantly, we have learned how expansive the capabilities a micro controller has, with just a few added hardware and software components. Furthermore, we learned that there is a lot of information on a wide range of subjects related to embedded systems out on the internet, if you know the right google search terms.


Project Video

[Thermal Motion Sensor Demo]

  • Utilizes Raspberry Pi as Web Server
  • Thermal Motion Trip Sensor
  • Uses Laptop to access Web Server on RPi

[Thermal Motion Sensor + MP3 Alarm Demo]

  • Uses WAMP localhost server on a laptop
  • Thermal Motion Trip Sensor
  • Mp3 Alarm Device
  • Bump Speaker

[Thermal Motion Sensor + MP3 Alarm First Person View Demo]

  • Uses WAMP localhost server on a laptop
  • Thermal Motion Trip Sensor
  • Mp3 Alarm Device
  • Bump Speaker

Project Source Code

Project source code is available at SourceForge

  • All code are zipped up in '.rar' files under the Files Tab

References

Acknowledgement

  • Dr. Haluk Özemek
  • Preet Kang

References Used

[1] http://www.raspberrypi.org/downloads
[2] http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/Win32-Disk-Imager.shtml
[3] http://www.penguintutor.com/linux/raspberrypi-webserver
[4] http://www.melexis.com/Infrared-Thermometer-Sensors/Infrared-Thermometer-Sensors/MLX90614-615.aspx

Appendix

You can list the references you used.