Page 1 of 1

OPT101 Light Analog Light Intensity Sensor

Posted: Tuesday 29 June 2021 17:56
by Copitano
Does anyone here have experience getting the OPT101 Light Analog Light Intensity Sensor Module Single Chip Photoelectric Diode 14KHz CJMCU-101 operational?
Had it for a while, but I can't find much with google about connecting the thing to an RPi via a NoduMCU ESP8266 v3. In ESPeasy I can only find the BH1750 and the TSL2561. I can of course just order it, but I have the OPT101 lying around ;)

Re: OPT101 Light Analog Light Intensity Sensor

Posted: Wednesday 30 June 2021 9:42
by besix
OPT101 is a photodiode and for esp8266 it needs to be connected to ADC pin + voltage divider.
A good example of how to connect an OPT101 to an ESP is here
https://medium.com/@rxseger/esp8266-fir ... 25f317c74f
The ESPEASY is ADC support
https://www.letscontrolit.com/wiki/index.php/Analog

Re: OPT101 Light Analog Light Intensity Sensor

Posted: Tuesday 06 July 2021 15:02
by Copitano
@besix Thank you for your directions. These were very helpful. I was able to connect the sensor to a Wemos D1 and I also receive values. If I have understood correctly, the Wemos itself has built-in resistors so that the A0 pin can handle 3.3 volts.
As soon as I cover the sensor the value goes to (as might be expected almost) 0. As soon as I remove the cover it goes to value 840 in normal daylight. I then measure 2.5 volts on the data line to the Wemos. That level is already reached at about 250 lux (measured with an app on my iPhone). If I place the LED of my iPhone over the sensor and turn it on, the value of 840 does not increase any further. That also seems to be the maximum. I already tried putting a 10k potentiometer between pins 1M + OUT and the A0 of the Wemos. However, that makes very little difference. (the voltage only drops to 2.43 volts) In this setup, the maximum seems to be reached at about 250 Lux. Because I want to use the sensor to have an indication of the global radiation of the sun on my solar panels (full sun up to 100,000 lux), this will not work yet. The maximum should then only be reached at 100,000 lux.
How could I fix that. I'm not very good at calculating resistors that might be needed and where they should be. My plan is attached below.

Re: OPT101 Light Analog Light Intensity Sensor

Posted: Tuesday 06 July 2021 16:38
by waltervl
You should put a halve ping-pong-ball over the sensor to get better results, the sensor is really sensitive and varies over the wavelengths.

https://forum.allaboutcircuits.com/thre ... ost-734337

Re: OPT101 Light Analog Light Intensity Sensor

Posted: Tuesday 06 July 2021 18:02
by Copitano
I don't have a ping pong ball at hand right now, but I still have a PIR sensor lying around. I was able to remove the hood very easily. I think it's as diffuse as a ping pong ball. I have now put that over the sensor, but unfortunately it makes no difference. I have also tried to get the voltage that is offered to the A0 pin down to 1 volt. But unfortunately that also makes no difference. :roll:

Re: OPT101 Light Analog Light Intensity Sensor

Posted: Wednesday 07 July 2021 7:25
by besix
First, connect the OPT 101 to a 5V power supply. The voltage range is 2.7V to 36V.
Use the calculator for voltage divider resistors, available in the first link I gave.
http://www.calculatoredge.com/electroni ... divide.htm
Connect the voltmeter to the OPT101 out output and select resistors to obtain the maximum amplitude, e.g. 0.4 - 3V, then connect OUT to ADC ESP8266

Re: OPT101 Light Analog Light Intensity Sensor

Posted: Wednesday 07 July 2021 17:52
by Copitano
I made an exact copy of the setup from this link:https://medium.com/@rxseger/esp8266-fir ... 25f317c74f
For that I used a fresh sensor without PCB because the other one could have been damaged by experimenting a lot and soldering en desoldering and I had a spare one. At first I even soldered the first sensor the wrong way round on the PCB.
I used 3.3k and 1k for the resistors because I could only measure 4.7 volts on the 5 volt pin of the Wemos D1. The measured voltage with these resistors on + and - only was 1.1 volts. After connecting to pin 4-5, 0.89 volts remained. This is then connected to the A0 (ADC) pin of the Wemos D1. However, this value does not change when I place the sensor in full sun. It even seems that the value then drops from 0.01 to 0.02??? This can be seen even better on the ESPeasy readout on the Wemos D1 where the value drops from 302 to 295. Bizarre! I would expect the value to go up. On the other hand, if I keep my finger on the sensor, the value does drop. Even if I cover the sensor with my iPhone, the value decreases and as soon as I switch on the LED lamp, the value goes back up to 0.89 volts. So that seems like a kind of maximum value. I don't understand it anymore.
Below are the results inside the house and in full sunlight. No difference :?