Forum rules

Hi,

I purchased an ADA1071 FSR. It is very good quality.
I have used your In-depth sketch to play with expressing force in Newtons. That works nicely.
I'd like to modify the sketch to express the force in mmhg.
I'd like to send that output to an LCD display (16x2).

I'd appreciate some guidance.

Thank you Manouch

Posts: 2
Joined: Sun Sep 08, 2019 2:48 pm

Hi Manouch,

Glad to hear you are up and running with the FSR.

Conversion from newtons to mmhg should be a straight forward divide by 133.32

https://www.metric-conversions.org/pres ... quared.htm

A 16x2 LCD is easy to add to almost any Adafruit microcontroller. I would recommend using the i2c / SPI backpack a 16x2 to reduce the amount of wiring and make for easy communication. mikeysklar

Posts: 354
Joined: Mon Aug 01, 2016 8:10 pm

Hi Mike,
Thank you for your quick response! Impressive.
I'd like to share my code with you and get more help:
I'm looking to read 8 mmhg to 40 mmhg.
The conversion link you sent, shows 8 mmhg= 1066 N/m**2 and 40 mmhg=5333 mmhg.
Can you comment on the math in the following sketch? Do I the right product for my purpose?
Thanks.

Code: Select all | TOGGLE FULL SIZE
`#include <LiquidCrystal.h> int fsrPin = 0;int fsrReading;int fsrVoltage;unsigned long fsrResistance;unsigned long fsrConductance; long fsrForce;const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;LiquidCrystal lcd(rs, en, d4, d5, d6, d7); void setup(void) {  lcd.begin(16, 2);  Serial.begin(9600);} void loop(void) {  fsrReading = analogRead(fsrPin);    Serial.print("Analog reading = ");  Serial.println(fsrReading);   fsrVoltage = map(fsrReading, 0, 1023, 0, 5000);  Serial.print("Voltage reading in mV = ");  Serial.println(fsrVoltage);     if (fsrVoltage == 0) {    Serial.println("No pressure");    } else {    fsrResistance = 5000 - fsrVoltage;    fsrResistance *= 10000;    fsrResistance /= fsrVoltage;    Serial.print("FSR resistance in ohms = ");    Serial.println(fsrResistance);     fsrConductance = 1000000;    fsrConductance /= fsrResistance;    Serial.print("Conductance in microMhos: ");    Serial.println(fsrConductance);     if (fsrConductance <= 1000) {      fsrForce = fsrConductance / 80;      Serial.print("Force in Newtons: ");            lcd.setCursor(0, 0);      lcd.print("Force, Newtons: ");      lcd.setCursor(2, 1);      lcd.println(fsrForce);            Serial.println(fsrForce);          } else {      fsrForce = fsrConductance - 1000;      fsrForce /= 30;      Serial.print("Force, Newtons: ");      lcd.setCursor(0, 0);      lcd.print("Force in Newtons: ");      lcd.setCursor(2, 1);      lcd.println(fsrForce);            Serial.println(fsrForce);                }  }  Serial.println("--------------------");  delay(4000);}`
Last edited by adafruit_support_bill on Mon Sep 09, 2019 6:28 pm, edited 1 time in total.
Reason: Please use [code] tags when posting code to the forums. Manouch

Posts: 2
Joined: Sun Sep 08, 2019 2:48 pm 