Hi Ralf,
I'm glad my hint solved your problem, at least I know it's not an uncommon problem
I'm still looking for the root cause because I don't think this is normal behaviour. In your case with a lot of hardware that can be potentially touched it's actually a good thing to have the chassis connected to mains ground
Regarding your logarithmic characteristic, I also had the exact same issue
Although it was with a photosensor, I solved it by simply taking the log10 of the sensor value, here's the code snippet. You can combine it with the map code
int lux = analogRead(A0) + 1; // +1 to avoid 0 because log10(0) returns infinity
double sensor = log10(lux)*100; // multiply by 100 or 1000 to get back the resolution, otherwise the value will vary between 0 and 3
Regarding the discussion on the erratic readings on your multimeter and strange behaviour of the LCD display.
If you measure "in circuit" with the pins connected, you have to realize that the arduino chip has an internal resistance, in general an input impedance is very high in the range of MegaOhms and an output impedance is very low, usually a couple of Ohms. So you're actually measuring the resistance together with everything that is in parallel on your circuit. You can avoid this problem by disconnecting ONE pin of your resistor and then do your measurement and that's why you see different values with the sensor connected to the circuit or not.
Also take into account that your multimeter has the same limitation, it has also a high impedance for voltage measurements. So when you're measuring the voltage over your sensor, that high resistance is put in parallel with the sensor, affecting the actual reading of the arduino. In general this is not an issue if the difference between them is big enough, but in your case your sensor has some pretty high values. So let's assume that your multimeter has an input impedance of 1 Mega Ohm and your sensor is at that moment also 1 Mega Ohm, the resulting parallel resistance is 500 Kilo Ohms !!!
So you see you can induce quite some error by measuring ![]()