Issuu on Google+

Get Off Your Phone!

Andrew Viny Advisor Mark Gross Skill Swapping Studio 2012


Table of Contents Project

Abstract How it works

Code

Android Application Arduino Sketch

Hardware

Arduino Uno Sparkfun Bluetooth Mate Silver Seeeduino Film Seeeduino Film Bluetooth Frame Tri-Color LED

Fabrication 3D Printing Casting


Project

Abstract

Abstract

This project was born out of a personal need to detach myself from my technology. Checking emails, messages, and facebook notifications were so common place in my life that the physi cal act of reaching for my phone and unlocking the screen had become a subconscious ritual. I realized that if I could see some sort of visual indication of how much I was using my phone when I began this ritual I could correct my behavior. The principal is simple. If people are made aware of a behavior they can correct it.

In her TED talk Connected, but alone? Sherry Turkle speaks about how being more connected is begining to make us less social. She suggests that while emailing, texting, and social networks used to help us main tain and grow relationships, they now have become so deeply ingrained in our daily lives that they become a crutch. These connections are seductive because they allow us to carefuly control the interactions we have with the various people in our lives replacing real world interaction with virtual interaction and making us less social.


Project

How it works

How it works

An application on on your phone tracks your usage of “social� applications. When you use these applications, points are sent over bluetooth to the bracelet. As the point score increases the bracelet changes color from green to red indicating hightened levels of use. Over time the point score decreases. If the person wearing the bracelet does not over use their phone the bracelet will remain green.

Phone sends message to bracelet on use

When the bracelet is powered on and paired it lights up green

Bracelet off

With use the bracelet’s color gradually changes from green to red Initial on state

With lowered usage the color gradually changes back to green

High usage state

Positive usage restored


Code Android Application

Setting up your computer Bluetooth Screen Detection Debugging

Arduino Sketch

Bluetooth (Code for Arduino and Seeeduino Film) LED


Code

Android Application

Setting up your computer Get the Eclipse IDE www.eclipse.org/downloads Get the ADT Plug-in for Eclipse and the Android SDK developer.android.com/sdk/installing.html


Code

Android Application

Bluetooth

Android Manifest XML

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="bracelet.com.code" android:versionCode="1" android:versionName="1.0" > <uses-permission android:name="android.permission.BLUETOOTH" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".BraceletActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> </manifest>

The lines in red must be added to the androidmanifest.XML file These lines give your application permission to access the bluetooth module.


Code

Android Application

Bluetooth

Bracelet Class

package bracelet.com.code; import import import import import

java.io.IOException; java.io.InputStream; java.io.OutputStream; java.util.Set; java.util.UUID;

import import import import import import

android.app.Activity; android.bluetooth.BluetoothAdapter; android.bluetooth.BluetoothDevice; android.bluetooth.BluetoothSocket; android.content.SharedPreferences; android.os.Bundle;

public class BraceletActivity extends Activity {

private BluetoothSocket mSocket; private BluetoothDevice mDevice; private BluetoothAdapter mAdapter;

private InputStream mInput; private OutputStream mOutput; protected static final String PREFS_FILE = “device_id.xml”; protected static final String PREFS_DEVICE_ID = “device_id”;

private static UUID MY_UUID;

@Override public void onCreate(Bundle savedInstanceState) { System.out.println(“CREATION!”); super.onCreate(savedInstanceState); setContentView(R.layout.main); final SharedPreferences prefs = this.getSharedPreferences( PREFS_FILE, 0); final String id = prefs.getString(PREFS_DEVICE_ID, null ); MY_UUID = UUID.fromString(“00001101-0000-1000-8000-00805F9B34FB”); System.out.println(“ENABLING ADAPTER”); mAdapter = BluetoothAdapter.getDefaultAdapter(); enableBluetoothAdapter(); if (findPairedAndroidDevice(“SeeeduinoBluetooth”)) { System.out.println(“FOUND PAIRING”); socketConnect(); }else System.out.println(“NO PAIR FOUND”); } public void enableBluetoothAdapter() { mAdapter.enable(); }

This code will search for and connect to a specific bluetooth device when your application is launched. This device must already be paired for the automatic connection to work. The code in green can be used to help trouble shoot using logcat. The red code is the name of your bluetooth device you are trying to pair with.


Code

Android Application

Bluetooth

Bracelet Class continued

public boolean findPairedAndroidDevice(String str) { Set<BluetoothDevice> pairedDevices = mAdapter.getBondedDevices(); if (pairedDevices.size() > 0) { for (BluetoothDevice device : pairedDevices) { if (device.getName().toString().equals(str)) { mAdapter.cancelDiscovery(); mDevice = device; return true; } } return false; } else return false; } public boolean socketConnect() { int trytimes = 4; boolean connected = false; for (int i = 0; i < trytimes && !connected; i++) { try { connected = true; mSocket = mDevice.createRfcommSocketToServiceRecord(MY_UUID); mSocket.connect(); } catch (IOException e) { System.out.println(“ERRORRRRRRRRR!”); connected = false; } } if (connected) { try { mInput = mSocket.getInputStream(); mOutput = mSocket.getOutputStream(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return connected; } private void sendSomething(int toSend){ try { mOutput.write(toSend); System.out.println(“Sending!”); } catch (Exception e) { e.printStackTrace(); } } }

The OnCreate method is called when the app is first launched and therefor all setup code for your application goes in this method. After we do our set up we call three methods to create our bluetooth adapter, find our paired device, connect to the bluetooth socket we made in the OnCreate method, and create a method to send information to our paired and connected device.


Code

Android Application

Screen Detection

Bracelet Class

boolean isScreenOn = false; @Override protected void onPause() { isScreenOn = false; System.out.println(“SCREEN TURNED OFF”); sendSomething(32); // “ “ super.onPause(); } @Override protected void onResume() { isScreenOn = true; //only when screen turns on System.out.println(“SCREEN TURNED ON”); sendSomething(97); // a super.onResume(); }

This code detects a screen on intent and then called the sendSomething method we created earlier. In this case we are sending 32 (the ascii code for a space) when the screen is turned off and 97 (the ascii code for a lower case a) when the screen is turned on. This code can go right after the bluetooth code in our bracelet class.


Code

Programing Arduino and Seeeduino

Arduino Uno

To program the Arduino you must unplug the RX and TX connections The programer will

not respond otherwise.

Seeeduino Film

To program the Seeeduino you must set up the connections in this order:

1. 2. 2. 3.

Program the Seeeduino Remove power from the Seeeduino Plug in the Bluetooth Module Power the Seeeduino


Code

Arduino Sketch

Arduino Uno

(In IDE set Board to Arduino Uno)

char val; // variable to receive data from the serial port int ledRed = 6; // Red LED connected to pin 6 (on-board LED) int ledGreen = 9; // Green ED connected to pin 9 (on-board LED) int ledBlue = 11; // Blue LED connected to pin 11 (on-board LED)

void setup() { pinMode(ledRed, OUTPUT); // pin 6 (on-board LED) as OUTPUT pinMode(ledGreen, OUTPUT); // pin 9 (on-board LED) as OUTPUT pinMode(ledBlue, OUTPUT); // pin 11 (on-board LED) as OUTPUT Serial.begin(9600); // start serial communication at 11520bps } void loop() { if( Serial.available() ) // if data is available to read { val = Serial.read(); // read it and store it in ‘val’ } if( val == ‘R’ ) // if ‘R’ was received { digitalWrite(ledRed, HIGH); // turn ON the Red LED } if( val == ‘G’ ) // if ‘G’ was received { digitalWrite(ledGreen, HIGH); // turn ON the Green LED } if( val == ‘B’ ) // if ‘B’ was received { digitalWrite(ledBlue, HIGH); // turn ON the Blue LED } if( val == ‘ ‘ ) { digitalWrite(ledRed, LOW); // turn Red off digitalWrite(ledBlue, LOW); // turn Blue off digitalWrite(ledGreen, LOW); // turn green off } delay(100); // wait 100ms for next reading }

This code is not the code which controls the bracelet but is working code which allows you to control the color of a tri-color LED with your android phone using an application called SENA BTerm. I’ve included this code because there are differences between the bluetooth code for Arduino and for Seeeduino.


Code

Arduino Sketch

Seeeduino Film

(In IDE set Board to Arduino Pro or Pro Mini 3.3V Atmega 168)

int value = 0; void setup() { Serial.begin(38400); //Set BaudRate to 38400 delay(100); //Used in connection protocall setupBlueToothConnection(); } void loop() { if(Serial.read() == ‘a’) //Bluetooth read { Serial.println(“You are connected to Bluetooth Frame”); value++;

}

}

if(value < 4) //if value is less than 4 LED GREEN { digitalWrite(7,HIGH); } if(value = 5 || value = 6) //if value is 5 or 6 LED RED { digitalWrite(6,HIGH); } if(value = 7) //if value = 7 reset value to 0 { value = 0; }

void setupBlueToothConnection() //Sets up the connection { sendBlueToothCommand(“+STWMOD=0”); sendBlueToothCommand(“+STNA=SeeeduinoBluetooth”); sendBlueToothCommand(“+STAUTO=0”); sendBlueToothCommand(“+STOAUT=1”); sendBlueToothCommand(“+STPIN=0000”); delay(3000); // This delay is required sendBlueToothCommand(“+INQ=1”); delay(3000); // This delay is required } //Send the command to Bluetooth Frame void sendBlueToothCommand(char command[]) { Serial.println(); delay(200); Serial.print(command); delay(200); Serial.println(); delay(1000); Serial.flush(); }

This code sets up a bluetooth connection between the Seeeduino and another bluetooth device. I used an Android phone. If you would like to use this code you can simply change the code in red to whatever functionality you’d like.


Hardware Arduino Uno + Sparkfun Bluetooth Mate Silver Device Info Wiring Order of connections On board LED notifications

Seeeduino Film

+

Seeeduino Film Bluetooth Frame

Programing Prototyping Powering + Charging Setting up bluetooth On board LEDs and notifications


Hardware

Arduino Uno + Sparkfun Bluetooth Mate Silver

Arduino Uno

Bluetooth Mate Silver

Connections Arduino to BT 3V or 5V to VCC GND to GND RX to TX TX to RX

Name for pairing: RN42-B711

RTS to CTS

Baud Rate - 9600 (2400-115200 supported)


Hardware

Seeeduino Film

Included 85mAh Battery

Seeeduino Film

Bluetooth Frame

The battery has a smaller than standard JST connector so other sparkfun batteries will not fit.

Prototyping on the Seeeduino Film is difficult because itâ&#x20AC;&#x2122;s hard to make good contact to the ports. When programing on a bread board it helps to tip the Seeeduino up so that the ports press tightly against the header pins. Keeping connections tight in the ports simplifies prototyping.

The bluetooth module connects via the 20 pin connector. The female end (on the bluetooth module) has a black cover which must be opened to accept the male connector on the Seeeduino Film. The LEDs on the Bluetooth Frame flash red and blue when the device is powered and also when it is paired but this changes to blue only when the device is wirelessly connected.

The battery charges using the built in charging circuit in the power frame of the Seeeduino Film. Plug the battery into the BAT port and plug the included connector into the CHG port. Connect this to a power source 5V or less. The red LED on the circuit will illuminate if the battery is charging.

Name for pairing: SeeeduinoBluetooth Baud Rate: 38400 (others supported)


Fabrication 3D Printing

Preparing a file for print Connections and tolerances Printing for mold making

Casting

Silicone vs. Urethane Rubbers Techniques Casting a mold from a positive Casting a positive from a mold


Fabrication

3D Printing

Preparing a file for print in Rhinoceros 4

To get an accurate 3D print you need to ensure that your product is modeled as a closed mesh. This means that you can have no naked edges or non-manifold surfaces. Some tools you can use to ensure that your file is read for print are the commands BOOLEAN UNION, JOIN, and SHOW NAKED EDGES.

The JOIN command can be used to join separate surfaces. Surfaces can only be joined once however so to make your project into a single object you can use the EXPLODE command to separate the project into individual lines and surfaces and then, after selecting all of these surfaces, use the join command.

Another option for joining surfaces which have already been joined is the BOOLEAN UNION command. mand will join multi surface objects.

After joining all of your surfaces into one object you will want to create a mesh using the MESH command.

Finally you will want to check your object for naked edges. You can do this using the SHOW NAKED EDGES command. All of your naked edges will then show up in a highlighted color. You can then go back and edit your surfaces to eliminate these edges.

Commonly naked edges occur when surfaces don not meet, when extra lines are left in the model, or when sur faces are not properly joined.

This com

Connections and Tolerances

When designing connections it is important to remember to create a gap between the two pieces in the joint. Additionally it is important to understand the tolerances and accuracy of the 3D printer you are using and consider these in your design.

Printing for mold making

Many rubbers shrink over time after they have cured. If you want your mold to be reusable over long periods of time you need to understand how much you can expect your rubber to shrink and make your 3D print that much larger.


Fabrication

Casting

Silicone vs. Urethane Rubbers

Silicone and urethane rubbers are both good rubbers to use for mold making and for casting from molds. these two materials can be difficult.

Choosing between

FORM OF SALE Both rubbers are sold as two part solutions which are mixed in specific ratios. HARDNESS Both types of rubber come in various hardness measured on a scale from 0 to 100 with 100 being the hardest. MATERIAL PROPERTIES Urethan is much thinner when mixed. The viscosity could be compared to vegetable oil. This may be useful if the mold you are using is small and it is difficult to get fluid through it. Urethane comes in a number of colors but in most cases all colors are shades of amber with various shades of transparency. Urethane has a plasticy feeling when cured and as a result feels harder than its equivalent silicone rubber. Urethane can also have an odor when cured.

Silicone is very thick and would be more akin to dough in consistency. Silicone does not bind to anything but itself so when using it to make a mold or to cast positives from a mold no release agent is required. Silicone comes in a wide range of colors however each rubber product is usually sold in only one color. As a result you often have to chose the color you want or the hardness you want. Dyes can be used to color a silicone but you must over come the natural color of the rubber. Silicone has a soft feel to it and is there for nicer for applications which involve human contact.

THINGS TO ASK ABOUT WHEN ORDERING Mixing ratio (how many parts of rubber to how many parts of hardening solution) and if that ratio is by weight or volume.

Quantity of each part (A and B) by volume NOT by weight.

Work time - The amount of time for which the rubber is fluid and workable.

Cure time - The amount of time it takes the rubber to fully cure.


Fabrication

Casting

Techniques

It is critical to get an even mix of parts A and B of your rubber before you pour it otherwise parts of your mold will not harden properly. It is important to scrape the sides and bottom of your mixing vessel to ensure that every bit of both parts of the solution are properly mixed.

When measuring do not forget to account for the weight of the container you are mixing in.

Once the solution is well mixed you will want to pour it into your mold. Make sure the mold is clean and if a release agent is required (either because both the mold and the positive are made of silicone or because neither of them are silicone) this must be applied. Tools like a paper cone can be helpful if the mold has a small mouth.

When pouring into the mold be sure to do this slowly and carefully so as not to introduce air bubbles into the mold. To avoid this the mold can be placed in a vacuum chamber to cure. If a vacuum chamber is not available some light shaking of the mold can allow bubbles to drift to the surface of the mold.


Fabrication

Casting

Casting a mold from a positive

To create a mold from a positive you need to first get a mold box. I made mine out of five pieces of acrylic which I hot glued together. I sealed the seams with hot glue. A mold box should be able to break away from the mold once it has cured.

To create my mold I used double sided tape to stick my 3D printed positives to the bottom of my mold box. I then poured the silicone rubber into the mold box. For my mold I used Mold Max 30 from Smooth On. I found this rubber to be a good hardness for the mold as I wanted to be able to remove my positives with relative ease.

Once the mold had cured I broke the sides of the mold box away and flexed the mold until it had loosened enough from the positives that they could be extracted from the pink rubber.


Fabrication

Casting

Casting a positive from a mold

When making your positives from your mold you should be sure that the inside of your mold is clean and dry. Mix your rubber and pour it into the mold. Giving the mold a light shake can help reduce bubbles if a vacuum chamber is not available. Leave the mold to cure in a safe place away from containments.

I made a number of positives from my silicone mold. The first set were also silicone. To make these I had to spray a re lease agent into my mold so that the silicone I was pouring into the mold would not bind with the silicone I had made the mold out of.


Get off your phone!