Simple sensor

the problem is that you remove the resistor and your readings will go up and down.

you have to pull it to ground if it's unconnected