I’m having problems with LDR values using ASL. Values are very inconsistent, tried using 10k, 100k resistors and event without it, result is the same (inconsistency). It seems that values are changing in “waves” up and down in seconds interval, so it is impossible to find correct value when it is already dark or light. Is there any solution for this?

Attaching a link to file with LDR printed values.


Changed status to publish

4 Answers

Deividas (anonymous) 0 Comments

I forgot to mention, that this light sensor is connected on ~10 meter long wire, and I think maybe this might be the cause of this inconsistency

Answered question


There is two ways how to control sun-rise sun-set mode.

The first one is to use a light resistor.As you said ,the signal from LDR is coming in a wave form – its true.

You will need to pull-up the LDR pin (using the chip internal resistor) or to pull-down with external one.

Old version of ASL do not have such external resistor , so you will need to activate internal one.( i mean 1 year old version)The existing version have such resistor already on board.

The next step is to smooth the signal. You will need to find and include an analog smooth library. There are several of them on a Github.

Then you will need to change a sketch to let the arduino check those readings in some period of time, i mean to avoid to catching a shadows… and so on.

If shortly… – some software changes


Another way is through hardware, to attach a Smart home relay.

You will need to order some additional parts ,the total cost would be around 5usd.


Smart home relay. (SONOFF as example)

220V AC neon light indicator.

Heat shrink black color.

Light resistor.


Then to assemble optoisolator see attached pic.And connect all stuff to arduino.

Create a day/night or timing to be ON/OFF using a Smart home relay interface..


Changed status to publish
Deividas (anonymous) 0 Comments


Internal pullup, you mean that I need to set pinMode(sensorLight_PIN, INPUT_PULLUP); 

Answered question

Yes , correct..

In your case (no external pull-down resistor on board) just use internal one,

in this case LDR should be connected- One leg to LGT input another to GND.

And do not forget to change (val <100 ) to (val >100 ) inside a sketch…


Answered question
Write your answer.