Hi everyone,
There are boards with IR sensors on the market that looks like this: the IR.PNG picture
I have all the components to build one myself with the Arduino Uno, VCNT2020 sensor and LM393. The schematic is the example.jpg picture (it's the schematic of the sensors on the market)
The picture LM393.png shows what pins I connected to the LM393.
The problem is that in the serial monitor, the display message is ''STOP'' but nothing else is in front of the sensor.
Even if I rotate the potentiometer, nothing changes.
I disassembled and reassembled everything a couple of times because I thought that I didn't connect something but it led to the same result.
Any help will be much appreciated
This is the code I used, it's from this website https://www.elithecomputerguy.com/2019/06/ir-sensor-digital-output-on-arduino/
#define IR 8
int Obstacle;
void setup() {
pinMode(IR, INPUT);
Serial.begin(9600);
}
void loop() {
Obstacle = digitalRead(IR);
if (Obstacle == LOW) {
Serial.println("STOP");
}
else {
Serial.println("All Clear");
}
delay(500);
}
There are boards with IR sensors on the market that looks like this: the IR.PNG picture
I have all the components to build one myself with the Arduino Uno, VCNT2020 sensor and LM393. The schematic is the example.jpg picture (it's the schematic of the sensors on the market)
The picture LM393.png shows what pins I connected to the LM393.
The problem is that in the serial monitor, the display message is ''STOP'' but nothing else is in front of the sensor.
Even if I rotate the potentiometer, nothing changes.
I disassembled and reassembled everything a couple of times because I thought that I didn't connect something but it led to the same result.
Any help will be much appreciated

This is the code I used, it's from this website https://www.elithecomputerguy.com/2019/06/ir-sensor-digital-output-on-arduino/
#define IR 8
int Obstacle;
void setup() {
pinMode(IR, INPUT);
Serial.begin(9600);
}
void loop() {
Obstacle = digitalRead(IR);
if (Obstacle == LOW) {
Serial.println("STOP");
}
else {
Serial.println("All Clear");
}
delay(500);
}
Attachments
-
101.5 KB Views: 38
-
211.7 KB Views: 38
-
31.5 KB Views: 31