Hello guys,
I need to difference when an object is on shadow or not. Can I do this with a simple LDR or I need a sensor like BH1750 ?
I tried with LDR, but always I get the value 1024 on my analog port (max value) without difference.
Thanks
Hello guys,
I need to difference when an object is on shadow or not. Can I do this with a simple LDR or I need a sensor like BH1750 ?
I tried with LDR, but always I get the value 1024 on my analog port (max value) without difference.
Thanks
An LDR will be fine.
You will never get 1024 from an 10 bit analog port. The maximum is 1023. Assuming that is the case, you have a wiring problem.
Please post the details your circuit, and the code. A hand drawn wiring diagram, with component values and pins identified, would be fine.
yes 1023 it's right value, sorry for that.
I'm connect LDR to analog Port of my NodeMCU 0.9, maybe I should use a resistance between ?
Thanks and sorry my electric knowledge are basics
giuntajorge:
Thanks and sorry my electric knowledge are basics
It sounds as if your circuit is incorrect. There's a pretty good guide to light dependent resistors here: Photocell Hookup Guide - SparkFun Learn
Thank Mark, if I'm not wrong, I need a voltage divider, actually I use similar to get voltage from my battery.
I will read the article. So, I will not spend money on sensor.
Have a great day
For low light levels you should be able to get readings by wiring your LDR between the analog input pin of your NodeMCU and the 3.3V pin. This as there's a 100k+220K voltage divider on the analog pin itself... Probably not useful for practical applications of course.
When designing your final circuit, you may keep that voltage divider in mind. It effectively reduces the input impedance of the analog input to 320k. If your LDR resistance gets in that order of magnitude (low light levels) this will affect your readings.
Attached is a basic LDR circuit. The LDR and a fixed resistor are in series with one end going to a common ground and the other to Vcc. The junction would be to your micro controller A.D Analog Input channel. Most LDRs have a decreasing resistance as more light strikes them. With that in mind you can reverse the position of the LDR and Resistor. Anyway is your LDR setup this way? The image uses a 3.3 volt Vcc but that is unimportant. Most LDRs have a data sheet which will show the Light and Dark resistance giving you something to work from.
Ron
wvmarle:
For low light levels you should be able to get readings by wiring your LDR between the analog input pin of your NodeMCU and the 3.3V pin. This as there's a 100k+220K voltage divider on the analog pin itself... Probably not useful for practical applications of course.
When designing your final circuit, you may keep that voltage divider in mind. It effectively reduces the input impedance of the analog input to 320k. If your LDR resistance gets in that order of magnitude (low light levels) this will affect your readings.
Thanks a lot for your answer, actually uses same voltage divider to monitor my 18650 battery voltage.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.