OPT101 Light Analog Light Intensity Sensor

Everything about esp8266 and more.

Moderator: leecollings

Post Reply
User avatar
Copitano
Posts: 49
Joined: Friday 28 June 2019 1:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: NL
Contact:

OPT101 Light Analog Light Intensity Sensor

Post 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 ;)
besix
Posts: 99
Joined: Friday 25 January 2019 11:33
Target OS: Linux
Domoticz version: beta
Location: Poland
Contact:

Re: OPT101 Light Analog Light Intensity Sensor

Post 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
User avatar
Copitano
Posts: 49
Joined: Friday 28 June 2019 1:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: NL
Contact:

Re: OPT101 Light Analog Light Intensity Sensor

Post 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.
Attachments
IMG_7967 klein.jpg
IMG_7967 klein.jpg (93.74 KiB) Viewed 2402 times
IMG_7966 klein.jpg
IMG_7966 klein.jpg (113.75 KiB) Viewed 2402 times
User avatar
waltervl
Posts: 5374
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: OPT101 Light Analog Light Intensity Sensor

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Copitano
Posts: 49
Joined: Friday 28 June 2019 1:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: NL
Contact:

Re: OPT101 Light Analog Light Intensity Sensor

Post 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:
Attachments
IMG_7971 klein.jpg
IMG_7971 klein.jpg (104.34 KiB) Viewed 2393 times
besix
Posts: 99
Joined: Friday 25 January 2019 11:33
Target OS: Linux
Domoticz version: beta
Location: Poland
Contact:

Re: OPT101 Light Analog Light Intensity Sensor

Post 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
User avatar
Copitano
Posts: 49
Joined: Friday 28 June 2019 1:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: NL
Contact:

Re: OPT101 Light Analog Light Intensity Sensor

Post 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 :?
Attachments
IMG_7976 klein.jpg
IMG_7976 klein.jpg (116.29 KiB) Viewed 2374 times
IMG_7977 klein.jpg
IMG_7977 klein.jpg (93.25 KiB) Viewed 2374 times
IMG_7982 klein.jpg
IMG_7982 klein.jpg (93.27 KiB) Viewed 2374 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests