PCOM playtest

The previous week has been spent on figuring out the gameplay for the respiratory sensor and trying to incorporate the pulse sensor into the device.

One of the problems is that the heartrate sensor and the chest strap for measuring breath have to be located in a similar position to give good readings. We tested different positions of the sensors – and found at that right now the respiratory sensor is more exposed to noise – so that needs to be positioned over the heart rate sensor (at a more optimal position). Another concern is that people don’t want to wear this device on the skin. We are currently attempting to make the device so that the heart rate monitor can be taken out – and people can use the respiratory sensor on top of their shirt. This seems to work a lot better and make it more comfortable for people to wear the device.

This is what the first prototype looked like. However we found out that the pulsesensor didnt have good contact with the body – therefore we changed it into this other design (which is also easier for the user to put on as we replaced the connection of the strap with velcro.)

So right now the stretch conductive fabric is located on top of the heart rate monitor located at the bottom of the device.

We got the pulssensor to work and incorporated the heartrate into our sketch. But I wasn’t happy with the reading as it seems to skip some beats and act noisy. I don’t know if this is due to the position of the heart rate monitor or whether I need some more code to sort it out (Tom told me that it was probably due to the delay function in my code, and that I should try to replace it with interrupt instead) So I’m going to give that a try.
Although it works to some degree I do have some doubts about the polar sensor at this point. It’s uncomfortable for people to wear (since it has to be in contact with the skin) – Physically its difficult for us to put into the device and at the same time make it reliable for everyone. I will keep working on it – but I only want to use it if I think it will work and be reliable.

Here’s a test of both measures combined – however this is before putting them into the fabric which is causing some problems:

Another thing being illustrated in this video is some of the tests we did with our respiratory function. We tested the moving average function that we have gone over in class and combined it with the average function we were already using in our sketch. It worked really well and got rid of a lot of the noise we had in our readings. The downside was (as you can see in the video) that the visual feedback looked more manipulated. And from testing different users we found that people liked our original code better (which I found frustrating). Before the final we will do a few more tests to decide which type of data visualization/manipulation we want to go with.

We also agreed on a way to present our presentation. Our idea is to give people some time to visualize and see the autonomous physical mechanisms that we often take for granted. Like respiration and heartbeat(! if it works). After that we want to let people know that even though these functions are autonomous we are still in full control – which we want to illustrate using a game. We discussed the game and how to use it.

So far our game had been to difficult and made people dizzy. We agreed to set up some different stages – and in between give people some rest. Our thoughts are for people to follow a pattern created by circles. It will start easy and increase in difficulty over time. We also decided to make it a short game (1 – 1.30 min).

After incorporating this – this is what our sketch looks like:

This week leading to our final we will see if we can get the heartRate sensor to work reliably. If not we may sacrifice it for now – or have it as an option.

Also, we need to fix the wires going from the feather board to the bluetooth sensor and the alligator clips on the stretch fabric. The wires keep snapping above the connection to the board. This happened during the playtest and I have been trying to fix it again and again without luck.

I will try to make a casing for it, as that may relieve some of the pulling that happens to the wires. Also We would like to have a visual on/off light on the outside of the device. Which should be possible if we get the cables “cleaned up”.

 

 

 

PCOM – update on final project

A lot have happened since last update. We changed some ideas and after meetings with Tom and Dan O’ we decided to replace our initial idea of getting the ECG to work. Although we did get some good readings in a resting position we were not able to get good results during movement. Right now is seems like that task is too complicated especially considering the timespan of the assignment. Instead we are now aiming to use respiration and heart rate – 1. for the user to acknowledge some of the autonomous functions that keep us alive and -2. For a game where both data is incorporated.

Although we have come to the conclusion that wearables are difficult – we are still planning to make our device something you put on. During our playtest we realized that it may not be easy to have people take off their shirt and replace it with another. For that reason we are trying to make a strap that goes under the shirt. According to the feedback we got from playtesting it seems like people are more willing to test/play when they do not have to replace their outfit. We used the conductive stretch fabric we ordered to create a chest strap that would detect the expansion of the ribs (as with breathing) and got some good results. After creating several prototypes and testing several people it turned out that we could get an analog input range of about 50 for each person – which we considered a good resolution for the visualization of the respiratory rate.


Different types of prototypes for the measurement of respiration.

For this measurement it is important for the strap to be tight on the chest, otherwise you get a response with a lot of noise. After several tests we found that to get the best possible response we needed to make it adjustable. We attached a clip to the back. That way it would be easy to put on. Also we added some adjustable straps so everyone could try it. Our final prototype looks similar to the lower one in the image. However we found that if the fabric folds it also creates noise. Therefore we had to add a layer on top of it to avoid it from folding. We then playtested it in Jeff Fedddersens class – with useful feedback.

After this we decided to try to go for wireless results. One of the residents who has previously worked with puls readings and other biometric data advised us to purchase the feather M0 basic from Adafruit. The reason for that was that it is tiny, it’s easy to attach a battery and it’s easy to recharge the battery through the computer. This saved us a lot of space:

before:

after:

It did take some time to make our HC-06 bluetooth work with the feather – eventually we read that the solution to the problem was to use Serial1 instead of Serial in our Arduino sketch. I tried to recreate the setup in Fritzing.


Although the drawings says HC-05 we actually used the HC-06 – also our battery is a 3.7v 500mAh – as we were told that would be sufficient for our purpose.
So far the bluetooth connection has been very reliable.

The last few days have been spent on creating a sketch/game using the respiration sensor. Our idea is to create an visualization using a sketch that autoscale the results. This way everyone can try it and have similar results – the units however are not very informative, as we are not able to say anything about the amount of air being inhaled/exhaled. We also purchased a polar belt (puls sensor) and Polar T34 Heart Rate Receiver to use for measurement of the pulse which we currently trying to incorporate. We are receiving input from the sensor but one of our current challenges is to have the sensors close to each other without affecting one another (as they are both supposed to be attached around the chest). Also we want to try to combine them into one (comfortable) piece that goes around the chest – that is easy for people to use.

The following video (although a bit hard to see) is from a recent testing of our device. Our idea is to try to influence the way people breath by having them touch specific points on the screen (here, illustrated as circles). The breathing patterns will vary between being random to following a specific pattern. The pace of the circles is intended to be determined by your pulse rate.

From what we have seen from the user testing so far – people have ended up being a little dizzy afterwards. Probably due to a large/fast paced number of circles. This and having it work alongside the pulssensor is something we need to test further within the next days.

Updated Bill of materials:

Physical Computing week 9 – Heading into finals

For my PCOM project in collaboration with Sandy Hsieh I would like to build a shirt with built in sensors providing feedback on ECG, Respiration and Movement. The shirt is intended to give the user an educational feedback on how the heart and lungs function and which joints are activated during different movements.

This week PCOM finals kicked off. In class we were asked about our ideas for the finals project. People presented their different ideas and questions were asking regarding functionality, interaction, thoughts behind the project etc. After that we met with Daniel Rozins class to talk about timeline, systems diagrams and bill of materials for the project.

Project Idea background
The idea for the Pcomp final has been in my head for a while. My background in Human biology has provided me many opportunities to work with people in healthcare and athletes from various backgrounds. When working with Cardiologists in Germany we screened several athletes every day using an ECG apparatus that connected a human to a computer using 12 wires from all over the body. I didn’t understand why it had to be so complicated. Similar scenarios has occured when working with patients in Hospitals. I find the idea of being able to combine physiological measurements with clothing to provide feedback very interesting. Also, with many years of teaching anatomy and physiology I find a device like this very interesting from an educational point of view – to help visualize how the body works.

My partner for this project is Sandy Hsieh. She has a background in apparel development and patternmaking. We quickly brainstormed on ideas and thoughts on how to approach this project and had many similar ideas. We are aware that trying to make clothes interactive using bio-sensing is a difficult task – so we quickly decided to test whether things are possible or not. Not until this was done would we be able to tell whether it was something we could continue to work on or not. Ideally we would like to create visual feedback on heart ECG, Respiration and Motion. These we consider some interesting aspects of the human body – Also, If working properly, these could allow for interesting feedback for the user when moving/performing a task.

A while back I tested the Sparkfun ECG sensor using wires and electrodes and got the following result:

The results from the first image are illustrated in p5 using a serial connection and code that would cancel out some of the noise. To bottom image shows what an ideal response looks like.

Our first test was to see if we could get a similar result when replacing the wires with conductive thread. The following video shows the data in Arduino plotter when one wire has been replaced with conductive thread – which worked well:

Also, replacing all three wires had good results when in rest and worked for both of us when using the Arduino plotter to visualize results. In this video Sandy is wearing the three electrodes on her chest attached to the Arduino using conductive threads.

The following day we decided to create a prototype to see if similar results were possible when sewing the electrodes into a shirt. We decided to throw in several attachers for electrodes so that different people could try the shirt and we could see if we would get good readings. The electrodes were positioned according to general guidelines. The following picture is from Phillips ECG quality  “Application Note”.  

We found out that ECG readings could be incorporated into a shirt, however we did not manage to get good readings from a person wearing the shirt when he/she was moving. Which is something we will have to work on.

Aside from testing the ECG we ordered conductive fabric to test for the respiration feedback we hope to incorporate. We reached out to Emmanuel Klein – an ITP alumni who previously did a project called “breathe” in which he also used feedback from the body to visualize respiration. Our hope is that he can help us optimize a way to portray respiration.

We met with Renata Gaui – another ITP alumni to discuss conductive fabrics and pick her brain on the best ways to incorporate conductive fabrics for our purpose. Also she told us about the possibilities that currently exists using fabrics and wearable technology.

In the following week

We are going to test the conductive fabric that we ordered – trying to test ways of measuring respiration. We have booked office hours for assistance in findings ways to reduce noise and creating a visualization in p5 that adjusts to the ranges provided from the ECG data (similar to the Arduino plotter).

Additionally, we have found a few research articles that have had good experiences with “silver plated conductive fabric” instead of electrodes for ECG measurement (http://www.mdpi.com/2079-9292/5/4/75/htm). We are going to test something similar – hoping to improve our ECG readings during movement. Also replacing electrodes with fabric would make the shirt easier to use and test in general.

For motion detection several people referred us to the Notch motion capture. We are going to test those sensors (available at ITP) to see what type of data they provide.

We created a list of parts that we expect to use in this project. The purpose of this is to give us an estimate of the costs and a reference to materials needed for this project.

In our next class we will use prototypes for playtesting. I’m planning on bringing in our shirt prototype and using this session as a way to hear out others what potential features they find more interesting and what type of feedback they would like to have from the shirt. Visual? Sound? Images? Walk- Run- jump- Interaction?

To fully create a systems diagram I need to talk to a resident about the right setup. Right now we are planning on an Arduino Nano, a Bluetooth HC-06,  a battery and the ECG chip to be connected to the shirt. But if more electrodes are necessary this setup may change. Also the output from the sensor providing feedback from the chest/respiration is expected to go back to the Arduino nano.

PCOM midterm – Sketch controlled by Hand gesture

The midterm project. Two weeks and a chance to use what we have learned in class so far. We were put in groups of two and the assignment was to come up with an interactive product to show in class. My partner and I had several ideas about what to do, so we sat down and agreed on a couple of them. We came up with the idea of using proximity sensors to control a pen on a canvas. After speaking to Tom we adjusted our idea and quickly decided instead to use similar sensors to control a p5 sketch. We were both fascinated by the idea of using an intangible control – to me, the idea of handgestures is very compelling and I think we are going to see more of it when we advance from touch screens (a good read on that is Bret Victor: A brief Rant on the future of interaction design. Also in relation to that I find “Project Soli” by Google ATAP very interesting).

As we were tuned in on an idea the first step was choosing the right sensor to detect our movement. Some of the options were IR-sensors and Ultrasonic sensors. Another option was to use a “Leap Motion”. My experience with the leap motion is good. However, I also felt like using that type of sensor for this project would be a potential shortcut and that I wouldn’t learn as much from it. Instead we decided to go with the ultrasonic sensor. From what I have heard, these have a longer range that the other distance sensors, which potentially could be useful for the project. We were aware that this type of sensor is cheap and generally in bad standing among people who has been using them. Making this sensor work ‘well’ was one of the challenges in this project that I really liked.

We used sensors of the brand SainSmart HC-SR04. We wanted to have two. One controlling the x-axis and one controlling the y-axis. As shown in this early sketch we considered attaching them on a frame (vertical position) so that people would put their arm into the frame – using the frame as an indicator of where you could position your arm.

Step 1: Getting one sensor to work
The first thing we needed to do, was to get a sensor to work. We used a basic tutorial by Dejan Nedelkovski on the “How to mechatronics” webpage to arrange the trigger and echo sensors. This was pretty simple. We quickly realized that the sensor measurements we got from the sensor was all over the place – a small misplacement of the hand and we would get ranges that were far out of the range. For the correction of this we used a serial connection to a computer and drew an ellipse – we then used the ellipse to visualize the numbers we got from the sensor. We used p5 to write a code where we would only use the numbers within a certain range. When using the Arduino serial monitor we found that the ranges between 2cm and 50cm were very consistant – based on that we wrote a p5 sketch that would only us the numbers within that range. These numbers were pushed into a array and the average of all the numbers were calculated and used as either the xValue or yValue. The xValue and yValue was then mapped to the canvasWidth and Height, respectively. Some of the necessary adjustments during this phase was to figure out how far of a reach (physically) you wanted to the sensor to have – but also determining the length of your array for xPos and yPos. If the length of the array is long you are going to have a precise but slow response, whereas a small array will be more responsive but more vulnerable to small changes in the measures. This video shows what our initial measurements (before a proper correction) looked like:

Step 2: Getting two sensors to work
Setting up two sensors was not too complicated either. One thing to be aware of, that caused some trouble was that you can’t have two “pulseIn/EchoReads” simultaneously therefore the code needed to be rearranged to give two readings.
Another thing that was added at this point was a Serial handshake. There was a lot of incoming data to the p5 sketch. The buffer filled up quickly and even the smallest error in the sketch would crash the browser – this was quickly fixed with a Serial-handshake.
Now that we had two functioning sensors mapping the next step was to test the position of the sensors. What way to turn them? Where to place the xSensor and where to place the ySensor. At first the sensors were placed on a table facing the same area (like a coordinate system). When placing your hand on the table (as in the previous video) there would be a big hand-surface-area for the xSensor to detect whereas the ySensor would be reading the location based on the small area created by the top of your hand. For this setup to work it was necessary to hold something in your hand – like a cube or a glass. The following video shows how it worked. At this point we had also added a on/off switch and a light to indicate the on/off state.

When testing different setups with the sensors we realized that the accuracy and general control was better when the sensors were pointing in different directions. Therefore we decided to change the control into something where you needed two hands for control instead of just one. The following is showing some of the different setups: For this setup the sensors are placed on the wall behind the computer. One is facing in a up/down direction (right of the computer). The other is positioned in a right/left direction (left of the computer). Also, on the table there are marks from the ‘range’ testing.

 For this setup a cardboard prototype was created. The ySensor is pointing down and the xSensor is coming out of the left side of the box. Tape is used as an indicator for where to put your hands. It also labels the length of sensors reach.

 

3. Final decisions
After some testing (and many discussions) we created a final case and setup. It was determined that the box would be in front of you. The ySensor would be placed on top of the box, whereas the xSensor would be placed on the side. We decided to go with a simple cardboard case (to limit waste of resources). Lights, wires and the on/off button was attached to the box, giving us the following product. We also moved our sketch from the p5 online browser to a local browser. This had a dramatic effect on the speed and control of the sketch.

The sensors were soldered to pinboards to make them fit inside the box.  The following shows the wiring of the Arduino.

A simple game was created. Our thoughts were to create a game where you would need accuracy and therefore precision and concentration on your arm gestures.  Ideally, we wanted to create a maze, that you had to get through on time. However, we realized that collision between two objects is difficult when using Serial input from sensors like these. Instead we created a simple sketch similar to snake, where you had to move the curser into a certain area on the screen.

The final user-testings were being performed. This is what the final test looked like.

What I learned from this:

  • 1
  • 2
  • 3

Arduino code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// defines pins numbers
const int trigPin = 9;
const int echoPin = 10;
const int trigPin2 = 6;
const int echoPin2 = 7;
// defines variables
long duration;
long duration2;
int distance;
int distance2;
int switching = 0;
bool on = false;

float scale = 0.034;

void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(trigPin2, OUTPUT);
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(echoPin2, INPUT);
pinMode(3, INPUT);
pinMode(5, OUTPUT);
Serial.begin(9600); // Starts the serial communication
sayHello();
}

void sayHello() {
while (Serial.available() <= 0) {
Serial.println("0,0");
delay(500);
}
}
void loop() {
int button = digitalRead(3);
if (switching != button && button == 1) {
on = !on;
}
switching = button;

if (on) {
digitalWrite(5, HIGH);
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(10);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Clears the trigPin
digitalWrite(trigPin2, LOW);
delayMicroseconds(10);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin2, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration2 = pulseIn(echoPin2, HIGH);
<h4>// Calculating the distance
distance = duration * 0.034 / 2;
distance2 = duration2 * 0.034 / 2;</h4>
<h4>if (Serial.available() &gt; 0) {
int inByte = Serial.read();
Serial.print(distance);
Serial.print(",");
Serial.println(distance2);
}
} else {
digitalWrite(5, LOW);
}
}

P5.js sketch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
</h4>
class Ball {
constructor() {
this.x = 0;
this.y = 0;
this.w = 20;
this.h = 20;
}

update(newX, newY, walls,score) {
if (this.collision(newX, newY, walls)) {
// collide with nugget; eat apple and generate new apple
score += 1;
walls.shift();
walls.push(new Wall(random(width),random(height),100,100));
} else {
// update position
this.x = newX;
this.y = newY;
}
return score;
}

display() {
rect(this.x, this.y, this.w, this.h);
}

collision(x, y, walls) {
rectMode(CENTER);
fill(100);

for (var i = 0; i &lt; walls.length; i++) {
var wall = walls[i];
var xdiff = abs(x - wall.x);
var ydiff = abs(y - wall.y);

if ( xdiff &lt; this.w / 2 + wall.w / 2 &amp;&amp; ydiff &lt; this.h / 2 + wall.h /2 ) {
return true;
}
}

return false;
}
}

class Wall {
constructor(x,y,w,h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
}

display() {
rect(this.x,this.y,this.w,this.h);
}
}

var serial; // variable to hold an instance of the serialport library
var portName = '/dev/cu.usbmodem1421'; // fill in your serial port name here
var circleSize = 5; // size of the circle
var xPos = 0;
var yPos = 0;
var data = 0;
var values = [];
var valuesY = [];
var ball = new Ball();
var walls = [];
var win = false;
var fail = false;
var score = 0;
// var text;

function setup() {
createCanvas(windowWidth, windowHeight);
serial = new p5.SerialPort(); // make a new instance of the serialport library
serial.on('data', serialEvent); // callback for when new data arrives
walls.push(new Wall(random(width),random(height),100,100));
}

function draw() {
background(200);
textSize(48);
fill(0,0,80);
text("Score: " + score,100,100);
fill(40);

var xmap = map(getAverageX(), 4, 37, 0, width);
var ymap = map(getAverageY(), 3, 31, height,0);
score = ball.update(xmap,ymap, walls,score);

for (var i = 0; i &lt; walls.length; i++) {
walls[i].display();
}

fill("aquamarine");

ball.display();

}

function getAverageX() {
var sum = 0;
for (var i = 0; i &lt; values.length; i++) {
sum += values[i];
}
return sum / values.length;
}

function getAverageY() {
var sum = 0;
for (var i = 0; i &lt; valuesY.length; i++) { sum += valuesY[i]; } return sum / values.length; } function serialEvent() { data = serial.readLine(); if (data.length &gt; 0) {
var sensors = split(data, ",");
xpos = sensors[0];
ypos = sensors[1];

if (xpos &gt;= 4 &amp;&amp; xpos &lt; 37) { values.push(int(sensors[0])); if (values.length &gt; 100) {
values.splice(0, 1);
// print(values);
}
}

if (ypos &gt;= 3 &amp;&amp; ypos &lt; 31) { valuesY.push(int(sensors[1])); if (valuesY.length &gt; 100) {
valuesY.splice(0, 1);
// print(valuesY);

}
}
}
serial.write('x');
}

Physical Computing – week 6 – Serial Communication

This week we were introduced to Serial communications between two computers. This basically allows for us to control sketches and programmes on our computer using different sensors and inputs from the physical world. I spent a lot of time this week trying to understand the theory behind punctuation, Handshaking and ASCII-code – and so far it feels like hours well spent. I went over the labs and also did a small project on the side. With serial communication a lot of ideas for potential projects have come to my mind. Last night I wanted to create a sketch of a cube that would be controlled by a real physical cube. I had the whole project in mind, but not much time. So I came up with something in between. I purpose of this mini project was to try to work with an accelerometer, create a serial input and manipulate a simple 3d sketch in p5. Although the calculations may have some flaws (I will try to correct them today) I would say the project was a small success.

P5.js CODE:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var serial; // variable to hold an instance of the serialport library
var portName = '/dev/cu.usbmodem1411'; // fill in your serial port name here
var circleSize = 10; // size of the circle
var xPos = 0;
var yPos = 0;
var r =0;

function setup() {
createCanvas(710, 400, WEBGL);
serial = new p5.SerialPort(); // make a new instance of the serialport library
serial.on('data', serialEvent); // callback for when new data arrives

}

function serialEvent() {
var data = serial.readLine();

if (data.length &gt; 0) {
var sensors = split(data, ",");
// console.log(sensors);
xPos = float(sensors[0]);
yPos = float(sensors[1]);
// console.log('xPos', xPos);
// delay(10);
}
}

function draw() {
background(100);
noStroke();
mappedx = map(xPos,-90,90,-2,2);
mappedy = map(yPos,-90,90,-2,2);

push();
translate(0, 0);
console.log(mappedx);
console.log(mappedy);

rotateY(mappedy);
rotateX(mappedx);
box(100);
pop();

}

ARDUINO:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include //Include the Wire library
#include //Include the MMA_7455 library

MMA_7455 accel = MMA_7455(); // Make MMA7455 object

char xVal, yVal, zVal; // Return value variables

void setup() {
Serial.begin(9600); // Use the Serial Monitor window at 9600 baud

// Set the g force sensitivity: 2=2g, 4=4g, 8-8g
accel.initSensitivity(2);

// Provide offset values so that sensor displays 0, 0, 63
// (or close to it) when positioned on a flat surface, all pins
// facing down

// Update the numbers with your own values from the MMA7455_CalibrateOffset sketch.
accel.calibrateOffset(6, 23, 0);

}

void loop() {

// Get the X, Y, anx Z axis values from the device
xVal = accel.readAxis('x'); // Read X Axis
yVal = accel.readAxis('y'); // Read Y Axis
zVal = accel.readAxis('z'); // Read Z Axis

// Display them in the Serial Monitor window.

int MappedxVal = map(xVal,-60,60,-90,90);
int MappedyVal = map(yVal,-60,60,-90,90);
int MappedzVal = map(zVal,0,0,0,0);

Serial.print(MappedxVal);
Serial.print(",");
Serial.print(MappedyVal);
Serial.print(",");
Serial.println(MappedzVal);
delay(1000);

}

Also, this week we were introduced to our midterm projects and partners. I’m looking forward to a more in depth project where Stephanie and I hopefully come up with a great idea – we are still working on that.

Lastly, I got my ECG to work. It is very noisy – but I feel like the information provided by it has a lot of potential. I’m looking forward to spending more time on that project on the side.

Intro to Physical Computing – week 4

This week we were introduced to Servo motors and Arduino Sound. Both of these open a lot of new possibilities that I am looking forward to playing around with. I went to Tinkersphere to buy some flex sensors that I am planning to combine with Servos in order to mimic movement (at some point). We were asked to bring a physical project to next weeks class. Most projects are built and then broken down again to build something new – therefore most documentation in class has been recordings and photos so far.

This week I wanted to build a project that sums up the things we have learned in class. I want to make sure I master some basics before I get involved with more complicated projects. This weeks project is a basic button that has a toggle function to “turn on/off” the project. Aside from that there is a potentiometer that sends an input to the Arduino board and controls a line of LEDs and the pitch of a small speaker attached. This way I got to use digitalread, analogread and the mapping function.

 

Although the setup was fairly simple there was a few struggles with the code. I wanted to test the “for loop” in Arduino which was the reason for me to include several LED’s. Also I wanted to control each LED without having them in perfect order on the Arduino digital output. This was intentional to challenge myself – which is also the reason for my code to look somewhat strange.

The code can be seen here:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const int lowestPin = 4;
const int highestPin = 11;
bool on = true;
int switching = 0;
int notes[] = {262,294,330,349};

void setup() {
pinMode(4, INPUT);
pinMode(3, OUTPUT);
for (int i = lowestPin; i &lt; highestPin; i++) {
pinMode(i, OUTPUT);
}
Serial.begin(9600);
}

void loop() {
int Sensor = analogRead(A5);
int button = digitalRead(4);
Serial.println(button);
Sensor = map(Sensor, 0, 1023, 0, 4);

if (switching != button &amp;&amp; button == 1) {
on = !on;
}

switching = button;

if (on) {
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(10, LOW);
noTone(3);
return;
}

if (Sensor &gt;= 0) {
digitalWrite(6, HIGH);
}
if (Sensor &gt; 1) {
digitalWrite(7, HIGH);
}
else {
digitalWrite(7, LOW);
}
if (Sensor &gt; 2) {
digitalWrite(8, HIGH);
} else {
digitalWrite(8, LOW);
}
if (Sensor &gt; 3) {
digitalWrite(10, HIGH);
} else {
digitalWrite(10, LOW);

delay(100);
Serial.println(Sensor);
}

Sensor = map(Sensor,0,4,0,1023);
tone(3,Sensor);
Serial.println(Sensor);

}

Intro to Physical Computing week 3.

Riding home from Tisch last night I had to pick up groceries. When waiting in line I noticed a piece of technology that was well suited for todays blog post assignment. The payment terminal in the supermarket. Although it may seem like a simple device to handle – it is not! First of all. You are under pressure. People are waiting behind you. Next – with the new chipped credit cards there are now two ways to pay: inserting the card or swiping the card. This confuses people incl. myself. Some places you have to swipe although they have the chip and vice versa. You then enter your pin – which is followed by a long wait, as the transaction needs to be approved. Some places even let you confirm your transaction with a signature on a touch screen. This was not the case at the supermarket today. Pretty much everyone I saw in the line were confused about where to put the card. Also for the transaction to get processed 1. You have to insert the card. 2. They have to type in the amount. 3. You press the pin.  4. You wait for approval. 

In my home country there are now many places where you can pay with mobilePay (Venmo as I believe it’s called here). Each supermarket has their own phone number you send the money to. That way you don’t need cash or credit card. Just your phone. This year they also introduced a method in which you can pay wirelessly with your credit card. For all transactions up to 30$ dollars you simply have to hold your card close to a sensor – it then takes two seconds and the payment is confirmed. No pin needed. When standing in line today “It must be a matter of months before thats being introduced here” I thought to myself. Even more complicated is it, when you walk into a store and they only accept cash. But thats a whole other story.   

Intro to Physical Computing – week 2 . Switches and Circuit basics.

In this weeks introduction to physical computing we worked on understanding the basics of electricity – such as Voltage, Resistance, Current and how they relate to each other. We also got to know different electrical components to understand how to build circuits. So far – I had only used my 5v Arduino to power the circuits but since I got to know the voltage regulator component I have now switched to a 12V AC/DC power supply. I did some testing to get familiar with the multimeter and it seemed to work very well.  

The measures I found are shown here:

Our homework was to answer some questions about the basics of electricity such as serial and parallel circuits. We also had to come up with a simple switch for next class. Instead of coming up with my own switch I decided to test one of the stranger switches I found in my component kit.

The interesting thing about this switch (aside from its size) was the “on – on” symbol. Which seems counterintuitive considering its a switch. Running over the instruction manual explains how it works. The lever will connect the ground with the contact on one of the two sides – directing the current to one of the two circuits connected. 

The video shows how it worked in my circuit. 

I did have a question regarding the calculation of resistance in todays quiz. I’ll ask it in class.

Intro to physical computing – Week 1

Intro to physical computing week 1 – What is physical computing?

This week we had to read two interesting pieces. One was “The art of interactive design” by Chris Crawford, the other “A brief rant on the future of interaction design” by Bret Victor. The one by Chris Crawford had a more academic approach discussing the terms of what “interactive” means and how the term has been (mis)used in various contexts. The text by Bret Victor had a more practical and paradigme-breaking approach challenging our current vision of how interaction and technology works in the future. “Why use a single finger when you have the entire body at your command” he questions the reader. Suggesting that the the current use of a fingerswipe to control technology is only temporary until we come up with ways to use the better potential of the hands – the tactile and proprioceptive senses.

The term “Interaction” is difficult to comprehend. It seems like it is easier to explain what it is not. Crawford states that it is like a conversation cycling back and forth to which each must contribute – or as he also says – an input/process/output. I can relate to this explanation but the word “influence” constantly came up in my mind when reading these pieces. However, this may not be fulfilling as books, music etc. can influence you – but these are not considered to be interactive. Could interaction be described as something that influence a physical process or thought process again and again over time?

These thoughts brings me to a sentence by Cawford in which he says: “Most mammalian infants learn basic skills from interactive play”. The coordination of movements and skill learning behaviour is often related to the internal loop of the cerebellum. This area interpret the intentions of a given movement with the outcome. If you did not achieve what you intended to do, you adjust your movements and try again. Although I would not call this interaction, since it is happening in your head (maybe intrinsic interaction?!) – This theory constantly reappears in my head- again relating to the input/process/output.

Good physical interaction – takes advantage of senses, gestures or movements (outputs) that we use daily (without knowing?) and turns these into signals or inputs that will influence or affect someone or something else.

Another assignment for this week was to buy certain components for physical computing class. I bought the Arduino kit and starting creating some of the projects in the booklet that came with it. One of these were to test a temp. sensor. Although it is a simple setup it gave some good insight into how circuits are made and how they work.

Getting familiar with Arduino