Extracting FSR data to Excel Spreadsheet

Hello folks,

I am a student in a healthcare profession (with no prior experience with programming) and am currently working on a project to measure changes in tactile pressure during handwriting among children. My current set-up uses a small 19mm Tactilus force sensitive resistor, Arduino Uno microcontroller, and PLX-DAQ software to extract FSR data into an excel spreadsheet.

The primary issue I’m currently facing is successfully integrating the code for the FSR measurements and the lines of code needed to export this data to excel. The current code I’m using for the FSR is below:

/* FSR testing sketch. 
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground 
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0;     // the FSR and 10K pulldown are connected to a0
int fsrReading;     // the analog reading from the FSR resistor divider
int fsrVoltage;     // the analog reading converted to voltage
unsigned long fsrResistance;  // The voltage converted to resistance, can be very big so make "long"
unsigned long fsrConductance; 
long fsrForce;       // Finally, the resistance converted to force
void setup(void) {
  Serial.begin(9600);   // We'll send debugging information via the Serial monitor
void loop(void) {
  fsrReading = analogRead(fsrPin);  
  Serial.print("Analog reading = ");
  // analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV)
  fsrVoltage = map(fsrReading, 0, 1023, 0, 5000);
  Serial.print("Voltage reading in mV = ");
  if (fsrVoltage == 0) {
    Serial.println("No pressure");  
  } else {
    // The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V
    // so FSR = ((Vcc - V) * R) / V        yay math!
    fsrResistance = 5000 - fsrVoltage;     // fsrVoltage is in millivolts so 5V = 5000mV
    fsrResistance *= 10000;                // 10K resistor
    fsrResistance /= fsrVoltage;
    Serial.print("FSR resistance in ohms = ");
    fsrConductance = 1000000;           // we measure in micromhos so 
    fsrConductance /= fsrResistance;
    Serial.print("Conductance in microMhos: ");
    // Use the two FSR guide graphs to approximate the force
    if (fsrConductance <= 1000) {
      fsrForce = fsrConductance / 80;
      Serial.print("Force in Newtons: ");
    } else {
      fsrForce = fsrConductance - 1000;
      fsrForce /= 30;
      Serial.print("Force in Newtons: ");

This has worked fairly well insofar as getting the values I need printed onto the serial monitor. Below is the code provided by the PLX-DAQ instructable for exporting this data.

//always starts in line 0 and writes the thing written next to LABEL
void setup() {
Serial.begin(9600); // the bigger number the better
Serial.println("CLEARDATA"); //clears up any data left from previous projects
Serial.println("LABEL,Acolumn,Bcolumn,..."); //always write LABEL, so excel knows the next things will be the names of the columns (instead of Acolumn you could write Time for instance)
Serial.println("RESETTIMER"); //resets timer to 0
void loop() {
Serial.print("DATA,TIME,TIMER,"); //writes the time in the first column A and the time since the measurements started in column B
Serial.println(...); //be sure to add println to the last command so it knows to go into the next row on the second run
delay(100); //add a delay

I’ve tried fitting these lines in, however my limited (nonexistent) programming skills have only got me so far as spitting out data in time and ohms in excel. The time is valuable since I need a timestamp for the data, however the only other meaningful measurements for my project would be force, particularly in Newtons (preferably measured by the hundredth).

If anyone can offer some guidance on combining these codes (or hell, wants to do it for me), it would be greatly appreciated. **Bonus points too if anybody could assist with setting up and collecting separate data from 2 or 3 FSRs, as we would love to collect individual data from multiple fingers during handwriting.

Thank you!

You need to separate the data items with commas, and of course “…” is not a valid data item.

Try something like:

Serial.print("DATA,TIME,TIMER,"); //writes the time in the first column A and the time since the measurements started in column B
Serial.print(",");  //comma separator

PLX-DAQ version 2 comes with plenty of examples, so study them very carefully.

If you wish to pay someone to write code for you, post on the Gigs and Collaborations forum section.

We strongly recommend to start with the simple examples that come with Arduino, in order to learn the programming language and special features of the Arduino, rather than tackling a complex project like this as your first.