# Space Frame Structure Force Sensors

18,083

26

4

## Introduction: Space Frame Structure Force Sensors

Space frames are super efficient structures made entirely from straight pieces of material, joined together at their ends to form complex 3D shapes.

They can look like this, this, or this. They can be gigantic, but are also cool on a small scale, like this space frame bench I built.

Their advantages include low material usage, ease of construction, free-form design possibilities, and awesome space-age appearance.

One major disadvantage is that they can be difficult to engineer. It's not straightforward to determine how forces will distribute throughout a structure that has a lot of redundant pieces.

All of the "struts" (the straight parts) of a space frame are subject to either tension or compression forces along their length (they're "axial forces," in engineer talk). Tension forces are pulling or stretching forces; compression forces are pushing or squeezing forces. The direction of the force (tension or compression) can change depending on how a structure is loaded and can sometimes be surprising in a complicated structure.

This Instructable will show you how to use the sticky tape pressure sensors from Plusea's Instructable to determine the forces acting on the struts in a space frame model you can build and test. To make a space frame model, check out my Instructable on the topic.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Gather Materials

This Instructable requires:
Magnetic space frame model - You can buy toy kits like Geomags consisting of plastic struts with magnets on their ends and steel spheres, or you can put together your own from drinking straws, magnets, and steel spheres you can buy for much cheaper.
Sticky tape, Velostat, conductive thread, scissors - These are all materials required for the pressure sensors, details in Plusea's Instructable.
* Arduino - For converting the analog signal from your sensors into something your computer can read.
* Various wires, alligator clips, breadboard - For connecting your sensors to the Arduino.
* 10K Potentiometers or resistors of various values - For creating voltage dividers to get the variable resistance of your sensor into a form the Arduino can use.
Multimeter - Helpful for testing, though not absolutely necessary
A computer with Processing and Arduino software - You probably have access to a computer if you're reading this. Processing and Arduino are available for free.

## Step 2: Make Your Sensors

Follow the instructions from Plusea's Instructable to make the sticky tape pressure sensors. I didn't have conductive fabric, so mine don't have nice tabs like hers, but they still work fine.

I made mine very small and thin - this way they don't interfere too much with the magnets' attraction.

## Step 3: Put the Sensors in the Model

The magnets should be strong enough to hold the thin sensor between the end of the strut and the steel hub. Just sandwich it in there like you see in the pictures. Sandwiches all around!

The force of the magnet will create some pressure on the sensor to begin with. Pushing on it  (placing it in compression) will add more pressure to this. Pulling the node away from the strut  (putting it in tension) will lower the pressure. More pressure will decrease the electrical resistance, less pressure will increase the resistance. You can check this with your multimeter by hooking the leads up to to the conductive threads coming out of the sensor.

## Step 4: Connect the Sensors to Your Arduino

I would make a very sad electrical engineer. See the second picture on this step for an example of my failures. But you are probably much smarter than I or have more determination or simply can learn from my mistakes.

Connecting the sensors into the Arduino might be straightforward for you. Or, if you're like me, it might seem like some electrical voodoo magick and you just follow blindly what others have done. In any case, it requires setting up a voltage divider for each of the inputs. This lets the Arduino interpret your changing resistance as a changing voltage.

I'm totally not qualified to explain this, but here's my attempt: Your sensors have two leads coming from them. One goes to the +5V on your Arduino. The other connects to the Analog Input pin on the Arduino, and also in series to a resistor connected to the GND pin on the Arduino. The value of this resistor depends on the range of resistances your sensor creates. Instead of experimenting by swapping in and out resistors (or calculating it the engineering way), I just put a potentiometer in series and adjusted it until I got a reasonable response.

## Step 5: Set Up the Programs

Plug the Arduino into your computer (a connection even I can handle!) and upload the code below labeled "ARDUINO". Open Processing and run the code below labeled "PROCESSING".

ARDUINO CODE:
=====================
// www.plusea.at
// reads analog input from the five inputs from your arduino board
// and sends it out via serial
/ variables for input pins and
int analogInput0 = 0;
int analogInput1 = 1;
int analogInput2 = 2;
int analogInput3 = 3;
int analogInput4 = 4;
int analogInput5 = 5;

// variable to store the value
int value0 = 0;
int value1 = 0;
int value2 = 0;
int value3 = 0;
int value4 = 0;
int value5 = 0;

void setup(){
// declaration of pin modes
pinMode(analogInput0, INPUT);
pinMode(analogInput1, INPUT);
pinMode(analogInput2, INPUT);
pinMode(analogInput3, INPUT);
pinMode(analogInput4, INPUT);
pinMode(analogInput5, INPUT);

// begin sending over serial port
Serial.begin(9600);
}// end setup

void loop(){
// read the value on analog input
value0 = analogRead(analogInput0);
value1 = analogRead(analogInput1);
value2 = analogRead(analogInput2);
value3 = analogRead(analogInput3);
value4 = analogRead(analogInput4);
value5 = analogRead(analogInput5);

// print out value over the serial port
Serial.print(1, BYTE); //prefix
Serial.print(value0);
Serial.print(10, BYTE); //end signal

Serial.print(2, BYTE);
Serial.print(value1);
Serial.print(10, BYTE);

Serial.print(3, BYTE);
Serial.print(value2);
Serial.print(10, BYTE);

Serial.print(4, BYTE);
Serial.print(value3);
Serial.print(10, BYTE);

Serial.print(5, BYTE);
Serial.print(value4);
Serial.print(10, BYTE);

Serial.print(6, BYTE);
Serial.print(value5);
Serial.print(10, BYTE);

// wait for a bit to not overload the port
delay(100);
}// end loop

PROCESSING CODE:
=====================
/*
*  Based on code by Hannah Perner-Wilson, www.plusea.at
*  Modified by Sam Kronick www.newuntitledpage.com
*/

import processing.serial.*;

// definition of window size
// you can change the size of the window as you like
// the thresholdGraph will be scaled to fit
// the optimal size for the thresholdGraph is 1000 x 400
int xWidth = 800;
int yHeight = 600;

// Current values
int[] values = {0,0,0,0,0,0};

// Time-averaged values
int[] avgCounter = {0,0,0,0,0,0};
int[] avgs       = {0,0,0,0,0,0};

static final int INTERVAL = 5;

// Zero force values, changed on spacebar press
int[] zeros = {0,0,0,0,0,0};

// variables for serial connection. portname and baudrate are user specific
Serial port1;

//Set your serial port here (look at list printed when you run the application once)
String V3 = Serial.list()[0];
String portname1 = V3;
int baudrate = 9600;

int prefix = 1;
boolean myCatch = true;
int serialIN = 0;
int serialINPUT = 0;
String buffer = "";
int value = 0;

void setup(){
// set size and framerate
size(xWidth, yHeight);
frameRate(25);
background(255);
strokeWeight(5);
stroke(0);
smooth();
colorMode(HSB);

// establish serial port connection
port1 = new Serial(this, portname1, baudrate);
println(Serial.list());  // print serial list

}//end setup

void keyPressed() {
if(key == ' ') {
for(int i=0; i      zeros[i] = avgs[i];
}
}
}

// draw listens to serial port, draw
void draw(){
background(255);

// listen to serial port and trigger serial event
while(port1.available() > 0){
serialIN = port1.read();
serialEvent(serialIN);
}

for(int i=0; i<4; i++) {
if(frameCount % INTERVAL > 0) {
avgCounter[i] += values[i];
}
else {
avgs[i] = avgCounter[i] / INTERVAL;
avgCounter[i] = 0;
}

if(avgs[i] - zeros[i] < 0 )
fill(0, 20 * -(avgs[i] - zeros[i]), 250);
else
fill(100, 20 * (avgs[i] - zeros[i]), 250);

rect(width/2, height/4 * i, 10*(avgs[i]-zeros[i]), height/4);
}

}

void serialEvent(int serialINPUT){
if(myCatch == true) {
if(serialINPUT != 10) {
// add event to buffer
buffer += char(serialINPUT);
//println(serialINPUT);
}
else {
// if serial is line break set value to buffer value and clear buffer
value = int(buffer);
values[(prefix-1)] = value;
myCatch = false;
buffer="";
}
}
//myCatch is the beginging of the each sended number used to define the port
// myCatch gets true if serial is less than 10 since header is 1-9
if (!myCatch && serialINPUT < 10) {
myCatch = true;
prefix = int(serialINPUT);
}
}

## Step 6: Test Your Structure!

With the Processing code running, you should see four horizontal bars on your screen (it's hard coded to only handle four sensors; extending it for more or less is an exercise for the reader). Press the spacebar to set the zero-points (a one-point calibration!) and the bars should shrink to thin lines in the center of the screen.

Press on one of the nodes on your structure. You should see the width of the bars change. Green bars that extend to the right represent compression forces; red bars to the left represent tension forces. Try adjusting the resistor values/changing the potentiometers if you see a very small or too large of a response. You may need to press the space bar again to re-zero the sensors; they tend to drift quite a bit.

The software is doing a couple of things. First, it is averaging the past few readings to get rid of some noise. Second, it compares the averaged reading to the zero point you set, and determines if there is more or less force on the sensor. The size of the bar is only relative to itself; it's not calibrated to any unit of force. Maybe someone can figure out a way to do that. I'm not sure if the response from the sensors is linear, and that might be a problem.

Participated in the
Arduino Contest

## Recommendations

27 3.3K
18 1.5K
37 5.0K
Table Saw Class

16,213 Enrolled

## 4 Discussions

I think something is wrong with:
--------------------------------------------------------------
void keyPressed() {
if(key == ' ') {
for(int i=0; i zeros[i] = avgs[i];
}
}
}
--------------------------------------------------------------
because I get an error in processing saying:
"syntax error, maybe a missing semicolon?".

Can you please check this part again and correct it.

PS Thank you for posting this instructable because I was searching for how to read sensor with processing

Great instructable, been looking for something like this.
Your processing code has an error though I think:

for(int i=0; i      zeros[i] = avgs[i];

Have no idea what's going on here, you're missing the terminating bracket on the for loop, you've the initializations, but it's not clear what test or further loop instruction is being given.

Thanks, BR.