How To Connect A Force Sensor To Arduino - An Introduction For Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 พ.ค. 2024
  • See how to connect a force sensor to your Arduino in this video. If you're looking for an Arduino & force sensor introduction for beginners, check it out and let me know what you think in the comments! There are some great Arduino projects for beginners and this is one of them.
    🔔🔔 SUBSCRIBE 🔔🔔 don't forget to subscribe and click the bell!
    / @bmonsterlaboratory
    Facebook: / bmonster-laboratory-10...
    ++get the code on Facebook - search #forceuino
    Twitter: / b_monsterlab
    check out our Arduino play list!
    • Easy Arduino projects ...
    Force Sensor Amazon link: www.amazon.com/gp/product/B00...
    link to force sensor datasheet: www.manualshelf.com/manual/in...
    Chapters:
    0:00 intro
    0:53 soldering leads
    1:25 items used in this video
    1:49 the datasheet
    2:42 force sensor demo
    2:59 force sensor schematic
    4:17 force vs voltage graph
    4:52 demo #1
    5:22 demo #2
    5:50 demo #3
    6:08 the code

ความคิดเห็น • 21

  • @Gowtham-yt9iw
    @Gowtham-yt9iw ปีที่แล้ว +1

    Bro I didn't got the code but somehow I managed thanks for the video it helped for my college project work thank you so much be happy

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว

      Congrats on your project! Thanks for taking time to watch the video and leave a mssg! Take care 👍

    • @michaelmassajr.9996
      @michaelmassajr.9996 ปีที่แล้ว +1

      Hey nice. I'm gonna use this for my senior design this semester too (credit included to here!). Didn't expect comments to be active on this vid

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว

      Thanks! I appreciate it. Good luck with your design 👊👊

  • @katebenfield8481
    @katebenfield8481 9 หลายเดือนก่อน +2

    Did you calculate the force from your resistance output values? It would be nice to see what the force is rather than the output being "Light, Medium, Big". If so, how close were they to actual values? Thanks! Great video :)

    • @BMonsterLaboratory
      @BMonsterLaboratory  9 หลายเดือนก่อน

      hi there! The sensor's resistance is read using the analogRead() function, which returns a value between 0 and 1023, corresponding to the voltage level at the analog pin. The SensorRead value is compared against different thresholds, and the LEDs are lit up in response to the different force levels.
      The Arduino represents the sensor reading as a number between 0 (no pressure) and 1023 (maximum pressure). We should be able to map this range (0-1023) to the force range (1/16 lbs - 22 lbs) for this sensor. The value displayed on your LCD would be approximate and you would have to calibrate it depending on your project setup. I can make a video for this.... no problem. sorry about the delayed response.
      I wanted to update this answer. I was able to display force in pounds and after calibrating the sensor, it did a pretty good job. There is some sensor drift over time where you'll see the values change. So, you can get a readout in lbs, but it's not ideal. Also, Sparkfun has a great tutorial and code example for Force and Resistance data using a sensor similar to this. check it out here learn.sparkfun.com/tutorials/force-sensitive-resistor-hookup-guide?_gl=1*7fadl3*_ga*NDE5NjE2NTQ2LjE2Nzc3Mjc2NzE.*_ga_T369JS7J9N*MTY5MDQwNzQ1NS40LjEuMTY5MDQwNzQ2OC40Ny4wLjA.&_ga=2.11488948.1420561945.1690407456-419616546.1677727671
      If you want better accuracy, check out some load cell sensors. More expensive, but more accurate and repeatable results.. hope this helped.

    • @katebenfield8481
      @katebenfield8481 9 หลายเดือนก่อน +1

      @@BMonsterLaboratory Thank you for the reply! The link provide is very interesting I will need to look into it more for my application! Would you be able to provide the code for the calibration? I am curious how you did it. Thanks!

    • @BMonsterLaboratory
      @BMonsterLaboratory  9 หลายเดือนก่อน

      Sure! This code reads the force sensor that's connected to analog pin A0, converts the sensor reading to force in lbs using the calibration factor and offset, and displays the sensor reading and the calculated force on the I2C LCD display. When I mapped force to lbs I looked at the reading when there was no load vs when there was a known weight of 1lb on the force sensor. When there was no load X1=67 and when there was a known weight of 1lb on the sensor x2=766. X1 and X2 are the raw sensor readings. Then I use the scale factor and offset to convert raw sensor readings to force in lbs. You can see this at the bottom of the loop. You'll see some drifting in the measurements and that's why I said a load cell would be better for this application. There are probably more complex ways to get a better reading... I hope you find this helpful.
      #include
      #include
      #define SensorPin A0
      LiquidCrystal_I2C lcd(0x27, 20, 4); // Set the LCD address to 0x27 for a 20x4 display
      void setup() {
      Wire.begin();
      lcd.begin(20, 4);
      lcd.backlight();
      lcd.setCursor(0, 0);
      lcd.print("Pressure Sensor:");
      Serial.begin(9600);
      }
      void loop() {
      int SensorRead = analogRead(SensorPin);
      float forceInLbs = mapForceToPounds(SensorRead);
      Serial.print("Sensor Reading: ");
      Serial.print(SensorRead);
      Serial.print(" - Force: ");
      Serial.print(forceInLbs);
      Serial.println(" lbs");
      lcd.setCursor(0, 1);
      lcd.print(" "); // Clear line
      lcd.setCursor(0, 1);
      lcd.print("Reading: ");
      lcd.print(SensorRead);
      lcd.setCursor(0, 2);
      lcd.print(" "); // Clear line
      lcd.setCursor(0, 2);
      lcd.print("Force: ");
      lcd.print(forceInLbs, 2); // Print with 2 decimal places
      lcd.print(" lbs");
      delay(200);
      }
      float mapForceToPounds(int SensorRead) {
      // Two points from calibration
      float x1 = 67, y1 = 0; // First point (x1, y1) when no load is applied
      float x2 = 766, y2 = 1; // Second point (x2, y2) when 1lb load is applied
      // Calculate scale and offset
      float scale = (y2 - y1) / (x2 - x1);
      float offset = y1 - scale * x1;
      // Apply scale and offset to the sensor reading
      float forceInLbs = scale * SensorRead + offset;
      return forceInLbs;
      }

  • @carlosmor3254
    @carlosmor3254 ปีที่แล้ว +1

    Great video!
    I assume it's resistive and not capacitive, or is it both?
    On the other hand would it detect a bunch of beach sand?
    Thanks

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว

      Hey Carlos, great to hear from you! This is the FSR Model 406 Force Sensor from Interlink Electronics. It's a force-sensing resistor that shows a decrease in resistance when there is an increase in the force applied. It would detect beach sand if it applied between 0.2N to 20N of pressure to the sensor - somewhere between 20 grams and 2kg. I hope that helped! 👍

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว

      by the way, here's a link to their website buyinterlinkelectronics.com/ They also sell some sensors on Amazon.

    • @carlosmor3254
      @carlosmor3254 ปีที่แล้ว +1

      @@BMonsterLaboratory Thank you very much

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว

      @@carlosmor3254 you're welcome. Take care!

  • @user-dc8sx7br4e
    @user-dc8sx7br4e ปีที่แล้ว +1

    can you please help me with this?
    I have a similar sensor with these features:
    Actuation Force: 0.1 Newtons
    Force Sensitivity Range: 0.1 - 10.02 Newtons
    Non-Actuated Resistance: 10M W
    what should be the resistor values in the voltage divider circuit for the above specifications?

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว +1

      Hi Vaishali! Great to hear from you. I can take a look at it. Can you send me the code and the model of sensor you have? If you have found messages over Facebook work well with posting code. Email is fine if that's the only option. Happy to help where I can 👍

    • @user-dc8sx7br4e
      @user-dc8sx7br4e ปีที่แล้ว

      @@BMonsterLaboratory Hi where can I email you at? I'm not on Facebook. Thank you

  • @mehwishismail
    @mehwishismail 8 หลายเดือนก่อน +1

    how to connect two FSR to single aurdino

    • @BMonsterLaboratory
      @BMonsterLaboratory  8 หลายเดือนก่อน

      HI there. you could add new integer variables like you did for the first one:
      int SensorPin1 = 0;
      int SensorPin2 = 1;
      int SensorRead1;
      int SensorRead2;
      void setup
      (add your new LEDs here) if you're using new LEDs
      void loop
      (add sensor 2 in the loop with sensor 1)
      SensorRead2 = analogRead(SensorPin2);
      (add some conditional statements like you did for the first sensor)
      if (SensorRead2 < 10) {
      Serial.println(" - No pressure (Sensor 2)");
      } else if (SensorRead2 < 400) {
      digitalWrite(ledPin1, HIGH);
      Serial.println(" - Light pressure (Sensor 2)");
      } else if (SensorRead2 < 750) {
      digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin2, HIGH);
      Serial.println(" - Light force (Sensor 2)");
      } else if (SensorRead2 < 1000) {
      digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin3, HIGH);
      Serial.println(" - Medium force (Sensor 2)");
      } else {
      digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin3, HIGH);
      digitalWrite(ledPin4, HIGH);
      Serial.println(" - Big force (Sensor 2)");
      }
      also, be sure to check the specs on your board so you stay within the current and voltage parameters store-usa.arduino.cc/collections/boards/products/arduino-mega-2560-rev3 👍
      I don't have a 2nd sensor to test the code, but I believe this is what it would look like.

  • @rohitkumarmurmu7654
    @rohitkumarmurmu7654 ปีที่แล้ว +1

    Bro I need code

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว +1

      Here a go!
      int SensorPin = 0;
      int SensorRead;
      int ledPin1 = 9;
      int ledPin2 = 10;
      int ledPin3 = 11;
      int ledPin4 = 12;
      void setup(void)
      {
      Serial.begin(9600);
      pinMode(ledPin1, OUTPUT);
      pinMode(ledPin2, OUTPUT);
      pinMode(ledPin3, OUTPUT);
      pinMode(ledPin4, OUTPUT);
      }
      void loop(void) {
      SensorRead = analogRead(SensorPin);
      Serial.print("Pressure Reading is ");
      Serial.print(SensorRead);
      digitalWrite(ledPin1, LOW);
      digitalWrite(ledPin2, LOW);
      digitalWrite(ledPin3, LOW);
      digitalWrite(ledPin4, LOW);
      if (SensorRead < 10) {
      Serial.println(" - No pressure");
      } else if (SensorRead < 400) {
      digitalWrite(ledPin1, HIGH);
      Serial.println(" - Light pressure");
      } else if (SensorRead < 750) {
      digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin2, HIGH);
      Serial.println(" - Light force");
      } else if (SensorRead < 1000) {
      digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin3, HIGH);
      Serial.println(" - Medium force");
      } else {
      digitalWrite(ledPin1, HIGH);
      digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin3, HIGH);
      digitalWrite(ledPin4, HIGH);
      Serial.println(" - Big force");
      }
      delay(200);
      }

    • @BMonsterLaboratory
      @BMonsterLaboratory  ปีที่แล้ว

      most code is posted on Facebook. Just look for # in video description. Hope this helps. Enjoy! 👊👊