I have 3 force resistors in a row, on top of which I have placed a board. I read values from the resistors through analogue ports. My goal is to be able to detect whether someone is pressing on the top, middle, or bottom of the board.
So far I can easily detect the left and right, like this: I first calibrate the 3 sensors for 2 seconds. Then I detect if pressure is applied on any of the calibrated sensors. If yes, I sum for all of them the values that they return on each round of the loop, until force has stopped being applied. I finally compare the 3 values against each other and I find which received higher pressure in total. This works perfectly fine for the left and right. However, when the board is pressed in the middle, pressure is applied on all 3, since the board is flat. Sorting the values does not help, because very often the left and right sensors have recorded a higher value than the middle.
I noticed that when the board is pressed on the left, the right sensor records very few values, and the same for the other way around. So, I get a high success rate in detecting middle presses like this:
int threshold = 80;
if (left_sum > threshold && middle_sum > 80 && right_sum >80)
return middle_pressed;
However, when someone presses hard enough on the left or right, the if statement is satisfied.
Is there a more accurate way to detect where force is being applied?
(Following is a quick schematic I made - I am not at all an expert so please excuse me for my mistakes, I just hope it illustrates more or less what it is supposed to)
simulate this circuit – Schematic created using CircuitLab
Please ignore the double arrows right on top of the resistors.
left/right < threshold
. This will probably minimise the risk of getting the middle if you pressing too hard.