Connect the ideas · 15 / 16

Force Sensor: Pressure to LED Brightness

Vary a force-sensing resistor input and watch LED brightness change. Trace the analog reading to PWM without treating it as calibrated force.

6 minBeginner
What you’ll learn

Relate a pressure input to output brightness.

Understand it

The pressure control stands in for an ADC reading from a force-sensing resistor divider. It sets LED PWM through integer division by four. No force unit is inferred without calibration.

Your experiment

Run and increase the input from 0 through 512 to 1023. Compare the monitor’s PWM value with the LED brightness.

Connections

  • A0 — FSR voltage divider
  • D9 ~ — LED through resistor

Sketch

This sketch illustrates the hardware logic. The workbench runs its corresponding teaching model, not a C++ compiler.

void setup() {
  pinMode(9, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int pressure = analogRead(A0);
  analogWrite(9, pressure / 4);
  Serial.println(pressure);
}

Quick check

Does an input of 512 mean a force of 512 newtons?

Show explanation

No. It is a raw analog reading. Converting an FSR reading into force requires an appropriate circuit and calibration.

Go beyond the experiment

Connect the experiment with the fundamentals · Help & FAQ