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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
AWS News Blog
AWS News Blog
Google DeepMind News
Google DeepMind News
U
Unit 42
博客园 - 叶小钗
博客园 - 聂微东
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
美团技术团队
The Cloudflare Blog
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
S
Schneier on Security
C
Check Point Blog
Project Zero
Project Zero
The Hacker News
The Hacker News
Scott Helme
Scott Helme
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cisco Talos Blog
Cisco Talos Blog
P
Privacy International News Feed
SecWiki News
SecWiki News
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
H
Help Net Security
TaoSecurity Blog
TaoSecurity Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Last Week in AI
Last Week in AI
P
Privacy & Cybersecurity Law Blog
Forbes - Security
Forbes - Security
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
T
The Exploit Database - CXSecurity.com
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
大猫的无限游戏
大猫的无限游戏
T
Troy Hunt's Blog
H
Hacker News: Front Page
Vercel News
Vercel News

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 Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
5 FSR-402 Force Sensing Projects for HCI Research and Human Sensing
張旭豐 · 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