I want to make a project about this topic but I need more knowledge about it. Thus, I have made quite research about "Calculating Distance of Light Source between LDR and Light Source with Voltage Changes of Analog Input with LDRas using the reading of it on serial monitor in Arduino" on the internet but I cannot find solid information. Thus, I wanted to ask here today.
I have a few questions about LDR to be sure now:
The serial readings we are seeing in the serial monitor which represents the voltage changes of the analog input (that are converted analog voltage between 0-5V into digital values in the range of 0-1023) where we connect our LDR on Arduino, right ? thank you.
The resistor we connect to LDR affects the measurement values in the serial monitor too, right ? thank you. Then, which resistor is best to use on LDR ?
What happens if I don't put a resistor to LDR that it shortly burns out or damages the LDR ? thank you.
This is simple distance calculation equation (X = V.t). SO, in our case, how can we find the distance between LDR and the Light Source ?
the speed of light = 299 792 458 m / s ,and let's say the distance between light source and LDR are 10cm then I can find the time. However, how to find the distance as using the analog readings of LDR on the serial monitor in Arduino ?
I am kind of confused about this topic. I will be very happy if you friends guide me or enlighten me about this subject, thank you very much.
You seem to be under the impression that one can calculate the distance to a passive light source knowing only it's intensity. You can't because the intensity depends on more than just the distance.
Also, you can't measure the time taken for the light to come from a passive light source since you can't know when the light was actually emitted. If the light source is actually something like a laser and you fire the laser with very short pulses you could measure the time taken from when you send the pulse to when you receive it BUT you would need something faster than an LDR being read with an analogue input.
MEKACI:
the speed of light = 299 792 458 m / s ,and let's say the distance between light source and LDR are 10cm then I can find the time. However, how to find the distance as using the analog readings of LDR on the serial monitor in Arduino ?
So the light will take 0.00033uS to cover the 10cm.
You need to use something faster such as a photodiode.
Even then you will struggle with the timing.
Photoresistors are less light-sensitive devices than photodiodes or phototransistors: the two latter components are true semiconductor devices, while a photoresistor is a passive component and does not have a PN-junction. The photoresistivity of any photoresistor may vary widely depending on ambient temperature, making them unsuitable for applications requiring precise measurement of or sensitivity to light photons.
Photoresistors also exhibit a certain degree of latency between exposure to light and the subsequent decrease in resistance, usually around 10 milliseconds. The lag time when going from lit to dark environments is even greater, often as long as one second. This property makes them unsuitable for sensing rapidly flashing lights, but is sometimes used to smooth the response of audio signal compression.[2]
Q How far does light travel in the 10ms that the LDR may take to respond?
Imagine your standing outside in the dark and you see a flash of light in the sky. Could you tell how far away it was By how bright it was?
Without knowing what caused the flash or how bright it was to start with?
You may be able to use an LDR to determine distance using the light intensity if you first calibrate the system for a specific steady light source and if there is no other light source in the room. You would need to measure the output from the LDR for a number of different distances from the light and make a note of the values.
Later you could (maybe) infer the distance between the LDR and the same light by comparing the output shown by the LDR with the values you had previously recorded. However I suspect it will not allow you to know the distance very precisely.
An Arduino is not at all fast enough to measure distances based on the speed of light.
You may be able to use an LDR to determine distance using the light intensity if you first calibrate the system for a specific steady light source and if there is no other light source in the room.
Yes...
which resistor is best to use on LDR ?
Most photoresistors have a nominal resistance measured when light falls on them with an intensity of 10 lux. Example HERE Start with a resistor equal to that value.
What happens if I don't put a resistor to LDR
Don't do that.
how to find the distance as using the analog readings of LDR on the serial monitor in Arduino ?
You need to learn about light intensity VS distance. It is non-linear. Learn about "inverse square law". And "It Depends" on things like the light source, how accurately the source falls on the photosensor.
Get something working and experiment. That's what Arduino is for.
For my 1st question,
/* The serial readings (which we get from the LDR that it is connected to analog pin) that we are seeing in the serial monitor which represents the voltage changes in the analog input (that are converted analog voltage between 0-5V into digital values in the range of 0-1023), right ? thank you.
*/
I know that the readings on the serial monitor represents the light intensity amount that LDR measures with voltage changes according to the incoming light's brightness ( there is a special resistor inside of the LDR makes these happen that resistance amount increasing or decreasing according to the light source's intensity ).If someone answer this 1st question above, I will be very happy and then there will be no doubts on this subject for me which I want to be sure only and learn it correctly, thank you very much.
MEKACI, Hi
Are you saying you wish to point the ldr at any light source and find the distance?
You will not know the light source intensity or how far it is away?
MEKACI:
that are converted analog voltage between 0-5V into digital values in the range of 0-1023
Yes - as long as your voltage reference is 5V.
If you use another reference voltage (Vcc is at a different level, or you use the internal 1.1V reference, or you have an external reference connected to the AREF pin) it scales accordingly.
Hi,
Can you post your code please?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
As @terryking228 has said, as long as you have calibrated your distance to intesity and keep the transmitter intensity at that calibrated level, then you can calculate distance.
BUT the LDR is not just sensitive to your transmitter, it will respond to the other light that is around it.
So at night you will have a different response to daytime.
What is the application you have for the distance measuring project?
Daz1712:
MEKACI, Hi
Are you saying you wish to point the ldr at any light source and find the distance?
Yes
Daz1712:
You will not know the light source intensity or how far it is away?
I still want to know and measure the light source intensity; but I want to find a solid way to measure the distance with LDR too. And in the meantime, I want to improve my knowledge at these kind of interesting topics with using arduino.
There is NO useful relationship between "the light source intensity" and "the distance" even if you know the amount of light the source produces. It depends on the size/shape/directionality of the light source for starters. Then there's ambient light, even in an otherwise perfectly dark room there's going to be stray light reflected from the walls and ceiling that mess up your brightness reading.
A solid way to measure distance with an LDR: measure the size of your LDR, them measure how many LDRs fit in between the two points. A simple multiplication gives you the distance.
TomGeorge:
Hi,
Can you post your code please?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
As @terryking228 has said, as long as you have calibrated your distance to intesity and keep the transmitter intensity at that calibrated level, then you can calculate distance.
BUT the LDR is not just sensitive to your transmitter, it will respond to the other light that is around it.
So at night you will have a different response to daytime.
What is the application you have for the distance measuring project?
Thanks.. Tom...
I am making a kick ass robotic tank project in the university (I study AI and Robotics in UK). This is my own design robot tank. I hope that you like it too. I finished 80% of it. Only this LDR part left; so I had trying to improve my knowledge and get some guidance first before jumping instantly like my old version (if you remember my first forum threads in Arduino forum^^).
You can use an LDR to get the direction of a light source. You can use other methods (ultrasound is popular) to get the distance to the nearest object (if any) in range.
Could you use a parallax method to get an indication of range?
Two pairs of LDRs mounted on servos turn to a light source so that when turned, illumination on each pair of LDRs is equal.
Simple trig gives a rough idea of range.
I think it is time to ask a basic question - WHY do you want to know the distance from the light source?
Maybe if we knew that we could offer some useful solutions.
It is always a bad idea to ask two questions at the same time, but I will take a chance that you will answer both of them - How accurately do you want to measure the distance?
If you have to work with light then you need to look at Lidar as an LDR will not do this, it is for light intensity ONLY.
EG. You have two stars in the sky, one is bright and one is dim, conclusion! The bright star must be closer. Wrong.
Turns out the bright star is twice the distance of the dim one but is 4 times as bright.
Your answer was based on intensity only which is 2 dimentional thinking when we live in a 3 dimentional world.