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:
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
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.