13. Skin Electronics¶
Pressure sensor - 3 by 3 Matrix copper tape velostad¶
Today we made a DIY 3x3 touch sensor. It is made out of 3 vertical and 3 horizontal lines of copper tape. Inbetween are 9 little squares attached which are made out of Velostad. By pressing it together it will commit a pressure value to your computer.
Arduino circuit
reality vs. sketch
Arduino Code
//3 by 3 Matrix copper tape velostad
#define numRows 3// constant variable
#define numCols 3
#define sensorPoints numRows * numCols
int rows[] = {A0, A1, A2};
int cols[]= {8, 9, 10};
int incomingValues[sensorPoints] = {};
void setup() {
// put your setup code here, to run once:
for (int i = 0; i < numRows; i++) { pinMode(rows[i], INPUT); } // creates loop to set all to input with only one command
for (int i = 0; i < numCols; i++) { pinMode(cols[i], OUTPUT); } // creates loop to set all to output with only one command instead of declaring ever colum seperated as output
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
for (int colCount = 0; colCount < numCols; colCount++) {
digitalWrite(cols[colCount], HIGH); // 5V
for (int rowCount = 0; rowCount < numRows; rowCount++) {
incomingValues[colCount * numRows + rowCount ] = analogRead(rows[rowCount]);
}
digitalWrite(cols[colCount], LOW); //set back to low 0V (-)
} // end colCount
// Print incoming values of the grid:
for (int i = 0; i < sensorPoints; i++) {
Serial.print(incomingValues[i]);
if (i < sensorPoints - 1)
Serial.print("\t");
}
Serial.println();
delay(10);
}
Conert code to visible output with Processing programm (can be Downloaded here)
Processing code
/*
Code based on Tom Igoe’s Serial Graphing Sketch
>> http://wiki.processing.org/w/Tom_Igoe_Interview
Reads X analog inputs and visualizes them by drawing a grid
using grayscale shading of each square to represent sensor value.
>> http://howtogetwhatyouwant.at/
*/
import processing.serial.*;
Serial myPort; // The serial port
int rows = 3;
int cols = 3;
int maxNumberOfSensors = rows*cols;
float[] sensorValue = new float[maxNumberOfSensors]; // global variable for storing mapped sensor values
float[] previousValue = new float[maxNumberOfSensors]; // array of previous values
int rectSize = 0;
int rectY;
void setup () {
size(600, 600); // set up the window to whatever size you want
rectSize = width/rows;
println(Serial.list()); // List all the available serial ports
String portName = Serial.list()[4]; // set the number of your serial port!
myPort = new Serial(this, portName, 9600);
myPort.clear();
myPort.bufferUntil('\n'); // don’t generate a serialEvent() until you get a newline (\n) byte
background(255); // set inital background
smooth(); // turn on antialiasing
rectMode(CORNER);
}
void draw () {
for (int i = 0; i < maxNumberOfSensors; i++) {
fill(sensorValue[i], 0, 0);
rect(rectSize * (i%rows), rectY, rectSize, rectSize); //top left
if ((i+1) % rows == 0) rectY += rectSize;
}
rectY=0;
}
void serialEvent(Serial myPort) {
String inString = myPort.readStringUntil('\n'); // get the ASCII string
println("test");
if (inString != null) { // if it’s not empty
inString = trim(inString); // trim off any whitespace
int incomingValues[] = int(split(inString, "\t")); // convert to an array of ints
if (incomingValues.length <= maxNumberOfSensors && incomingValues.length > 0) {
for (int i = 0; i < incomingValues.length; i++) {
println("Raw sensor value: " + incomingValues[i]);
sensorValue[i] = map(incomingValues[i], -50, 1000, 0, 255);
println("Mapped sensor value: " + sensorValue[i]);
}
}
}
}
Research¶
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
weekly assignment
Check out the weekly assignment here or login to your NuEval progress and evaluation page.
about your images..delete the tip!!
-
Remember to credit/reference all your images to their authors. Open source helps us create change faster together, but we all deserve recognition for what we make, design, think, develop.
-
remember to resize and optimize all your images. You will run out of space and the more data, the more servers, the more cooling systems and energy wasted :) make a choice at every image :)
This image is optimised in size with resolution 72 and passed through tinypng for final optimisation. Remove tips when you don't need them anymore!
References & Inspiration¶
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
- Two images side-by-side
Tools¶
Process and workflow¶
My sketches are ...
This schematic 1 was obtained by..
This tutorial 2 was created using..
footnote fabrication files
Fabrication files are a necessary element for evaluation. You can add the fabrication files at the bottom of the page and simply link them as a footnote. This was your work stays organised and files will be all together at the bottom of the page. Footnotes are created using [ ^ 1 ] (without spaces, and referenced as you see at the last chapter of this page) You can reference the fabrication files to multiple places on your page as you see for footnote nr. 2 also present in the Gallery.
Code Example¶
Use the three backticks to separate code.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Results¶
Video¶
From Vimeo¶
Sound Waves from George Gally (Radarboy) on Vimeo.