Hook up esp32 and QTR-MD-08RC Reflectance Sensor Array

Hi

As i searched a lot this information, i share here my wiring cables between esp32 devkit and QTR-08RC :slight_smile:

QTR Gpio Esp32
1 12
3 14
5 4
7 16
9 17
11 5
13 18
15 19
VCC 5.5v
GND GND

What i did not undestand is the CTRL pin : it seems that it does not have effect on IR led (canā€™t see them through camera although i can see other remote controlsā€¦)

If anyone can share this info, could be great :slight_smile:

I also put a led on Gpio13 (i do not have a builtin led) to see when calibrating is starting and finishing

The example code is slightly modified as below:

#include <QTRSensors.h>

QTRSensors qtr;

const uint8_t SensorCount = 8;
uint16_t sensorValues[SensorCount];

void setup()
{
// configure the sensors
qtr.setTypeRC();
qtr.setSensorPins((const uint8_t){12, 14, 4, 16, 17, 5, 18, 19}, SensorCount);
qtr.setEmitterPin(0);

Serial.begin(115200);
}

void loop()
{
// read raw sensor values
qtr.read(sensorValues);

// print the sensor values as numbers from 0 to 2500, where 0 means maximum
// reflectance and 2500 means minimum reflectance
for (uint8_t i = 0; i < SensorCount; i++)
{
Serial.print(sensorValues[i]);
Serial.print(ā€˜\tā€™);
}
Serial.println();

delay(250);
}

Hello.

Other than defining an emitter control pin, it does not seem like your program is doing anything with that. By default, the QTR-MD-08RC board pulls the CTRL pin high turning on the emitters with the boardā€™s default (full, 30mA) LED current.

If you want to try adjusting the LED emitter brightness, I recommend reviewing the Second-generation QTR/QTRX sensor array details section of the Pololu QTR Reflectance Sensor Application Note (particularly, the details under the ā€œEmitter controlā€ header) and using the appropriate functions form our Arduino library, like setDimmingLevel().

- Patrick