multiple LDR - having a problem

Hi y'all,

Trying to set up an array of 6 LDR s

I'm sure I've set the resistors wrong just not sure as to what is right.

I can only get a reading on the two sensors who are closest to the 5v input.
If I move it, 2 others will get a proper read.

Resistors are now all 10K
Should I use a lower resistance? how low? what I scale it to 12 LDRs? 48?
Should I use more power?

Thanks!!!

#define pin_size 6
const int pin[pin_size] = { A0, A1, A2, A3, A4, A5};

void setup() {

  Serial.begin(9600);

}

void loop() {
  for (int i = 0 ; i < pin_size; i++) {
    Serial.print(analogRead(pin[i]));
    Serial.print(" - ");
    Serial.print(i);
    Serial.print("  |  ");
 
  }
  Serial.print("\n");
  delay(1000);

}

Hi,

Try putting delay(1000); after the Analog read. If it works then, decrease the delay as far as possible with OK result.

I recall there is some needed delay when switching quickly between analog inputs. Inside the chip there is only one Analog-Digital converter with a multiplexer ahead of it..

A common way is to read the input twice (without delay), and use the second reading.
Adding a delay might not work.
Leo..

Thank you Wawa & terryking

I tried both suggestions and still only 2 sensors get a reading :confused: :slightly_frowning_face: . the other 4 get 0.
when I move the 5v wire on the breadboard - I get two other sensors.

that's why I'm thinking this is not a code problem but a circuitry problem.

I've attached the actual breadboard and the serial monitor.

Thanks

Can't see what's under that LDR cover. Must be a wiring fault.

Why didn't you use the internal pull up resistors. No external resistors.
Connect the LDRs between the analogue pins and ground, and enable the internal pull up resistors in setup().
Leo..