Connect with us

A simple LED light night switch

Discussion in 'Sensors and Actuators' started by tigfur, Jan 13, 2020.

Scroll to continue with content
  1. tigfur


    Jan 13, 2020
    i am a complete beginner and i would like to make a LED light, that turns off during the day.

    I have found this diagram online, which seems simple enough.
    - This shows a switch that turns on during light, so id have to change LDR and R2
    - I would like to use a LED instead of an LDR (found online you can do that and i find that interesting and want to try it, though it uses mosfet)
    Here are my questions:
    - passive consumption > wouldnt this design consume power even when the LED is off due to the circuit being basically shorted through a resistor?
    - Could it be modified to not consume any energy when dark?

    - is the R2 even necessary? if there was no connection it would be equal to indefinitely large resistance and still would work if the LDR resistance is high enough since it could possibly cut off the connection entirely? Obviously here its a potenciometer which helps adjust the threshold but i am just curious.

    - would i have to change anything in the math if i added a few more LEDS in paraler?

    I would like to make a long lasting battery powered outdoor light, so its important it doesnt waste energy.
    Eventually itd be nice to have it with a small solar charger but i dont know anything about that, as this already is beyond my knowledge.

    Thank you for any help


    Dec 19, 2019
    Tigfur unless I am missing something, your circuit will turn the LED on in light and off in dark. You would have to swap positions of the LDR and R2. BUT then you need a resistor in series with the base to prevent blowing the transistor when R2 is turned up to the + 9V.
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    An LED can be used as a photosensor, but the signal is much, much weaker than the one from an LDR. You need some gain (amplifier) although a MOSFET based solution with a high impedance pull-up resistor may work. You'll have to give it a try.

    It will, but only moderately (9 V / 100 kΩ = 90 µA).
    Yes: use a mechanical switch ;)
    This is obviously not what you are thinking of. In other words: no. One can minimize energy consumption (e.g. by eliminating the base current through the use of a MOSFET), but not down to zero. Without a tiny tad of energy the circuit will not be able to detect the change in environmental light.
    When you swap R2 and the LDR, you need R2 to allow base current into the transistor (or to generate a positive gate voltage for a MOSFET).
    You should not connect LEDs in parallel. Due to slight differences in their characteristic they will light quite unevenly. You can add LEDs in series, or use a parallel circuit with a separfate resistor for each LED. See our resource "got a question about driving LEDs?"
    Use a high capacity battery. The typical 9 V block is a poor source of energy for long term usage. This circuit requires ~ 18 mA when the LED is on. A typical alkaline 9 v block has a capacity of ~550 mA. At 18 mA the battery will be drained after ~30 hours of lighting, 3 days when the LED is on for 10 hours per night.
    Not to worry: This circuit will work equally well from a 5 V source (adjust R1 for LED current). SO you can use an off the shelf USB power bank (5 V) with solar charger which you can buy as a complete set from different vendors.
  4. bertus

    bertus Moderator

    Nov 8, 2019

    The given circuit does not have an hysteresis.
    There is no switching point.
    The transistor can get into a linear mode.
    A circuit with a comparator and hysteresis will switch the led on and off.

    Here is a circuit that will do that:
    At the moment there is a relays in the circuit, but that can be replaced by the leds.

  5. Bluejets


    Oct 5, 2014

    Attached Files:

  6. tigfur


    Jan 13, 2020
    Thanks for the tips.
    I will try leds in paraler with each having its resistor of course and a mosfet as thats the easiest i can do.
    I did some testing with a basic transistor and the LED resistance changed from unmeasurable to 500MegaOhm, which is indeed way too high for a regular transistor.
    The relay seems a little bit complicated but i might give it a shot some day.
    Buying it seems a valid option at this price as well.
  7. Bluejets


    Oct 5, 2014
    There are some that will argue, making it yourself is the way to learn.

    My argument for that is, buy the elcheapo unit, reverse engineer it and one is in front on two levels.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Electronics Point Logo
Continue to site
Quote of the day