Force Sensitive Resistor Hookup Guide - MAE540-2017 Team 8

By Samir, Aditya, Hamdan, Arjun, Priyank

Item List: This is a list of items required for running the sensor: Bill of Materials

1. Application of FSR Sensor : Security System

2. Introduction to FSR Sensor

Detail drawing of FSR

3. Schematic of Hookup and Hardware

The following is the setup required for hooking up the FSR Sensor.

Schematic Diagram

FTDI Hook up

Final Set-up

4. Arduino Code


#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "Blynk Auth Code goes here";
char ssid[] = "WiFi name";
char pass[] = "WiFi password";

const int FSR_PIN = A0; // Pin connected to FSR/resistor divider
const float VCC = 3.28; // Measured voltage of Sparkfun 3.3v
const float R_DIV = 9788.0; // Measured resistance of 10k resistor

void setup()
{
  Blynk.begin(auth, ssid, pass);
  Serial.begin(9600);
  pinMode(FSR_PIN, INPUT);
}

void loop()
{
  int fsrADC = analogRead(FSR_PIN);
  // If the FSR has no pressure, the resistance will be
  // near infinite. So the voltage should be near 0.
  if (fsrADC != 0) // If the analog reading is non-zero
  {
    // Use ADC reading to calculate voltage:
    float fsrV = fsrADC * VCC / 1023.0;
    // Use voltage and static resistor value to
    // calculate FSR resistance:
    float fsrR = R_DIV * (VCC / fsrV - 1.0);
    Serial.println("Resistance: " + String(fsrR) + " ohms");
    // Guesstimate force based on slopes in figure 3 of
    // FSR datasheet:
    float force;
    float fsrG = 1.0 / fsrR; // Calculate conductance
    // Break parabolic curve down into two linear slopes:
    if (fsrR <= 600)
      force = (fsrG - 0.00075) / 0.00000032639;
    else
      force =  fsrG / 0.000000642857;
    Serial.println("Force: " + String(force) + " g");
    Serial.println();
    Blynk.run();
    Blynk.virtualWrite(fsrADC, force);
    delay(500);
    if (force > 800);
    {
      Blynk.email("chausamir@gmail.com", "Security Alert!", "ATTENTION: Activity near safe locker. Security system has detected imminent threat to valuables. From APDM Team#8");
    }
  }
}



5. The Experiment & Result

Blynk Setup:

Blynk needs to have widgets added for receiving FSR data, plotting amplitude of force vs. time and then sending an email to the user.

Blynk Button

Blynk Guage

Blynk History Graph

Blynk Email

Result of Experiment

Blynk Output1

Blynk Output2

Blynk Output3

Alert Email

The applications of the Force Sensitive Resistor are varied and can be used for several other real-world problems. This security system application can be used by banks, home safe lockers and office lockers.

References:

  1. https://www.sparkfun.com/datasheets/Sensors/Pressure/fsrguide.pdf
  2. https://www.sparkfun.com/products/9375
  3. https://learn.sparkfun.com/tutorials/force-sensitive-resistor-hookup-guide
  4. https://cdn-learn.adafruit.com/downloads/pdf/force-sensitive-resistor-fsr.pdf
  5. http://fritzing.org/building-circuit/