Hello forum,
I’m facing an issue with my minisumo robot project for university. Last night, one of my QTR-1A sensors broke, so I improvised and borrowed a QTRX-HD-02A sensor (QTRX-HD-02A Reflectance Sensor Array: 2-Channel, 4mm Pitch, Analog Output, Low Current). I connected the CTRL pin to VCC, GND to GND, and OUT2 to pin A3 on my Arduino.
The problem is that, initially, the sensor was reading high values (>950), but now it’s only reading very low values (<15). I’m not sure what went wrong. The other QTR-1A sensor is still reading normally (values between 0 and 1024).
Does anyone have any ideas on what might be causing this issue and how to fix it?
Here is some part of my code.
#include <QTRSensors.h>
const uint8_t sensorPins[] = {A3, A4}; //A3 - QTRX-HD-02A ; A4 - QTR-1A
QTRSensors qtr;
void setup() {
qtr.setTypeAnalog();
qtr.setSensorPins(sensorPins, sizeof(sensorPins) / sizeof(sensorPins[0]));
Serial.begin(9600);
}
void loop() {
uint16_t sensorValues[2];
qtr.read(sensorValues);
int CLS = sensorValues[0];
int CLD = sensorValues[1];
Serial.println("Reading sensor:");
delay(1000);
Serial.print("Reading left sensor: "); Serial.println(CLS);
Serial.print("Reading right sensor: "); Serial.println(CLD);
delay(2000);
}
Serial monitor:
20:55:20.444 → Reading left sensor: 5
20:55:20.444 → Reading right sensor: 432
20:55:43.513 → Reading sensors:
20:55:44.484 → Reading left sensor: 14
20:55:44.484 → Reading right sensor: 989
20:55:46.483 → Reading sensors:
20:55:47.493 → Reading left sensor: 11
20:55:47.493 → Reading right sensor: 742
20:55:49.493 → Reading sensors:
20:55:50.503 → Reading left sensor: 15
20:55:50.503 → Reading right sensor: 1007