惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
博客园 - 叶小钗
J
Java Code Geeks
博客园 - 聂微东
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
美团技术团队
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
罗磊的独立博客
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
小众软件
小众软件

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
5 FSR-402 Force Sensing Projects for HCI Research and Hum...
張旭豐 · 2026-04-30 · via DEV Community

5 FSR-402 Force Sensing Projects for HCI Research and Human Sensing

Build pressure-aware systems: seating posture monitor, musical expression controller, accessibility switch, smart door handle, and grip force trainer

Hero

The FSR-402 (Force Sensing Resistor) is a thin, flexible polymer thick film device that decreases resistance as force is applied across its surface. Unlike load cells that measure weight precisely, FSR-402 is designed for qualitative force detection — it tells you whether someone is touching something, how hard they are pressing, and whether the pressure is increasing or decreasing. The sensor has a 0.1N to 100N force range, responds in milliseconds, and requires no special libraries — just an analog input and a 10kΩ pull-down resistor.

In HCI research, FSR-402 is used for seating posture detection, foot pressure analysis, musical expression control, and accessibility switches because it can detect physical human presence without requiring the person to do anything specific — just sit, stand, or press naturally.

In this guide, we build five human-sensing projects that translate physical pressure into interactive system responses.

Topics covered: FSR voltage-divider circuit, analog calibration, threshold-based state machines, MIDI velocity mapping, seating posture analysis, accessibility switch design, Arduino Nano analog read.


What You'll Need

  • FSR-402 (×1-4 depending on project)
  • Arduino Nano or Uno (×1)
  • 10kΩ resistor (×1, for voltage divider)
  • LED strip WS2812B (×1, for posture/visualization projects)
  • MIDI-compatible circuit (for musical projects)
  • Buzzer (×1, for accessibility switch)
  • Servo motor SG90 (×1, for door handle project)
  • Jumper wires and breadboard
  • USB cable for programming

How FSR-402 Works

Technical Principle

FSR-402 consists of two layers separated by a spacer. The active zone is a force-sensitive conductive polymer whose resistance varies inversely with applied force. At rest (no force), resistance is typically above 1MΩ. As force increases, resistance drops: at 10N it is around 10kΩ, and at 100N it can fall below 1kΩ. Because the relationship is non-linear and highly variable between individual sensors, FSR is used for relative force detection rather than absolute weight measurement.

Wiring Diagram (Voltage Divider)

Arduino          FSR-402
  A0       ───  One FSR lead
  5V       ───  Other FSR lead (with 10kΩ to GND as pull-down)

Actual circuit:
  5V  ───  FSR  ───  A0  ───  10kΩ  ───  GND

Enter fullscreen mode Exit fullscreen mode

Calibration Considerations

FSR-402 sensors have significant part-to-part variation (up to ±30%). Each sensor must be calibrated individually. The ADC reading maps to force as:

Force (N)  10000 / (ADC_value)   // Rough approximation only

Enter fullscreen mode Exit fullscreen mode

For research applications, always calibrate against a known reference and report your calibration equation.

Important Notes

Consideration Detail
Hysteresis FSR-402 shows different resistance when force is increasing vs decreasing — allow settling time
Temperature Operating range 0–70°C; performance degrades outside this range
Creep Under sustained force, the polymer slowly deforms — not suitable for continuous load monitoring
Response time < 1ms response, suitable for real-time interaction
Force range 0.1N (barely perceptible) to 100N (firm press)

Basic Example Code

// WF1 Run #051 - Basic FSR Force Reading
#define FSR_PIN       A0
#define PULL_DOWN_OHM 10000

void setup() {
  Serial.begin(115200);
}

void loop() {
  int adcRaw = analogRead(FSR_PIN);

  // Voltage divider: Vout = 5V * R / (R_FSR + 10000)
  // ADC maps 0-1023 to 0-5V, so:
  // R_FSR = (5V * 10000) / (Vout) - 10000
  float Vout = adcRaw * (5.0 / 1023.0);
  float R_fsr = (5.0 * PULL_DOWN_OHM / Vout) - PULL_DOWN_OHM;

  // Convert to approximate force (N) — calibration required for accuracy
  float forceN = 10000.0 / max(R_fsr, 100.0);  // Avoid divide by zero

  Serial.print("ADC: ");
  Serial.print(adcRaw);
  Serial.print("  R: ");
  Serial.print(R_fsr);
  Serial.print(" ohm  ~Force: ");
  Serial.print(forceN);
  Serial.println(" N");

  delay(100);
}

Enter fullscreen mode Exit fullscreen mode


Project 1: HCI Seating Posture Monitor

Goal: Detect whether a person is sitting, leaning forward, or absent from a chair, using pressure distribution from four FSR-402 sensors placed under the seat cushion

Lab environment: researcher placing FSR-402 under chair cushion

Hardware

  • FSR-402 (×4)
  • Arduino Nano (×1)
  • 10kΩ resistor (×4)
  • WS2812B LED strip (×12, arranged in a row)
  • Power supply 5V/2A

Code

// WF1 Run #051 - Project 1: Seating Posture Monitor
#include <FastLED.h>

#define NUM_ZONES  4
const int FSR_PINS[NUM_ZONES] = {A0, A1, A2, A3};
const int LED_PINS[NUM_ZONES] = {2, 3, 4, 5};

#define NO_SITTING_THRESHOLD   30   // ADC — very light or no pressure
#define LEANING_THRESHOLD     200   // ADC — partial weight
#define SITTING_THRESHOLD     500   // ADC — full weight

enum PostureState { ABSENT, SITTING_UPRIGHT, LEANING_FORWARD, UNKNOWN };
PostureState currentPosture = ABSENT;

void setup() {
  Serial.begin(115200);
  for (int i = 0; i < NUM_ZONES; i++) {
    pinMode(FSR_PINS[i], INPUT);
  }
  FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
}

int readFSR(int pin) {
  int sum = 0;
  for (int i = 0; i < 10; i++) sum += analogRead(pin);
  return sum / 10;  // Average 10 readings to reduce noise
}

PostureState determinePosture(int readings[]) {
  int total = 0;
  int frontWeight = 0;
  int backWeight = 0;

  for (int i = 0; i < NUM_ZONES; i++) {
    total += readings[i];
    if (i < 2) frontWeight += readings[i];   // Front sensors
    else backWeight += readings[i];           // Back sensors
  }

  if (total < NO_SITTING_THRESHOLD * NUM_ZONES) return ABSENT;
  if (frontWeight > backWeight * 1.5) return LEANING_FORWARD;
  if (total > SITTING_THRESHOLD * NUM_ZONES) return SITTING_UPRIGHT;
  return UNKNOWN;
}

void loop() {
  int readings[NUM_ZONES];
  for (int i = 0; i < NUM_ZONES; i++) {
    readings[i] = readFSR(FSR_PINS[i]);
  }

  PostureState posture = determinePosture(readings);

  // Visual feedback via LED strip
  for (int i = 0; i < NUM_LEDS; i++) leds[i] = CRGB(0, 0, 0);

  if (posture == ABSENT) {
    // All off
  } else if (posture == SITTING_UPRIGHT) {
    fill_solid(leds, NUM_LEDS, CRGB(0, 50, 0));  // Green
  } else if (posture == LEANING_FORWARD) {
    fill_solid(leds, NUM_LEDS, CRGB(50, 30, 0)); // Yellow-amber
  } else {
    fill_solid(leds, NUM_LEDS, CRGB(30, 0, 0));  // Red
  }
  FastLED.show();

  // Serial output for research logging
  Serial.print("Posture: ");
  Serial.print(posture == ABSENT ? "ABSENT" :
               posture == SITTING_UPRIGHT ? "UPRIGHT" :
               posture == LEANING_FORWARD ? "LEANING" : "UNKNOWN");
  Serial.print(" | Readings: ");
  for (int i = 0; i < NUM_ZONES; i++) {
    Serial.print(readings[i]);
    Serial.print(" ");
  }
  Serial.println();

  delay(200);
}

Enter fullscreen mode Exit fullscreen mode


Project 2: Musical Expression Controller

Goal: Convert foot pressure from an FSR-402 mat into MIDI velocity messages for real-time musical expression control

Concert stage: musician foot pressing pressure mat with LED visualization

Hardware

  • FSR-402 (×1, large format or mat-style)
  • Arduino Nano (×1)
  • 10kΩ resistor (×1)
  • 5-pin MIDI DIN connector (×1)
  • 220Ω resistor (×1, for MIDI TX protection)
  • WS2812B LED strip (×8, for visual pressure feedback)

Code

// WF1 Run #051 - Project 2: FSR-to-MIDI Expression Controller
// Sends MIDI Note On/CC messages based on foot pressure

#define FSR_PIN         A0
#define LED_DATA_PIN    6
#define NUM_LEDS        8
#define MIDI_CHANNEL    1
#define NOTE_NUMBER     48   // C3

#define MIDI_CC          74   // CC for modulation
#define PRESSURE_THRESHOLD 50  // Minimum pressure to trigger note
#define PEAK_TIMEOUT_MS   300  // Time between note triggers

CRGB leds[NUM_LEDS];

bool noteIsOn = false;
unsigned long lastNoteTime = 0;
int peakPressure = 0;

void setup() {
  Serial.begin(31250);  // MIDI baud rate
  FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
  Serial.write(0xFE);   // Active sensing — keep connection alive
}

int readFSR() {
  int sum = 0;
  for (int i = 0; i < 5; i++) sum += analogRead(FSR_PIN);
  return sum / 5;
}

void midiNoteOn(int cmd, int note, int velocity) {
  Serial.write(cmd | MIDI_CHANNEL);
  Serial.write(note);
  Serial.write(constrain(velocity, 0, 127));
}

void midiCC(int cc, int value) {
  Serial.write(0xB0 | MIDI_CHANNEL);  // CC message on channel 1
  Serial.write(cc);
  Serial.write(constrain(value, 0, 127));
}

void updateLED(int pressure) {
  int litLEDs = map(constrain(pressure, 0, 1023), 0, 1023, 0, NUM_LEDS);
  for (int i = 0; i < NUM_LEDS; i++) {
    if (i < litLEDs) {
      leds[i] = CRGB(0, map(i, 0, NUM_LEDS, 50, 200), 0);  // Green gradient
    } else {
      leds[i] = CRGB(0, 0, 0);
    }
  }
  FastLED.show();
}

void loop() {
  int pressure = readFSR();

  // Update visual feedback
  updateLED(pressure);

  // Send continuous CC for expression
  int ccValue = map(pressure, 0, 1023, 0, 127);
  midiCC(MIDI_CC, ccValue);

  // Trigger note on threshold crossing
  if (pressure > PRESSURE_THRESHOLD && !noteIsOn) {
    // Map pressure to velocity (0-1023 → 1-127)
    int velocity = map(pressure, PRESSURE_THRESHOLD, 1023, 1, 127);
    midiNoteOn(0x90, NOTE_NUMBER, velocity);  // Note On
    noteIsOn = true;
    lastNoteTime = millis();
    peakPressure = pressure;
  } else if (pressure > peakPressure) {
    // Track peak pressure during note sustain
    peakPressure = pressure;
    int velocity = map(peakPressure, PRESSURE_THRESHOLD, 1023, 1, 127);
    midiNoteOn(0x90, NOTE_NUMBER, velocity);  // Update velocity
  }

  // Release note when pressure drops
  if (noteIsOn && pressure < PRESSURE_THRESHOLD) {
    midiNoteOn(0x80, NOTE_NUMBER, 0);  // Note Off
    noteIsOn = false;
    peakPressure = 0;
  }

  // Safety timeout — prevent stuck notes
  if (noteIsOn && (millis() - lastNoteTime) > 2000) {
    midiNoteOn(0x80, NOTE_NUMBER, 0);
    noteIsOn = false;
  }

  delay(10);
}

Enter fullscreen mode Exit fullscreen mode


Project 3: Accessibility Touch Switch

Goal: Replace mechanical switches for users with limited motor control — even the lightest touch on an FSR-402 pad triggers a reliable activation signal

Hardware

  • FSR-402 (×1)
  • Arduino Nano (×1)
  • 10kΩ resistor (×1)
  • Relay module or optocoupler (×1, for connecting to external device)
  • LED indicator (×1)

Code

// WF1 Run #051 - Project 3: Accessibility Touch Switch
#define FSR_PIN         A0
#define RELAY_PIN       8
#define LED_PIN         13
#define ACTIVATION_FORCE 20   // ADC threshold — very light touch
#define DEBOUNCE_MS     150

bool switchState = false;
unsigned long lastActivation = 0;

void setup() {
  Serial.begin(9600);
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, LOW);
  digitalWrite(LED_PIN, LOW);
}

int readFSR() {
  int sum = 0;
  for (int i = 0; i < 5; i++) sum += analogRead(FSR_PIN);
  return sum / 5;
}

void activate() {
  if (millis() - lastActivation < DEBOUNCE_MS) return;
  switchState = !switchState;
  digitalWrite(RELAY_PIN, switchState ? HIGH : LOW);
  digitalWrite(LED_PIN, switchState ? HIGH : LOW);
  Serial.println(switchState ? "SWITCH ON" : "SWITCH OFF");
  lastActivation = millis();
}

void loop() {
  int pressure = readFSR();
  if (pressure > ACTIVATION_FORCE) {
    activate();
    delay(300);  // Prevent rapid re-triggering while finger is on sensor
  }
  delay(50);
}

Enter fullscreen mode Exit fullscreen mode


Project 4: Smart Door Handle Presence Detection

Goal: Detect whether a person is gripping the door handle before unlocking — useful for security systems or smart home automation

Hardware

  • FSR-402 (×1, small format)
  • Arduino Nano (×1)
  • 10kΩ resistor (×1)
  • Servo motor SG90 (×1, for physical confirmation feedback)
  • LED (×1)

Code

// WF1 Run #051 - Project 4: Door Handle Presence Detection
#define FSR_PIN       A0
#define SERVO_PIN     5
#define LED_PIN       13

#define GRIP_THRESHOLD 80   // ADC — light grip detection
#define UNGRIP_THRESHOLD 30 // ADC — released

#include <Servo.h>
Servo lockServo;

enum GripState { RELEASED, GRIPPED };
GripState currentGrip = RELEASED;
bool doorIsLocked = true;

void setup() {
  Serial.begin(9600);
  pinMode(FSR_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  lockServo.attach(SERVO_PIN);
  lockServo.write(0);  // Locked position
}

int readFSR() {
  int sum = 0;
  for (int i = 0; i < 5; i++) sum += analogRead(FSR_PIN);
  return sum / 5;
}

void lockDoor() {
  if (!doorIsLocked) {
    lockServo.write(0);   // Locked
    doorIsLocked = true;
    digitalWrite(LED_PIN, HIGH);  // Red LED = locked
    Serial.println("DOOR LOCKED");
  }
}

void unlockDoor() {
  if (doorIsLocked) {
    lockServo.write(90);  // Unlocked
    doorIsLocked = false;
    digitalWrite(LED_PIN, LOW);   // Green LED = unlocked
    Serial.println("DOOR UNLOCKED");
  }
}

void loop() {
  int pressure = readFSR();

  if (pressure > GRIP_THRESHOLD && currentGrip == RELEASED) {
    currentGrip = GRIPPED;
    Serial.print("GRIP DETECTED: ");
    Serial.println(pressure);
    // Light grip does not unlock — requires a second grip within 3 seconds
    // This is a simple anti-accidental activation measure
  } else if (pressure < UNGRIP_THRESHOLD && currentGrip == GRIPPED) {
    currentGrip = RELEASED;
    Serial.println("GRIP RELEASED");
    // Optional: auto-lock after timeout
    // lockDoor();
  }

  delay(50);
}

Enter fullscreen mode Exit fullscreen mode


Project 5: Robotic Grip Force Trainer

Goal: Train a robotic gripper to apply consistent force by monitoring FSR-402 feedback — the gripper releases when force matches the target range

Hardware

  • FSR-402 (×1)
  • Arduino Nano (×1)
  • 10kΩ resistor (×1)
  • Servo motor SG90 (×1)
  • LED (×2: green for target, red for over-force)

Code

// WF1 Run #051 - Project 5: Grip Force Trainer
#include <Servo.h>

#define FSR_PIN          A0
#define SERVO_PIN        5
#define GREEN_LED_PIN    3
#define RED_LED_PIN      4

#define TARGET_FORCE_MIN 200  // ADC — target force range
#define TARGET_FORCE_MAX 400
#define GRIP_ANGLE       90   // Servo angle for gripping
#define RELEASE_ANGLE     0   // Servo angle for releasing

Servo gripperServo;

bool isGripping = false;

void setup() {
  Serial.begin(9600);
  pinMode(FSR_PIN, INPUT);
  pinMode(GREEN_LED_PIN, OUTPUT);
  pinMode(RED_LED_PIN, OUTPUT);
  gripperServo.attach(SERVO_PIN);
  gripperServo.write(RELEASE_ANGLE);

  Serial.println("Grip Force Trainer Ready");
  Serial.print("Target range: ");
  Serial.print(TARGET_FORCE_MIN);
  Serial.print(" - ");
  Serial.print(TARGET_FORCE_MAX);
  Serial.println(" ADC");
}

int readFSR() {
  int sum = 0;
  for (int i = 0; i < 5; i++) sum += analogRead(FSR_PIN);
  return sum / 5;
}

void setGrip(bool grip) {
  isGripping = grip;
  gripperServo.write(grip ? GRIP_ANGLE : RELEASE_ANGLE);
  Serial.println(grip ? "GRIP ENGAGED" : "GRIP RELEASED");
}

void loop() {
  int force = readFSR();

  // Visual feedback
  if (force >= TARGET_FORCE_MIN && force <= TARGET_FORCE_MAX) {
    digitalWrite(GREEN_LED_PIN, HIGH);  // In target range
    digitalWrite(RED_LED_PIN, LOW);
  } else if (force > TARGET_FORCE_MAX) {
    digitalWrite(RED_LED_PIN, HIGH);   // Too much force
    digitalWrite(GREEN_LED_PIN, LOW);
    if (isGripping) setGrip(false);    // Release if over-force
  } else {
    digitalWrite(GREEN_LED_PIN, LOW);
    digitalWrite(RED_LED_PIN, LOW);
    if (!isGripping) setGrip(true);    // Grip if too little force
  }

  Serial.print("Force: ");
  Serial.print(force);
  Serial.print(" | Status: ");
  Serial.println(
    force >= TARGET_FORCE_MIN && force <= TARGET_FORCE_MAX ? "TARGET OK" :
    force > TARGET_FORCE_MAX ? "OVER FORCE — RELEASING" :
    "UNDER FORCE — GRIPPING"
  );

  delay(100);
}

Enter fullscreen mode Exit fullscreen mode


Troubleshooting

Problem Cause Fix
FSR reads 0 or max always Wiring error — one lead disconnected Check both FSR leads are connected to the voltage divider
Readings jump randomly FSR lead wires are fragile Solder leads or use a connector with strain relief
Sensor triggers without touch High ambient noise or floating input Add 100kΩ pull-down resistor on signal line
Force calibration inconsistent FSR-402 has ±30% part variation Individual calibration required; log your own calibration curve
Servo jitter when gripping Insufficient current from Arduino Power servo from external 5V supply, share GND with Arduino
MIDI not received MIDI baud rate wrong Must use 31250 baud, not 9600

Start Here

Affiliate disclosure: As an Amazon Associate, I earn from qualifying purchases.

The right parts make the difference:

FSR-402 force sensing resistor — the standard force-sensing resistor for HCI research and human presence detection. Thin, flexible, and reliable for seating, grip, and touch applications.

Arduino Nano CH340 — compact breadboard-compatible microcontroller. Ideal for multi-sensor FSR projects where space and analog inputs are at a premium.

MIDI DIN connector 5-pin — for building MIDI expression controllers. Required for connecting Arduino serial MIDI to standard MIDI equipment.

Servo motor SG90 — the standard micro servo for gripper projects, door locks, and robotic grip force trainers.


Next Step: Human Sensing Design for Your Specific Application

If this guide gave you a clear direction for your human-sensing project — but you need a custom design tailored to your specific user population, physical environment, and interaction requirements — I can help you design that.

I offer a personalized interactive device design guide at Fiverr:

👉 https://www.fiverr.com/phd_hfchang/generate-an-arduino-interactive-prototypef

What you get:

  • FSR sensor selection and placement optimized for your specific use case
  • Calibration methodology for your target user population
  • Interaction logic with hysteresis and debouncing tuned for real-world conditions
  • Testing protocol with pass/fail criteria for reliability validation

Tags: Arduino, FSR-402, Force Sensor, HCI, Human Sensing, Posture Detection, MIDI, Accessibility, Robotics, Gripper, Interactive