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.
Run this experiment →
Why it’s here
Relate a pressure input to output brightness.
How it works
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.
Try it
- Open this 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
Example sketch
void setup() {
pinMode(9, OUTPUT);
Serial.begin(9600);
}
void loop() {
int pressure = analogRead(A0);
analogWrite(9, pressure / 4);
Serial.println(pressure);
}Check your understanding
Does an input of 512 mean a force of 512 newtons?
Show the answer
No. It is a raw analog reading. Converting an FSR reading into force requires an appropriate circuit and calibration.