pressure sensor + arduino + processing signal analysis

Use arduino and processing to view sensor input from two FSRs.

components:

schematics:

Bild

setup:

1) install Arduino: follow the instructions here

2) upload the following code

int sensorPin_front = A0; // A0 is the input pin for front fsr
int sensorPin_back = A1; // A1 is the input pin for back fsr

int sensorValue_front = 0; // variable to store the value coming from the sensor
int sensorValue_back = 0;

void setup() {
// initialize serial:
Serial.begin(115200);
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}

void loop() {
// read the value from the sensor:
sensorValue_front = analogRead(sensorPin_front);
sensorValue_back = analogRead(sensorPin_back);

//send over serial
Serial.write( 0xff); //control byte
Serial.write( (sensorValue_front >> 8) & 0xff); //first byte
Serial.write( sensorValue_front & 0xff); //second byte
Serial.write( 0xfe);
Serial.write( (sensorValue_back >> 8) & 0xff);
Serial.write( sensorValue_back & 0xff);
//delay(100);
}

or download file here 

3) install Processing from here

4) I used this example and modified the code for this purpose. download modified code here. Change the com port to the com port that the arduino is connected to.

5) if pressure is applied you should see the following

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s