Choosing the correct LDR sensor

Thread Starter

Ping pong

Joined Feb 13, 2022
91
I have a small Arduino project in mind that'll turn on/off a car lights depending on the ambient brightness levels with two separate thresholds for both parking and the low beams.

For testing purposes, I salvaged an ldr sensor from a cheap LDR relay module that I bought a while back and found out that at around 250 analog value, it is dark enough for the parking lights to turn on and anything below 180 should trigger the headlight low beams to kick in as well.

But now that I'm looking into buying the actual components, I found out that there are different versions of an LDR sensor available namely GL5506, GL5516, GL5528, GL5537, GL5539, GL5547 and GL5549. There is no data on what LDR sensor was used on the relay module for me to buy the exact one.

When looking at the data sheets for LDR, I found out that each had a slightly different resistance value to light. Is it safe to assume that I could role with any one of these and would only have to tweak the threshold values a bit when changing from one ldr type to another. Is there an ideal candidate that I should choose for an Arduino project or all of the above will be perfectly fine.


LDR sensors in question:
https://a.aliexpress.com/_oC2Rdk0

Relay Module:
https://a.aliexpress.com/_onijHwM
 

Thread Starter

Ping pong

Joined Feb 13, 2022
91
Hi pp,
The relay model link shows it has already an LDR fitted.?
E
Yup but I ain't using the relay module since that doesn't allows for two separate thresholds. Plus these aren't fit for use in cars because if you drive under a bright street lamp, it'll turn the relay on and off. The Arduino project I'm working on allows for adding delay times and hysterics to mitigate any random switching of the lights under odd lighting conditions.
The ldr sensor that I used for testing was taken from this module.
 

ericgibbs

Joined Jan 29, 2010
21,419
Hi Pp,
I understand.
It would be interesting to see your circuit and Arduino Sketch, I can run tests using the same type LDR's, which I have in stock.
E
 

Thread Starter

Ping pong

Joined Feb 13, 2022
91
Hi Pp,
I understand.
It would be interesting to see your circuit and Arduino Sketch, I can run tests using the same type LDR's, which I have in stock.
E
Sure! I don't really have a diagram prepared for it. All I'm using is a 2 channel relay module and two triggers for ACC and IGN so the code considers when the car is running for the auto lights function to start working.
For testing purposes I use a 12v battery to simulate the triggers in the car but you could simply use the 5v power from Arduino for the two triggers.
If you have the components with you, aka an Arduino and two relays, I'd love to share the code with you.
But how exactly do you know which LDR is which. Have them labeled maybe or can I hook it up to a multimeter and match the resistance against the data sheet.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
27,316
I suggest that some other variables also need to be considered for an automotive light control application. The effect of temperature on an LDR certainly is important because automotive sensors see a wide variation in ambient temperature. And certainly mechanical considerations apply because the auto is a vibrating environment. So even the durability of the leads will need to be considered. So tere you have some additional factors that should assist in the slelection process.
 

Reloadron

Joined Jan 15, 2015
7,870
For testing purposes, I salvaged an ldr sensor from a cheap LDR relay module that I bought a while back and found out that at around 250 analog value, it is dark enough for the parking lights to turn on and anything below 180 should trigger the headlight low beams to kick in as well.

But now that I'm looking into buying the actual components, I found out that there are different versions of an LDR sensor available namely GL5506, GL5516, GL5528, GL5537, GL5539, GL5547 and GL5549. There is no data on what LDR sensor was used on the relay module for me to buy the exact one.
How much does it matter? You mention numbers like 250 and 180 so I assume you are looking at an analog bit count? That or the resistance reading across the LDR. Using any LDR you can adjust your code accordingly. So I really don't see where you need an exact duplicate LDR?

I also suggest that in your code you include hysteresis so during a transition your uC isn't On/Off/On/Off and chattering away.

Ron
 

LowQCab

Joined Nov 6, 2012
5,101
It can also be a good idea to use multiple sensors, mounted in multiple different positions,
to get a better indication of the "average" amount of Light,
rather than the amount of Light sensed at a single location or direction.
.
.
.
 

Thread Starter

Ping pong

Joined Feb 13, 2022
91
The effect of temperature on an LDR certainly is important because automotive sensors see a wide variation in ambient temperature. And certainly mechanical considerations apply because the auto is a vibrating environment. So even the durability of the leads will need to be considered.
Does temperature have any effect on LDR? I have tested this stuck to the front of the windshield in numerous hot summer days and didn't see any difference in performance. As far as the durability is concerned, you can bet I use looms and everything. Again, haven't had any problem with 'vibrations' either but will keep an eye for it.

I also suggest that in your code you include hysteresis so during a transition your uC isn't On/Off/On/Off and chattering away.
Already have as mentioned in #3. Hysteresis coupled with delay on and off times.

It can also be a good idea to use multiple sensors, mounted in multiple different position
Yup. I did consider that while working on this project and decided on mounting a second sensor against the rear glass but routing a bunch of wires all over the vehicle didn't really seem that practical to me. Especially when you have to strip apart half the interior just so you can hide the cables and make everything neat. Considering all the vehicles with these features have their sensors mounted in one central position (behind the rear view mirror or against the windshield) I went with that as well.
 

Thread Starter

Ping pong

Joined Feb 13, 2022
91
How much does it matter? You mention numbers like 250 and 180 so I assume you are looking at an analog bit count? That or the resistance reading across the LDR. Using any LDR you can adjust your code accordingly. So I really don't see where you need an exact duplicate LDR?
Alright then, so it is safe to assume that I'm good with any of the sensors listed in the ad and all I'll need is a bit of tweaking of the code. Thank you!!!
 

Reloadron

Joined Jan 15, 2015
7,870
Alright then, so it is safe to assume that I'm good with any of the sensors listed in the ad and all I'll need is a bit of tweaking of the code. Thank you!!!
That's my thinking. Just start by looking at bit counts based on ambient light on the sensor and the sensor where you want it to be mounted. Once you have what you want as to an analog in count then start expanding your code. :)

Ron
 
Top