I have a group of data, in which a specific voltage relate to a specific weight, for example 2 volts is almost 1.5kg.

In my prgram, I have mapped the analog input reading, which reads the weight applied to the FSR, to the voltage (0 to 5000mV). So, now I am wondering, can I use a loopup table which will find a specific voltage, and then print out the correspinding weight?

I have never used lookup takes and would really like some advice, because I could completely be heading down the worng paths.

Here is what I have so far, which may make things a bit clearer ...but there is no table in it yet.

From tests I have done, the relationship seems to be linear, yes. As for the resolution, yea, I think 1 gram would be good, but they may settle for 10 gram steps.

In that case, find the minimum weight that gives an analog reading of 1024 and use map to get the weight. Of course, when the arduino reads 1024, it won't know actually what the weight is, just that it's the max readable.

Given that the response appears to be linear and assuming that when weight is 0, analogread returns 0 and when weight is 1500g, you're getting 2v, we can extrapolate and calculate that a weight of 3750 will give 5v. The voltage is an irrelevance however, you can just map analogread from 0 to 1024 to 0 to 3750 to get the corresponding weight in grams.

Caveats - Does no weight actually give zero reading? Is it linear enough for the accuracy you want? Are the things you're weighing all <= 3750g?

However a small lookup table, kept in PROGMEM, might save the necessity of including code to calculate it (eg. to do logarithms). You might need to test empirically, but possibly the lookup table could use less space, and be faster.

Please post technical questions on the forum, not by personal message. Thanks!