I have a simple setup when I have to read analog values from a light sensor, and I need to put it far away from the arduino (several meters away). I want to know how can I create a wired reliable connection from the arduino to the sensor.
simulate this circuit – Schematic created using CircuitLab
Here is the function that activates the system:
void photoResistorActivation () {
int photoResistor = 1024 - analogRead(PHOTO_RESISTOR_PIN);
if (DEBUG) {
Serial.println (photoResistor, DEC);
}
if (photoResistor >= LIGHT_THRESHOLD) {
personDetected = false;
}
else {
if (personDetected == false) {
trigger = true;
personDetected = true;
}
}
}
Edit: I have received valuable feedback in the answers about how to avoid noise, but I want to clarify that I'm asking about physical connection (cables, connectors and so on). What kind of cables should I use? Jumper cables?
Thank you