hi, i am on a project. i am using a "seat occupancy sensor" which has 10M ohm resistance when no one sits on it. if anyone sits it has around 2k ohm depending on how much pressure on it.
I can use this sensor perfectly. but now i want to detect if sensor is connected properly or there is a broken wire between sensor and Arduino Nano. for this purpose i am planning the add 500k ohm paralel the sensor and so i can read around "20" out of 1023 with analogRead() function. and if i read below 20 this means the cable is broken.
is my approach correct? if yes my resistor values are ok? if no what is ur recommendation thank you.
It sounds as if you are using a 10k pull-down resistor. If using a Nano - or the less appropriate UNO - you should be using a pull-up resistor and the sensor connected between an analog input and ground.
The obvious approach here is to use the internal pullup with pinMode of INPUT_PULLUP. 470k would then read about 950.