概述
FSR是傳感器,可讓您檢測物理壓力,擠壓和重量。它們易于使用且成本低廉。這是FSR(特別是Interlink 402模型)的照片。直徑為1/2“的圓形部分是敏感位。
FSR由2組成
FSR基本上是一個電阻,其電阻值會根據(jù)變化而變化(以歐姆Ω為單位)這些傳感器的成本相當?shù)土?,易于使用,但精確度極低。每個傳感器之間的誤差也可能相差10%,因此,基本上,當您使用FSR時,您應(yīng)該只期望得到響應(yīng)范圍。盡管FSR可以檢測體重,但對于準確檢測體重是多少,這是一個錯誤的選擇。
但是,對于大多數(shù)觸摸感應(yīng)應(yīng)用,例如“這被擠壓了嗎或推高了多少”,這筆錢真是物超所值!
一些基本統(tǒng)計信息
這些統(tǒng)計信息專門針對Interlink 402,但幾乎所有FSR都是相似的。檢查數(shù)據(jù)表將始終發(fā)現(xiàn)任何差異
尺寸:直徑為1/2英寸(12.5毫米)的有效區(qū)域乘以0.02英寸厚(Interlink確實有一些大小為1.5“ x1.5”)
價格 $ 7.00來自Adafruit商店
電阻范圍:無限/開路(無壓力),100K Ω(輕壓力)至200Ω(最大壓力)
力范圍:0到20磅(0到100牛頓)均勻地施加在0.125平方米的表面積上
電源:任何!使用小于1mA的電流(取決于使用的任何上拉/下拉電阻器和電源電壓)
數(shù)據(jù)表(請注意,此處存在一些數(shù)學上的矛盾之處) )
如何使用FSR測量力/壓力 我們已經(jīng)說過,隨著施加更大的壓力,F(xiàn)SR的阻力會發(fā)生變化。當沒有壓力時,傳感器看起來就像一個無限電阻(開路),隨著壓力的增加,電阻會降低。該圖表明在不同的力測量下傳感器的電阻。 (請注意,力不是以克為單位,而是真正意義上的牛頓* 100?。?/p>
重要的是要注意該圖并不是真正的 linear (它是一個對數(shù)/對數(shù)圖),并且在極低的力測量下,它迅速從無窮大變?yōu)?00KΩ。
測試FSR
確定FSR工作方式的最簡單方法是將萬用表以電阻測量模式連接到傳感器的兩個選項卡,并查看電阻如何變化。由于電阻變化很大,因此自動量程儀表在這里可以很好地工作。否則,只需確保在“放棄”之前嘗試在1 Mohm和100 ohm之間的不同范圍。
連接到FSR
由于FSR本質(zhì)上是電阻器,因此它們是無極性的。這意味著您可以將它們“以任何一種方式”連接起來,它們就可以正常工作!
FSR通常是絲網(wǎng)印刷導(dǎo)電材料的聚合物。這意味著它們是塑料的,連接接線片壓在有些精致的材料上。最好的連接方法是將它們插入面包板。
或接線端子,例如 Phoenix#1881448
可以焊接到突舌上,但是 您必須非???,因為如果您的熨斗質(zhì)量不好或者您甚至會發(fā)硬幾秒鐘,您將熔化塑料并破壞FSR! 除非您絕對確定自己有技能,否則不要嘗試直接將其焊接到FSR。
使用FSR
模擬電壓讀數(shù)方法 測量電阻傳感器的最簡單方法是將一端連接到電源,另一端連接到下拉電阻器到地面。然后,將固定下拉電阻器和可變FSR電阻器之間的點連接到諸如Arduino之類的微控制器的模擬輸入(如圖所示)。
在此示例中,我顯示的是5V電源,但請注意,您可以將其與3.3v電源一樣容易地使用。在這種配置下,模擬電壓讀數(shù)的范圍為0V(接地)至大約5V(或與電源電壓大致相同)。
工作原理是,隨著FSR的電阻減小,電容FSR和下拉電阻的總電阻從大約100Kohm降低到10Kohm。這意味著流過兩個電阻器的電流增加,這又導(dǎo)致固定的10K電阻器兩端的電壓增加。
力(磅)力(N)FSR電阻(FSR + R)ohm流過FSR + RR兩端的電壓的電流》無無無限無限!0 mA0V
0.04磅0.2 N30 Kohm40 Kohm0.13 mA1.3 V
0.22磅1 N6 Kohm16 Kohm0.31 mA3.1 V
2.2 lb10 N1 Kohm11 Kohm0.45 mA4.5 V
22磅100 N250歐姆10.25 Kohm0.49 mA4.9 V
該表根據(jù)傳感器力/電阻(帶5V電源和10K下拉電阻)顯示了近似模擬電壓。
請注意,我們的方法采用的電阻率有些線性,但不提供線性電壓!這是因為電壓等式為:
Vo = Vcc(R/(R + FSR))
即電壓成比例到FSR電阻的 倒 。
簡單的使用演示與上面的示例相同,將FSR接線,但是這次允許在引腳11上添加一個LED。
此草圖將采用模擬電壓讀數(shù),并以此來確定紅色LED有多亮。按下FSR的力度越大,LED將會越亮!請記住,LED必須連接到PWM引腳才能正常工作,在此示例中,我使用引腳11。
這些示例假定您知道一些基本的Arduino編程。如果您不愿意,也許花一些時間在Arduino教程中復(fù)習基礎(chǔ)知識?
下載:file
復(fù)制代碼
/* FSR testing sketch.
Connect one end of FSR to 5V, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
Connect LED from pin 11 through a resistor to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrAnalogPin = 0; // FSR is connected to analog 0
int LEDpin = 11; // connect Red LED to pin 11 (PWM pin)
int fsrReading; // the analog reading from the FSR resistor divider
int LEDbrightness;
void setup(void) {
Serial.begin(9600); // We‘ll send debugging information via the Serial monitor
pinMode(LEDpin, OUTPUT);
}
void loop(void) {
fsrReading = analogRead(fsrAnalogPin);
Serial.print(“Analog reading = ”);
Serial.println(fsrReading);
// we’ll need to change the range from the analog reading (0-1023) down to the range
// used by analogWrite (0-255) with map!
LEDbrightness = map(fsrReading, 0, 1023, 0, 255);
// LED gets brighter the harder you press
analogWrite(LEDpin, LEDbrightness);
delay(100);
} /* FSR testing sketch.
Connect one end of FSR to 5V, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
Connect LED from pin 11 through a resistor to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrAnalogPin = 0; // FSR is connected to analog 0
int LEDpin = 11; // connect Red LED to pin 11 (PWM pin)
int fsrReading; // the analog reading from the FSR resistor divider
int LEDbrightness;
void setup(void) {
Serial.begin(9600); // We‘ll send debugging information via the Serial monitor
pinMode(LEDpin, OUTPUT);
}
void loop(void) {
fsrReading = analogRead(fsrAnalogPin);
Serial.print(“Analog reading = ”);
Serial.println(fsrReading);
// we’ll need to change the range from the analog reading (0-1023) down to the range
// used by analogWrite (0-255) with map!
LEDbrightness = map(fsrReading, 0, 1023, 0, 255);
// LED gets brighter the harder you press
analogWrite(LEDpin, LEDbrightness);
delay(100);
}
用于模擬FSR測量的簡單代碼 這是用于測量模擬引腳上FSR的代碼示例。
此代碼不進行任何計算,只是以定性的方式打印出其解釋為壓力的大小。對于大多數(shù)項目,這幾乎就是所有需要的東西!
下載:file
復(fù)制代碼
/* FSR simple testing sketch.
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
void setup(void) {
// We‘ll send debugging information via the Serial monitor
Serial.begin(9600);
}
void loop(void) {
fsrReading = analogRead(fsrPin);
Serial.print(“Analog reading = ”);
Serial.print(fsrReading); // the raw analog reading
// We’ll have a few threshholds, qualitatively determined
if (fsrReading 《 10) {
Serial.println(“ - No pressure”);
} else if (fsrReading 《 200) {
Serial.println(“ - Light touch”);
} else if (fsrReading 《 500) {
Serial.println(“ - Light squeeze”);
} else if (fsrReading 《 800) {
Serial.println(“ - Medium squeeze”);
} else {
Serial.println(“ - Big squeeze”);
}
delay(1000);
} /* FSR simple testing sketch.
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
void setup(void) {
// We‘ll send debugging information via the Serial monitor
Serial.begin(9600);
}
void loop(void) {
fsrReading = analogRead(fsrPin);
Serial.print(“Analog reading = ”);
Serial.print(fsrReading); // the raw analog reading
// We’ll have a few threshholds, qualitatively determined
if (fsrReading 《 10) {
Serial.println(“ - No pressure”);
} else if (fsrReading 《 200) {
Serial.println(“ - Light touch”);
} else if (fsrReading 《 500) {
Serial.println(“ - Light squeeze”);
} else if (fsrReading 《 800) {
Serial.println(“ - Medium squeeze”);
} else {
Serial.println(“ - Big squeeze”);
}
delay(1000);
}
用于模擬FSR測量的深度代碼 該Arduino草圖假定您已將FSR像上面一樣以10K接線?下拉電阻,并在模擬0引腳上讀取傳感器。它相當先進,可以測量FSR測得的近似牛頓力。這對于校準您認為FSR會受到的作用力非常有用。
下載:文件
復(fù)制代碼
/* FSR testing sketch.
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
int fsrVoltage; // the analog reading converted to voltage
unsigned long fsrResistance; // The voltage converted to resistance, can be very big so make “l(fā)ong”
unsigned long fsrConductance;
long fsrForce; // Finally, the resistance converted to force
void setup(void) {
Serial.begin(9600); // We‘ll send debugging information via the Serial monitor
}
void loop(void) {
fsrReading = analogRead(fsrPin);
Serial.print(“Analog reading = ”);
Serial.println(fsrReading);
// analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV)
fsrVoltage = map(fsrReading, 0, 1023, 0, 5000);
Serial.print(“Voltage reading in mV = ”);
Serial.println(fsrVoltage);
if (fsrVoltage == 0) {
Serial.println(“No pressure”);
} else {
// The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V
// so FSR = ((Vcc - V) * R) / V yay math!
fsrResistance = 5000 - fsrVoltage; // fsrVoltage is in millivolts so 5V = 5000mV
fsrResistance *= 10000; // 10K resistor
fsrResistance /= fsrVoltage;
Serial.print(“FSR resistance in ohms = ”);
Serial.println(fsrResistance);
fsrConductance = 1000000; // we measure in micromhos so
fsrConductance /= fsrResistance;
Serial.print(“Conductance in microMhos: ”);
Serial.println(fsrConductance);
// Use the two FSR guide graphs to approximate the force
if (fsrConductance 《= 1000) {
fsrForce = fsrConductance / 80;
Serial.print(“Force in Newtons: ”);
Serial.println(fsrForce);
} else {
fsrForce = fsrConductance - 1000;
fsrForce /= 30;
Serial.print(“Force in Newtons: ”);
Serial.println(fsrForce);
}
}
Serial.println(“--------------------”);
delay(1000);
} /* FSR testing sketch.
Connect one end of FSR to power, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
int fsrVoltage; // the analog reading converted to voltage
unsigned long fsrResistance; // The voltage converted to resistance, can be very big so make “l(fā)ong”
unsigned long fsrConductance;
long fsrForce; // Finally, the resistance converted to force
void setup(void) {
Serial.begin(9600); // We’ll send debugging information via the Serial monitor
}
void loop(void) {
fsrReading = analogRead(fsrPin);
Serial.print(“Analog reading = ”);
Serial.println(fsrReading);
// analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV)
fsrVoltage = map(fsrReading, 0, 1023, 0, 5000);
Serial.print(“Voltage reading in mV = ”);
Serial.println(fsrVoltage);
if (fsrVoltage == 0) {
Serial.println(“No pressure”);
} else {
// The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V
// so FSR = ((Vcc - V) * R) / V yay math!
fsrResistance = 5000 - fsrVoltage; // fsrVoltage is in millivolts so 5V = 5000mV
fsrResistance *= 10000; // 10K resistor
fsrResistance /= fsrVoltage;
Serial.print(“FSR resistance in ohms = ”);
Serial.println(fsrResistance);
fsrConductance = 1000000; // we measure in micromhos so
fsrConductance /= fsrResistance;
Serial.print(“Conductance in microMhos: ”);
Serial.println(fsrConductance);
// Use the two FSR guide graphs to approximate the force
if (fsrConductance 《= 1000) {
fsrForce = fsrConductance / 80;
Serial.print(“Force in Newtons: ”);
Serial.println(fsrForce);
} else {
fsrForce = fsrConductance - 1000;
fsrForce /= 30;
Serial.print(“Force in Newtons: ”);
Serial.println(fsrForce);
}
}
Serial.println(“--------------------”);
delay(1000);
}
獎金!讀取沒有模擬引腳的FSR測量值。由于FSR基本上是電阻器,因此即使您的微控制器上沒有任何模擬引腳(或者說您想連接的數(shù)量超過模擬輸入引腳),也可以使用它們我們這樣做的方法是利用電阻器和電容器的基本電子特性,事實證明,如果您使用最初不存儲電壓的電容器,然后通過電阻器將其連接到電源,則它將充電電壓越大,電阻就越大。
此示波器捕獲的圖像顯示了數(shù)字引腳上發(fā)生的情況(黃色),藍線表示草圖何時開始計數(shù)以及完成計算的時間,大約1.2毫秒后。
這是因為電容器的作用就像桶,電阻的作用就像一根細管。足夠的時間,您可以通過計時將桶裝滿一半所需的時間來確定管道的寬度。
在這種情況下,我們的“桶”是一個0.1uF的陶瓷電容器。您幾乎可以隨意更改電容器,但時序值也會改變。對于這些FSR,0.1uF似乎是一個不錯的起點。
下載:文件
復(fù)制代碼
/* FSR simple testing sketch.
Connect one end of FSR to power, the other end to pin 2.
Then connect one end of a 0.1uF capacitor from pin 2 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 2; // the FSR and cap are connected to pin2
int fsrReading; // the digital reading
int ledPin = 13; // you can just use the ‘built in’ LED
void setup(void) {
// We‘ll send debugging information via the Serial monitor
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // have an LED for output
}
void loop(void) {
// read the resistor using the RCtime technique
fsrReading = RCtime(fsrPin);
if (fsrReading == 30000) {
// if we got 30000 that means we ’timed out‘
Serial.println(“Nothing connected!”);
} else {
Serial.print(“RCtime reading = ”);
Serial.println(fsrReading); // the raw analog reading
// Do a little processing to keep the LED blinking
fsrReading /= 10;
// The more you press, the faster it blinks!
digitalWrite(ledPin, HIGH);
delay(fsrReading);
digitalWrite(ledPin, LOW);
delay(fsrReading);
}
delay(100);
}
// Uses a digital pin to measure a resistor (like an FSR or photocell?。?/p>
// We do this by having the resistor feed current into a capacitor and
// counting how long it takes to get to Vcc/2 (for most arduinos, thats 2.5V)
int RCtime(int RCpin) {
int reading = 0; // start with 0
// set the pin to an output and pull to LOW (ground)
pinMode(RCpin, OUTPUT);
digitalWrite(RCpin, LOW);
// Now set the pin to an input and.。.
pinMode(RCpin, INPUT);
while (digitalRead(RCpin) == LOW) { // count how long it takes to rise up to HIGH
reading++; // increment to keep track of time
if (reading == 30000) {
// if we got this far, the resistance is so high
// its likely that nothing is connected!
break; // leave the loop
}
}
// OK either we maxed out at 30000 or hopefully got a reading, return the count
return reading;
} /* FSR simple testing sketch.
Connect one end of FSR to power, the other end to pin 2.
Then connect one end of a 0.1uF capacitor from pin 2 to ground
For more information see www.ladyada.net/learn/sensors/fsr.html */
int fsrPin = 2; // the FSR and cap are connected to pin2
int fsrReading; // the digital reading
int ledPin = 13; // you can just use the ’built in‘ LED
void setup(void) {
// We’ll send debugging information via the Serial monitor
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // have an LED for output
}
void loop(void) {
// read the resistor using the RCtime technique
fsrReading = RCtime(fsrPin);
if (fsrReading == 30000) {
// if we got 30000 that means we ‘timed out’
Serial.println(“Nothing connected!”);
} else {
Serial.print(“RCtime reading = ”);
Serial.println(fsrReading); // the raw analog reading
// Do a little processing to keep the LED blinking
fsrReading /= 10;
// The more you press, the faster it blinks!
digitalWrite(ledPin, HIGH);
delay(fsrReading);
digitalWrite(ledPin, LOW);
delay(fsrReading);
}
delay(100);
}
// Uses a digital pin to measure a resistor (like an FSR or photocell?。?/p>
// We do this by having the resistor feed current into a capacitor and
// counting how long it takes to get to Vcc/2 (for most arduinos, thats 2.5V)
int RCtime(int RCpin) {
int reading = 0; // start with 0
// set the pin to an output and pull to LOW (ground)
pinMode(RCpin, OUTPUT);
digitalWrite(RCpin, LOW);
// Now set the pin to an input and.。.
pinMode(RCpin, INPUT);
while (digitalRead(RCpin) == LOW) { // count how long it takes to rise up to HIGH
reading++; // increment to keep track of time
if (reading == 30000) {
// if we got this far, the resistance is so high
// its likely that nothing is connected!
break; // leave the loop
}
}
// OK either we maxed out at 30000 or hopefully got a reading, return the count
return reading;
}
可以根據(jù)讀數(shù)計算實際電阻,但是不幸的是,IDE和arduino板的變化會使其不一致。請注意,如果您更改OS的IDE版本,或者使用3.3V arduino而不是5V,或者從16mhz Arduino更改為8Mhz Arduino(例如lilypad),可能會有所不同由于讀取引腳的值需要多長時間。通常這沒什么大不了的,但是如果您不期望的話,它會使您的項目難以調(diào)試!
示例項目
這里僅是使用FSR的項目的一些示例!
控制LED(有點暗,但他按了FSR)。
FSR拇指摔跤(來自斯坦福大學課程的示例)
Tapper,一種音樂界面,可通過點擊您的音樂手指
責任編輯:wv
-
FSR
+關(guān)注
關(guān)注
0文章
33瀏覽量
6629
發(fā)布評論請先 登錄
相關(guān)推薦
評論