I have very little experience with coding and absolutely no experience with Arduino. I am putting together the last details for an interactive art installation that goes as follows: I'm positioning a chair with a Forceflex pressure sensor in front of a wall. When the viewer sits in the chair, the
projector switches the feed from a black screen to the webcam feed which will be hosted on a website. I have an Arduino and a pressure sensor but I'm not sure
exactly how to go about programing it to read weight, and switch projection
view from black screen to the live feed. This is also the simplest approach that
I can think to use aside from just triggering the projector to turn on, but
there is always a boot-up that takes time, so that option is out. I've tried
to create a basic on/off code through Processing (as practive for the Arduino environment) but I'm not having much
luck overall. I read that I might also need a Breadboard so that is on the way. I would very much appreciate guidance on coding!
The flexiforce sensors are pretty much variable resistors. There resistance goes from very high, near 1M, to almost shorted at maximum force, about 1kg for most sensors. To measure the force you need to setup a potential divider circuit:
Where R2 is a fixed resistor (I have found 10k to be good for these sensors) and then connect your sensor as R1, Vin should be the 5V line on your Arduino and vout should be connected to your A0 pin on your Arduino.
Next you want a very simple sketch like this:
Upload it to your Arduino and then open up the serial monitor, this will be listing tonnes of values (all around 0 to 300 ish). When you press down on the sensor the values will shoot up, maybe to 900 to 1023, write down these two ranges approximately and then pick a number somewhere in the middle. That is your threshold value, below it there is no force being applied, above it there is force.
If you start by getting this far then I will start to help with the main code.
Be aware that these sensors are delicate, if you are placing them under a chair they will need to be reinforce in some way. I once did a project that had them built into a shoe, at first we just put them in and they got ruined in an afternoon, so we instead mounted them on foam insoles to make them last properly. I suggest that you find some way to protect the sensor, especially the area around the connector.
I used this sensor felxiforce,but I don't know the limit suported by this sensor,
any idea plz?
i used this sensor withe I2C,i get the value of this sonsor but ,how can 'i verfiy if this value is good.?
Thanks in advance.
Regards.
What limit do you mean ? How much force can be applied before they break or maybe the limits of the value output by the device ?
Does the value output by the sensor vary with pressure applied to it ? If so then it is working and could be regarded as good. You can see the values, we can't so what do you mean by 'good'
If you are new to the Arduino, you should take some time and try the examples with a blinking led. You are diving into the deep now, but on the other hand, the flexiforce is not that hard.
Reply #1 by tobyb121 is all you need. Use that schematic with 10k resistor and flexiforce and that sketch.
You have to try what values you need to turn on the projector. Just build it and see how the value changes when you press the sensor.
That is how I do my projects: I order different kind of sensors or other electronics, and try what they do and how they work, to get some "feeling" with it. After that I know enough to select the right sensors and I know what kind of data to expect.
but me i have 2 arduiono, in every I have 4 sensor flexiforce,really the values are diffrents.
it starts with 290 , and varied and going down ,its strange?
You mean the value that the Arduino reads from the analog input ?
That is going down when the flexiforce is connected to GND and the 10k resistor to 5V.
But a start value of 290 seems strange. Do you have two flexiforce connected to one analog input ?
Can you make a photo of it ? (The Arduino with the flexiforce and the wiring).
Can you also provide details of the I2C shield you have previously mentioned. Since you only have 4 sensors, would it not be easier to just wire each to an analogue pin?
You say you don't have much information, but you bought the items, and therefor, you know what you have in front of you, we don't!!