However I have been trying to calibrate the sensor by placing various weights in the sensor and recording voltage. What I have noticed is that if I put a fixed weight directly in the center, the voltage will continuously increase. I have seen this using various FSR sensors.
Is this something that has been observed by others and is expected or are there ways to ensure a more stable voltage readout.
Please read the post at the start of any forum , entitled "How to use this Forum".
If you need to measure a mass, you would be better to use a load cell.
From what I can see FSR's are good for sensing a change in pressure, but not as a calibrated measuring device.
My ultimate goal isn't to measure mass, I was just using fixed mass objects to try and figure out the relationship between force to resistance in that sensor since the data sheet did not include it. So I would like to use the fsr for force/pressure but I want to optimize the circuit for my purpose which is why I'm trying to calibrate it. Have you noticed this effect before when using an fsr?
I have used these sensors and did the same calibration using known weights. The response was nearly linear, except the first quarter of the graph was more exponential. But a linear interpretation wouldn't be far off.
@JBornstein90 . Apologies for such a late reply but havent really had a chance to dive into this for some time. Anyway I have attached for you an image showing how for a constant weight the voltage steadily increases. This is the same for multiple force + pull down resistor combinations.
Finally, here is some code I have attached where I am using the python interface to measure voltages from the arduino. I found the same pattern uploading a c++ script to the arduino but python made it easier to generate the figures and get more quantitative data.
from pyfirmata import Arduino, util , INPUT
import pandas as pd, numpy as np
import time
from datetime import datetime
board = Arduino('COM3')
iterator = util.Iterator(board)
iterator.start()
def store_voltage(port, time_lim = 10, time_step=1):
t1 = time.time()
t2 = time.time()
voltages = []
while (t2 - t1) <= time_lim:
time.sleep(time_step)
t2 = time.time()
voltages.append(
[t2 - t1, port.read()]
)
return np.array(voltages)
def get_fsr(volt, res):
# Vo = Vcc ( R / (R + FSR) )
# vo/vcc = volt
# volt = r/(r + fsr) => r+fsr = r/volt => fsr = r/volt - r => frs = r(1/volt - 1)
if np.isclose(volt, 0):
return np.inf
return res * (1/volt - 1)
def run_experiment(port, time_lim, time_step, resistor_val, force, fsr_name='None'):
result = store_voltage(port, time_lim, time_step)
result_df = pd.DataFrame(result, columns=['time', 'voltage'])
result_df['date'] = str(datetime.today()).split(' ')[0]
result_df['resistance'] = resistor_val
result_df['force'] = force
result_df['name'] = fsr_name
result_df['FSR'] = result_df['voltage'].apply(lambda x: get_fsr(x, resistor_val))
result_df.to_csv('track_force_{0}.txt'.format(str(datetime.now()).replace(' ', '').replace(':', '') ))
fig = px.scatter(result_df, x='time', y='voltage', title='Force_{0}:Resist_{1}_FSR_{2}'.format(force, resistor_val, fsr_name))
return result_df , fig
tv1 = board.analog[2]
time.sleep(1)
print(tv1.read())
# this will run the experiment and measure voltage over time
g1 = run_experiment(
board.analog[0], 30, 1, 470000, 10, 'circle'
)
g1[1]
Can you repeat that test two times, with 1k and them a 5k resistor?
For me personally, I had to "tune" the resistors for my project, and if memory serves me right, I ended up using 2.7k.
Let me know if you're able to do this! If not maybe there are other ways to handle the actual sensor polling at different times. But we'll dive down this rabbit hole only if we need to
@JBornstein90 I have an HTML file that summarizes all the data I generated for it previously. This might be a little rough to skim through but there is a section where I looked at drift for a series of resistors/force combinations. Each plot is titled by the resistance used and scatters are shown using different forces. Does anyone have any idea on how I can upload or share the html file I generated?
@TomGeorge and DaveEvans thanks so much for the suggestions! I'll have to do some more research on both comments/suggestions.
Still the better one has something like 5% creep or so. These sensors are made of plastic materials which have massive amounts of creep compared to a metal loadcell, and creep in plastic is very temperature sensitive (in fact the sensitivity of these sensors is probably surprizingly temperature sensitive too).
For a plastic to have low creep it needs to be below its glass transition temperature, usually becoming rather brittle.
Or put simply plastics cannot make accurate mechanical sensors because they are plastic