Page 1 of 1

Newbie question: LDR

Posted: 25 May 2019, 10:43
by pgielen
I have just succesfully flashed my first Wemos D1 with ESP Easy and got a PIR sensor to work following the tutorial in the Wiki. The values are read in Domoticz. Now, of course I want to add a LDR in a voltage divider circuit, following this tutorial: https://www.letscontrolit.com/wiki/inde ... e_resistor. In the newest version of ESP Easy, the settings are not the same as in the wiki tutorial, for example, I do not see a delay or port setting, but I think these should work:

Code: Select all

Device: Analog input - ADS1115
Name: LDR
Enabled: checked
I2C Address: default
Gain: 1x
Input multiplexer: AIN0-AIN1 (Differential)	
Calibration: not checked
Send to Controller: checked
IDX: 182
Interval: 60 sec
Name #1 Analog
Formula: 100-%value%*100/32752
Decimals: 0
The idx 182 is of a virtual device I created in Domoticz, of the type LUX. The value however always stays 200, regardless if it is dark or light. The log file does not show any data coming in from ESP. Am I overlooking something?

I also tried changing the Device tot Analog - internal. No improvement.

Pierre

Re: Newbie question: LDR

Posted: 25 May 2019, 12:28
by pgielen
I solved it myself... The LDR does not return a LUX value, but a voltage, so I had to create a Voltage device in Domoticz and set the formula in ESP Easy to (%value%/1024)*3.3
If light, the voltage is low, if dark, the voltage is high... :D

Re: Newbie question: LDR

Posted: 29 Jul 2019, 18:55
by stin88
How is your setup? im using 10kohm and a LDR, using the spec you providing and the one at the link, i get 65535.00

3.3v ---------
|
LDR
|
------------ADC on esp8266
|
10kohm
|
GND----------



im still stuck on one analog value :(

suggestions?

Re: Newbie question: LDR

Posted: 29 Jul 2019, 21:27
by stin88
nvm, wemos d1 mini got a voltage devider, Didnt know "Analog input of the ESP-chip can only read up to 1V (8bit Resolution= 1024 steps)"

3.3v ---------
|
10kohm
|
|------------A0
|
LDR
|
GND----------



A0 (input) ---
|
220k
|
|----------ADC
100k
|
GND --------