Force Sensing Resistor (FSR) Arduino Simple Tutorial

Introduction: Force Sensing Resistor (FSR) Arduino Simple Tutorial

About: Arduino fan!

In this tutorial we will learn how to detect the force applied to the Force Sensing Resistor (FSR) and display it on the OLED Display + we will set the limits with a green and a red LED.

Watch a demonstration video.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: What You Will Need

  1. Arduino UNO (or any other Arduino)
  2. Force sensor
  3. OLED display
  4. RED & GREEN LED
  5. 1K ohm resistor
  6. Jumper wires
  7. Breadboard
  8. Visuino program: Download Visuino

Step 2: Start Visuino, and Select the Arduino UNO Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work! If you have not done follow the steps in this Instructable to setup the Arduino IDE to program Arduino UNO! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 3: In Visuino Add Components

  1. Add "SSD1306/SH1106 OLED Display (I2C)" component
  2. Add 2x "Compare Analog Value" component

Step 4: In Visuino Set Components

  1. Double click on the "DisplayOLED1" component and in the "Elements" dialog window drag "Text Field" to the left
  2. select on the right "Text Field1" and in the properties window set size:3 and Y:40
  3. Select "CompareValue1" component and in the properties window set Compare Type: ctSmallerOrEqual
    and value: 0.1

    "CompareValue1" is used to trigger the Green LED, it means whenever the input value is smaller or equal to 0.1 trigger the LED
  4. Select "CompareValue2" component and in the properties window set Compare Type: ctBigger

and value: 0.1
"CompareValue2" is used to trigger the Red LED, it means whenever the input value is bigger than 0.1 trigger the red LED

Step 5: In Visuino Connect Components

  1. Connect Arduino Analog Out pin [0] to "CompareValue1" component pin [In]
  2. Connect Arduino Analog Out pin [0] to "CompareValue2" component pin [In]
  3. Connect Arduino Analog Out pin [0] to "DisplayOLED1>Text Field1" component pin [In]
  4. Connect "DisplayOLED1" component to Arduino I2C pin [In]
  5. Connect "CompareValue1" component pin [Out] to Arduino digital pin [8]
  6. Connect "CompareValue2" component pin [Out] to Arduino digital pin [7]

Step 6: Generate, Compile, and Upload the Arduino Code

In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE

In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

Step 7: Play

If you power the Arduino UNO module, and press the force sensor sensor you should see a changing number on the OLED display and a green LED should light but when you hit the limit the red LED should shine.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it here and open it in Visuino: https://www.visuino.eu

Step 8: Circuit

  1. Connect Arduino Positive pin [5V] to OLED pin [VCC] and Force sensor pin [1]
  2. Connect Arduino Negative pin [GND] to OLED pin [GND]
  3. Connect OLED Display pin [SDA] to Arduino pin [SDA]
  4. Connect OLED Display pin [SCL] to Arduino pin [SCL]
  5. Connect Force sensor pin [2] to Arduino Analog pin [0]
  6. Connect Force sensor pin [2] to 1K ohm resistor
  7. Connect other side of the resistor to Arduino Negative pin[GND]
  8. Connect Green LED negative pin to Arduino pin [GND]
  9. Connect Green LED Positive pin to Arduino Digital pin [8]
  10. Connect Red LED negative pin to Arduino pin [GND]
  11. Connect Red LED Positive pin to Arduino Digital pin [7]

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions