其他传感器

压敏电阻在Arduino上的应用

字号+ 作者:duino123.com 来源:未知 2016-05-24 15:49 我要评论( )

压敏电阻在Arduino上的应用

压敏电阻或称FSR在一些交互设计中被广泛应用,并以其简单实用的性能在创客中占有了一席之地。





 

A FSR is just what it sounds like – a resistor that changes its resistance with force. So if you press, sit, or punch it, its resistance changes. The finicky part tends to be when people want it to measure force with any sort of precision. It’s really not good for that, so if you need something sense even approximate weight or quantitative force, this is not your guy. But if you need something that will let you know if someone is sitting in a chair, or hugging a stuffed animal, this is it!

连接与原理

The FSR changes its resistance with force. It ranges from near infinite when not being touched, to under 300ohms when pressed really hard. So we can measure that change using one of the Arduino’s analog inputs. But to do that we need a fixed resistor (not changing) that we can use for that comparison (We are using a 10K resistor). This is called a voltage divider and divides the 5v between the FSR and the resistor.

The analog read on your arduino is basically a voltage meter. At 5V (its max) it will read 1023, and at 0v it will read 0. So we can measure how much voltage is on the FSR using the analogRead and we will have our force reading.

The amount of that 5V that each part gets is proportional to its resistance. So if the the FSR and the resistor have the same resistance, the 5V is split evenly (2.5V) to each part. (analog reading of 512)

But if the FSR is pressed on pretty hard, reading only 1K of resistance, the 10K resistor is going to soak up 10 times as much of that 5V. So the FSR would only get .45V. (analog reading of 92)

And if something is barely pressing on it, the FSR may be 40K of resistance, so the FSR will soak up 4 times as much of that 5V as the 10K resistor. So the FSR would get 4V. (analog reading of 819)

代码

The arduino code for this just could not be easier. We are adding some serial prints and delays to it just so you can easily see the readings, but they dont need to be there if you dont need them.

int FSR_Pin = A0; //analog pin 0

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

void loop(){
  int FSRReading = analogRead(FSR_Pin); 

  Serial.println(FSRReading);
  delay(250); //just here to slow down the output for easier reading
}

如需更详细资料,如有好资源分享,请加入QQ交流群:214461008

欢迎阅读,欢迎转载,不用注明出处!本站只提供入门和进阶资料,做您学习的小伙伴!

老司机也欢迎光临指导!有好内容请加群:214461008 不要看声明了,看内容吧!

相关文章
  • 柔性滑变电位计在Arduino上的应用

    柔性滑变电位计在Arduino上的应用

    2016-05-24 17:01

  • Arduino风向风速传感器

    Arduino风向风速传感器

    2016-05-06 01:08

  • 如何Arduino利用SPI读取大气压力传感器

    如何Arduino利用SPI读取大气压力传感器

    2016-04-14 23:33

  • 语音识别模块Voice Recognition arduino

    语音识别模块Voice Recognition arduino

    2016-03-27 10:18

网友点评