IR sensor detecting black

Hello I have an 4 IR avoidance module and it is detecting black. Can you tell me why is that. I want to make a line follower car whit these if I can. Please help

Thank you

Tell us more.
(Hint: we're not all interested in your timescales, your desires or your emotions.)

ok so I have an 4 IR avoidance module like this one: https://www.amazon.com/4-Channel-Infrared-Follower-Obstacle-Avoidance/dp/B07662JJF7

and even its detecting every object i put in front of it even if the object is black or white. Shouldn't it detect only the white object ?

Tell us more.

I just want to know why do the sensors detect black when they are IR and black should absorb the light

How do you know this?

(Also: IR is not always like visible. Instinct doesn't always work for you.)

If no light is reflected, "black" is detected by the fact that no light is reflected.

Because i have tested it whit a program that detects if an object is placed in front of the sensor. Whit every black object it detects it and i do not know why

Can't see it.
Sorry.

An object that appears black in visible light may reflect IR very well.

Or, you have a program error or wiring error.

1 Like
void setup() {
 
  Serial.begin(9600);
  
  pinMode(SENSOR_PIN, INPUT);
 
}

void loop() {
 
  int state = digitalRead(SENSOR_PIN);

  if (state == LOW){
    Serial.println("The obstacle is present");
   
  }else{
    Serial.println("The obstacle is NOT present");
   
}
  delay(100);
}

Even is a dark room it sill detects it

Please post a complete, compilable program.

const int SENSOR_PIN = 2;



void setup() {
 
  Serial.begin(9600);
  
  pinMode(SENSOR_PIN, INPUT);
 
}

void loop() {
 
  int state = digitalRead(SENSOR_PIN);

  if (state == LOW){
    Serial.println("The obstacle is present");
   
  }else{
    Serial.println("The obstacle is NOT present");
   
}
  delay(100);
}

Now, a wiring diagram and specifications or links to specifications of all your hardware.

I made it easier to read:

const int SENSOR_PIN = 2;

void setup() {
  Serial.begin(9600);
  pinMode(SENSOR_PIN, INPUT);
}

void loop() {
  int state = digitalRead(SENSOR_PIN);
  if (state == LOW) {
    Serial.println("The obstacle is present");
  }
  else {
    Serial.println("The obstacle is NOT present");
  }
  delay(100);
}

Which message does it print?

the IR sensor module: https://www.amazon.com/4-Channel-Infrared-Follower-Obstacle-Avoidance/dp/B07662JJF7

the arduino : Arduino Uno Rev3 — Arduino Official Store

Then the sensor appears to be working correctly!

1 Like

It prints The obstacle is present even if i put a black object in front of it

Are those objects reflective? Have you tried adjusting the sensitivity potentiometers on the board?

"black" does not mean "invisible".