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.
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.