Keiichi Onishi

MAS.863 How to Make (Almost) Anything

Final Project: Laptop thief prevention device

Issue

I prefer to study and work in public space such as cafeteria, Starbucks etc. Of course I sometimes wanna go grab coffee or go to rest room leaving my laptop. What I usually do is asking random person around me to take a look for a while my laptop. But I don't feel it's that secure and would like to sense that I can monitor my laptop status in some way.

What I'm going to make/actually I made

Original Plan

I'm going to make a bluetooth connected small box with accelerometer and LED lights that can give sort of alert to potential laptop theif. You put the box on our laptop, and if someone tries to move your laptop, the box can send notification to my phone.

Actual result

I build circuit board and exterior as I planned, but I gave up building one big feature, which is sending x and y axis acceleration values from the circuit board to Android phone with bluetooth due to time constraint and knowledge constraint. Instead of using Android App as GUI, I used laptop GUI coding by python referring Neil's sample program.

So what my device can do? My product can detect 2 axis acceleration and sends those data from circuit board to laptop with Bluetooth, lighiting up three LEDs attached to exterior. Laptop receives those data, shows acceleration values in GUI, and gives user notification when the device detects abnormal acceleration. Primary purpose of my device is preventing laptop thief so sending signals to laptop doesn't make any sense, but building Android App from a scratch within 2 days was quite challenging experience for me. I will continue to work on this after semester end to complete my project.

  • What: Laptop thief prevention device with Android App
  • Material: Please refer BOM in this page
  • Design tool: SolidWorks; Eagle; Arduino IDE; Android Studio
  • Machining tool: Laser cutter

Step 1: Determing high level function and specifications

I started this project with defining functionality, how this product would perform. Below is the general functionality and specifications.

Basic Functionality of the product

- Small plane and neat-looking device with red LEDs

- Send notification (vibration and sound) to a smartphone when accelerometer senses abnormal acceleration when the laptop is about to be stolen

Specification

Input device

- accelerometer (MEMSIC MXD6235M 2-axis accelerometer)

Output device

- 3 arrays of red LED light (For notification of the device is ON/OFF)

Network/Communication protocol

- Bluetooth module (HC-05 module)

Android App

- Activating Bluetooth

- Getting notification from the device and give popup window notification, sound and vibration to user

Exterior

- 3D-printed white color case

- Size: 25mm*50mm*100mm

- Have window for switch

- Have window for LEDs

- LEDs should be covered

- Marked "MAS863.14 How to Make (Almost) Anything," and "MIT Sloan logo."

Power source

- Battery (9V)

Here is a BOM for this product. All materials were basically available at IDC.

Material Vendor Q'ty Cost
5mm plywood (2x4) Homedepo 10cmx20cm $5.80
9V battery IDC 1 $7
HC-05 IDC(JBtek) 1 $9
MXD6235MP IDC(MEMSIC) 1 $4.49
Attiny44 IDC 1 $1.52
LED(red) IDC 3 -
2x3 header IDC 1 -
2x2 header IDC 3 -
FTDI header IDC 1 -
100mA 3.3 V regulator IDC 1 -
0Ω registor IDC 4 -
10KΩ registor IDC 1 -
499Ω registor IDC 2 -
10μF capacitor IDC 1 -
$27.66

Step 2: Designing circuit boards

I designed total three boards - main circuit board with Attiny44 and 2 axis accelerometer, sub circuit board for mechanical switch, and sub three boards for LEDs. By utilizing knowledges you learn from series of electronics design and production, you should be able to design above circuit boards pretty comfortably. The most important part when you use accelerometer and bluetooth module is figuring out appropriate pin assignment reading datasheets of those and Attiny. Talking about bluetooth, you have to make sure you connect Rx and Tx pins of bluetooth module to TX and RX pins of Attiny. Also MXD6235M was not in the Eagle Library, I learned how to design and add new parts to the library from this tutorial.

Final 02 Final 03 Final 04

Step 3: Designing exterior

To build working prototype as soon as possible, I decided to build a simple box as exterior. I designed it using SolidWorks and saved a 2D drawing which contains all components as DXF file to allow CorelCAD to read the file. I also wanted to put MIT logo on the top of my product so I downloaded a png file and converted it into DXF file using Inkscape. This tutorial would help you to learn how to do that.

Final 05

Step 4: Fabricating circuit boards

As experiencing several iteration of circuit board fabrications, this process went smooth as well. Neil sometimes mentioned that "design and make new PCBs rather than using those you made during previous assignment," which is so true. Through several iterations you could learn how to solder beautifully and quickly, and most importantly would spend less time on debugging circuit boards due to stupid mistakes. After I build PCBs, I checked connection using multimeter and they looked all good.

Final 06

Step 5: Fabricating a case

I cut plywood with laser cutting machine in IDC. After cleaning up a lense of laser cutter, I turned on air compressor and laser cutter. I opened 2D components drawing saved in DXF file type in milimeter (I designed the model in units of milimeter), imported MIT logo and arrange it on one of the component, and defined all line as hairline. When you do printer setting, open preference and make sure you load appropriate setting from "advance" tab. I chose 6mm plywood sheet for my 5mm plywood sheet, which works perfectly for that. I assembled all components and got a box.

Final 07 Final 08 Final 09

Step 6: Programming Attiny44

This is one of the moments of highlight I struggled with. I used Arduino IDE to program the Attiny44 for the first place to use SoftwareSerial. I found Arduino libraries consumed so much memory storage that I couldn't use float or double for variables that were voltage values an accelerometer sends out. I ended up using int variables without casting values into float just using analogRead() function. Even if I used only two integer variables with SoftwareSerial, my Arduino sketch reached to 3800 bytes.

After I powered on the circuit board and connected to my Mac, I found I got only value of 0 or 1023 from the circuit board with bluetooth module, monitoring them at Terminal. This happened because of specification of the accelerometer's output signals. MXD6235M provides two digital outputs that are set to 50% duty cycle at zero g acceleration. The outputs are digital with duty cycles (ratio of pulse width to period) that are proportional to acceleration. This means we need to compute magnitude of accerelation from frequency of HIGH/LOW state switching per unit time. As I mentioned, I had have already realized that 4K internal memory of Attiny44 was not enough to add additional variables and functions. So my only option is programming the microcontroller using C with minimum required libraries and basic functions. I went back to lecture about Input devices, and looked at Neil's sample code. I modified the program and programmed Attiny to send some computed values from the pulse outputs, and turned on three LEDs while the device is on. Surprisingly the program only consumed 596 bytes!! I succefully got magnitude of acceleration using python code to monitor them on my Mac.

Final 10 Final 11 Final 12

Here is a code I used for Attiny44 programming, modifiying sample code

Step 7: Programming Android App: Failed, then triage...sigh

This step is the most challenging part for me. For the week of Network and Application, I created the very best my first mobile App that can turn on/off a LED light on circuit board with bluetooth serial communication. I thought I got familiar with Android App development as a beginner, so I tried to create App that can receive bytes from my circuit board. As I did two weeks ago, I used Android Studio, which is official Android IDE. You can download the package from here. I referred python code for pulse output monitoring that I mentioned above, but had challenges on how to receive bytes and find framing. Due to my lack of knowledge about Serial communication and Java programming, eventually I couldn't debug my code, and I gave up to create it in a given time frame for final presentaiton. I will leave this to my IAP project.

Final 13 Final 14

Step 8: Programming GUI on laptop by python

Instead of creating Android App, I decided to code monitoring GUI for laptop trying to realize what I wanted to do on Android phones. Main feature I wanted to realize was giving notification to a user when my device detect abnormal acceleration. What the GUI program needs to do are 1) getting bytes from the circuit board with Bluetooth Serial communication, 2) computing absolute value of acceleration, and 3) giving popup notification to user if the value exceeds threshold. By modifying Neil's sample python code, I achieved #1 quite easily, and computed delta of absolute value of acceleration. #3 was achieved by using tkMessageBox.

Here is GUI code.

Step 9: Assembly

After I completed all development including hardware, electronics, input and output device, network, and application, I assmebled all into one system. Bringing all componets into one was an exciting experience. One thing I forgot to think about was open/close mechanical structure of the case. I couldn't quite close the case due to no locking mechanism. I need to redesign it for the future.

Final 15 Final 16 Final 17 Final 18 Final 19 Final 20

Step 10: Test

I tested the device and it worked properly! I put my device on a laptop and connected to another laptop with bluetooth running python-coded GUI. When I try to remove the laptop, the device senses the movement and successfuly send the information to the laptop and provides notification to me. I would say the system worked well in terms of its function.

What I could do better are 1) adding physical or software switch to turn on/off the device because once I hook up battery to circuit board it would keep consuming electricity, 2) creating Android App sticking to original plan and use case!, 3) making the device smaller, and 4) setting appropriate threshold to detect acceleration of the device eliminating noises. These four items would be definitely my IAP project.

Final 21 Final 22 Final 23 Final 24