Light sensor - anomalous values returned

Hello,

I am working on a project that uses light sensors to follow a line.

I am using a Cytron Maker Reflect Reflectance Sensor (https://www.robotshop.com/uk/cytron-maker-reflect-reflectance-sensor.html), and a esp 32 Firebeetle on the arduino ide.

I have connected the vcc to the boards 3v3, ground to ground, and the signal output to io pin 34 on the board. I have a 1k resistor across the signal wire and ground also.

I could not find any resources online on how to collect values from the sensor, but came across an article of the analogeRead() function. I get values from the pin, but they follow a strange pattern. The sensor is completely unresponsive to changes in light/colour, and instead the values increase, then decrease back to zero. The max value the numbers reach varies, but they always return to zero. Here is my code and the console output produced:

Please let me know what can be done. I suspect these values are not the signal output i am looking for, and perhaps ive got this wrong to begin with.

Many thanks.

Based on the data sheet for the actual LED/photo transistor device, you need to power it from something that can supply the current. The LED seems to draw up to 50ma maximum, which would be at 5 volts. Your Arduino, no matter the type, cannot supply that current.
Paul

Thanks Paul,

I read in the documentation that the vcc pin on the esp32 supplies the same voltage as the input, that is the micro usb, and last time i tested it i got 4.7-4.8v. Perhaps switching the voltage supply from the 3v3 to the Vcc pin could work? I already use that pin to power servos.

Connected to 4.75V supply - tested with multi meter, and the problem still persists. Checked the datasheet and the operating voltage is stated as 3-5.5V. I also get the same values when the pin is disconnected, I have a feeling this is an error with the code or board.

Really?

Yes, the 4.7V one.

Just for effect, try two 1.5 volt batteries in series or even three in series. Measure the current if you can.
Paul

Got 45mA.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.