I am trying to make an FSR work but I'm having trouble since it's my first time with Arduino. I ordered an Arduino Uno and this FSR: FlexiForce Pressure Sensor - 25lbs. - SEN-08712 - SparkFun Electronics. I looked in several places online but couldn't find answers (that I could understand at least).
I have the Arduino up and running, the blink example runs fine. Now I'm trying to understand how I can connect and read from the FSR.
If I simply connect any end of the FSR into any of the analog inputs, I can get a reading.This is how I first connected it:
Then I used the code in this page to output the readings: FSR Sensor tutorial
But what I get in the monitor is very erratic. It SEEMS to work, but I'm not sure. If I apply some pressure with my fingers it does output a higher number but if I leave it alone, often times I will get a reading as if it's being pressed. Also if I apply a constance force, like putting some weight into it, the readings vary from nothing to maximum frequently.
This is my first attempt at this so I have no idea what I'm doing wrong. Can I even connect the FSR like I did or do I need a breadboard or connectors to plug into power? Did anyone ever made something similar to measure weight with some accuracy?
Thanks in advance,
The analog inputs read voltage. You have a resistor, it won't generate any voltages - if you just plug it into analog inputs they will be floating (but coupled to each other). A floating input will read random junk from the electrical environment around it.
You firstly need to connect one side of the resistor to a reference voltage, such as GND. Then you need to pass a current through it so that a voltage (proportional to resistance and current) is present across it. Then you can measure this voltage with an analog input.
So connect one side of resistor to GND, the other to a (just guessing here) 100k resistor, other end of that resistor to +5V. Now also connect the junction of the FSR and 100k to an analog pin. You now have a resistive divider using the FSR as the lower leg - increasing the pressure on the FSR should reduce its resistance and thus reduce the reading on the analog pin.
100k is just a guess, you might have to experiment a bit.
Thanks a lot, that clears it up. I suppose I'll need a breadboard to connect these pins. I'll work on getting that.
Really appreciate you taking your time with newbie questions.
Beware, once you own a breadboard you'll eventually own two, then three, ...
Beware, once you own a breadboard you'll eventually own two, then three, ... smiley
One is never enough... Get 1 small and 1-2 big ones.. Ebay is a great source to buy from..
Here's some breadboard How-To: http://arduino-info.wikispaces.com/LowCostStarterSet-Connecting-Breadboarding
And this would be a good starting point: http://goo.gl/9W574
DISCLAIMER: Mentioned stuff from my own shop...
So I got the breadboard and connected it to Arduino as I think it's correct:
Left pin on 5V
Middle pin on analog port 0
Right pin on Ground
Then I run my code but it still won't read correctly the force applied. Here's a picture of how I connected the FSR to the breadboard and to the Arduino. Can anyone please point me to the right direction?