Our Original Idea
After learning that someone took equipment from our class cart without our instructor’s permission we decided to prevent this from happening again. Our solution was to create an alarm system that will tell our professor when someone has taken something from our class equipment without his permission. We imagined that we could do this by sending an email to our professor with the picture of the person who’s stolen our equipment. In addition to that, we would discourage anyone to steal from our class cart by uploading a picture of the people who have stolen from us to a public website. We dubbed this website the “Hall of Shame”.
Our Final Product
I guess we have accomplished everything we wanted. As for now, we have a fully set-up system that detects intruders. So, let me explain how our project works. Essentially, we built a light sensor circuit, the light sensor is in the state of constant darkness. If an intruder opens the box or the cart, the light sensor gets exposed to the light and this mechanism triggers several things: first, a picture of the intruder is being taken, it is being sent to Scott’s email, it is being uploaded to the website called “Hall of Shame” (publicly available at here) which stores all the photos of all intruders. Moreover, we also set up an RFID system and assigned a particular RFID tag to Scott. Basically, if Scott is the one who opens the cart then there is no need to send an email and post the photo to the website, hence, Scott can swipe his own tag which will cancel the email sending and posting pictures to the blog. However, you have to hold the tag for 10 seconds in order to cancel the email.
The source code is available at https://github.com/ElaineAng/Final-Project-Net. Email us if you have access issues.
Here are two short videos recording how we expect it to work:
Here is a screenshot of some of our “Intruders” appearing in the email attachment.
First, the RFID tag would not work all the time. It took us may days to figure out why the RFID system stopped working even though none of the code had been changed. Once we figured it out, we had to connect the RFID tag system to the main processing code via Bluetooth. There was no major hindrance with that. It was just the matter of time. However, we lost the initial tag that had been assigned to Scott, so we had to replace it with another and go through the whole setup process again. Thanks to the amazing Arduino Atmega board that provides multiple serial communication interfaces, we are able to receive information from the RFID reader and send information to the processing sketch via bluetooth using one board.
Setting up the email system was also a challenge for us. At first, we tried using Temboo to send e-mails. Although we could successfully send emails with Temboo and Processing, we weren’t able to send picture attachments as it asked us for a URL and couldn’t attach pictures that were stored locally. Our second attempt at fixing this issue was to use Processing with the Javax mail library. However, this didn’t work out as the library is deprecated and the example code dated from 2007. Finally, we used Node and Processing to solve this issue. We basically ran a local server that runs an email script every time someone tries to access a specific page. Processing becomes the client by making a GET request to the page that triggers the Nodemailer script to send an email with a picture attached to it.
Posting the image to a website after it’s being taken is a bit challenge as well. Since we need to arrange for the processing sketch to post the picture in real time, and it was a new experience for each of us. We did not find any suitable APIs or image hosting sites that does this for us, so we decided to write our own script. We find two open source php script that does similar things and put them on a web server, which is configured to be accessed via a domain name. The index.php scripts handles reading a directory and displaying the image, the upload-n-save.php scripts handles image posting and saving them locally on the server.
What we would want to change
The only change we would want to implement is to upgrade the way we use external cameras (e.g. use an external web-cam or using a serial camera attached to a Raspberry Pi) to increase the quality of the photos taken because sometimes the embedded web-cam would take pictures of humans parts’ of the body or the box. This would improve the content of the website as well as help Scott to identify the intruders and punish them. I guess this is the only change that would make a difference.