0

I would like to use an FSR as an on/off switch. I want to implement it using an 8-bit 328p processor (either on an Arduino or an AtMega.) I'm using a voltage divider between the FSR and a 10K ohm resistor.

The idea is the following: When you finger-tap the FSR the voltage across the 10kΩ resistor (in series with the FSR) will increase up to a desired threshold voltage (any number between 1V-3V will do it.) Once it reaches the right threshold voltage, I want it to set a pin as an output, and be able to turn on a tiny DC-motor for x second (or x rotations.)

I believe that to read the right threshold voltage I have to start an ADC conversion on the ADC multiplexer selection register, but I'm confused on how I should implement it.

Here is how I'm planning to calculate the threshold voltage for the ADC:

here is how I'm planning on calculating the threshold voltage for the ADC (idk how to make a register take the calculated value for the threshold voltage ADC)

I don't know how to make a register take the calculated value for the threshold voltage ADC.

JRE
  • 67,678
  • 8
  • 104
  • 179

1 Answers1

1

There is a nice tutorial about using an FSR with ADC of arduino:

https://learn.adafruit.com/force-sensitive-resistor-fsr/using-an-fsr

Here you need to modify the code so that when the ADC reading is above half (ie 1024/2=512 or at voltage reading of 2.5V), then you turn output pin high. When it’s below this threshold, then output of pin is low.

I recommend using the example code(s) from link above with example code of using button with arduino and example code of turning transistor and motor on with arduino which you can find on google.

https://www.arduino.cc/en/tutorial/button

https://www.arduino.cc/en/Tutorial/TransistorMotorControl

Leoman12
  • 1,106
  • 1
  • 5
  • 10