Dark/Light sensor using transistor


Dark light sensor
Automatic dark detector senses darkness. As the light level decreases and LDR meets the maximum threshold resistance, the circuit automatically switches on the LED D1. 

Dark light sensor

Dark sensor with variable resistor:
Dark light sensor

A dark detector can be made using a variable resistor. The sensitivity of the circuit can be adjusted with a variable resistor.

High resistance-> more darkness to switch on the LED.

Low resistance-> less darkness to switch on the LED.

Automatic Light detector using variable resistor

A light detector senses light. As the light level increases and LDR meets the lowest threshold resistance, the circuit automatically turns on the LED D1. We can adjust the sensitivity using the preset VR1-10K.


Dark light sensor

Just swap the resistor and LDR to convert a dark sensor to a light sensor

Dark light sensor

Dark light sensor

From Schematic to PCB Production, Just Need One Tool - EasyEDA
Free Circuit Design Software:  learn to use Editor quickly and easily


    • Hi i have a 4 kw solar pv system and i am looking to buy/build a dark/light sensor switch to use as a switch, in line, into the domestic supply to turn on and off an electric oil filled radiator rated 1 or 2 kw, when the solar panels are generating enough power to run the heater. So I don’t have use energy from the grid..
      Can anyone help?

  1. Today, I want to make automatic switch, to turn on my car head lamp based on this dark sensor. Is this your scheme can be recommended for that?
    Actually, I’ve done this experiment from your scheme. With a relay (instead of LED), I hope my plan worked.
    Apparently, I have problems; at the time of the light intensity changes gradually (in the afternoon), or at the time of the transistor base current for the process began to get saturation, relay shaking, of course, my bulb flashes great, even broken.
    Do you have any suggestions to solve this problem?

    Thanks & Regards,

  2. Thank you very much for your quick response.

    I will soon try the circuit.
    If I use a 12 volt battery, what components need to be changed?

    Thanks & Regards,

  3. I want to make a dark sensor that turns on 1 led when it is dark, another when the light is ambient, and one final led when it is bright. I havent been able to find any circuit based on this description on the internet and I wanted to know if I could get some pointers.

    If it isnt possible, im okay with that! I just want to know if it is possible in one setup or if I need to make 3 sensors operate 3 individual LEDs, and if I can; could I be led to a link of the circuit? Im aming for something small and something I can enjoy making for myself.

  4. i want to make a lamp for my aquarium with dark sensor. i want to use 6 white leds 5mm..can u pls post a diagram for me to follow. thanks

  5. can you show me a digrame of how i can make a automatic dark detector 12v dc using a led tail light thank you and god bless

  6. Sir…can i make a color sensor composed of red, green, blue, yellow, and orange.

    Can i use these LDR’s to make a color sensor like these?

    And can u help me make a schematic diagram on these.

    Thankz You…

  7. Hi, I want to build a circuit that will turn a small motor in one direction when light is present and then reverse the motor when the light is out.

    This circuit will be used to open a door in the morning when the sun comes up. After the door is completely open, it will trigger a limit switch to stop the motor. When darkness falls, the motor will need to run in reverse to close the door. When the door is closed, it will also need to trigger a limit switch to stop the motor.

    Is this possible? Thank you!

  8. Thanks man! It is surely the most simple and the best explanation for a dark/light sensor! I want to light up more than one, say 3 LEDs in this way. Any changes to be done? Thanks in advance buddy!! 🙂

  9. Hi my brother, i am very impressed with your site. Can you help me with how to use ldr with atleast 40 leds for security lights

    • You need to use a dedicated “LED driver” and a microcontroller for controlling at least 40 LEDs or, you need to have a power transistor that can take up to 2 Amp.

      • hye mr admin..can u help me how to make dark sensor using relay..the relay must Normally Open when connected with 5WATT Solar Panel (Max. Voltage: 17V, Short Circuit Current: 0.34Ampere.)..Tq..What type of relay i need to use for this low power solar panel for switch the relay..

  10. I am using the same configuration but using lm741 as comparator. The output of that will light an LED strip. I want to usr RC circuit to fade in and out that. What type of transistor do I need? Can you draw a schem. Thanks

  11. hi sir, i need a theoretical proof for the values of the resistors used in this two circuits. this is quite a useful start for the beginners! nice job sir! help me out as soon as you can!

  12. dear sir i currently saw your video on light sensor on youtube , i need to make this for my project so kindly can u give me the materials required to make it as i am unable to figure out the materials in video

      • thnx for d link sir!!!
        i made d ckt using LM358 n it’s functioning properly…but sir, dere’s 1 thng i wanna tell u that
        even a 5th grade boy wud do d connectns if v gave him some basic tips n ckt diagram, but
        being a future engg 1 shud know y is this happening….dis thot haunts me a lot…
        thr4 1 request u if u can tell me d working of dis ckt…..i tried to figure out bt got
        confused in no. of points…. i wud b very thnkful to u sir….
        PLS help me out…

        • You need to learn about operational amplifier. You can start with LM741 operational amplifier(op amp). Try to understand the description of this project: http://www.buildcircuit.com/dark-sensor-using-741-2/

          If you understand this you can also understand the working LM358 because it is also a type of op amp. The simple circuits have been published on buildcircuit for electronic starters. If you are studying in school, just focus on learning about components. There are several things you need to learn, so wait till you join engineering.

  13. Nice post. I was checking continuously this blog
    and I’m impressed! Extremely useful information particularly the last part 🙂 I care for such info a lot. I was seeking this certain info for a long time. Thank you and best of luck.

  14. Sir, i am a beginner in electronics and i am going to make this but i wanted to light up more LEDs instead of just one…so should i use a resistor of lower resistance and if yes then where should i place it or should i use a trim pot or potentiometer?? please help

    • Nevermind sir i saw the comments and figured it out but please help on this thing that if i connect my LEDs in series will not their brightness decrease and if yes then please recommend a solution..

  15. need some pointer here. I’m building an automatic light system which need to be shutoff during night time. i believe i have some idea on that part using simple connection through a relay. however i’ve to depend a car battery. so my question is how do i size up the circuit so it can take up higher amp and volts. thanks in advance.

  16. Hey, can I use SL100 instead of BC547?

    Also, I saw a couple of links that showed making the same thing using two transistors? One transistor will do right?

    • You can use any voltage that doesent burn out your LED. Remember V=IR so you may want to increase your resistance.
      The Differant resisters adjust the sensativity of the phototransistor so if you change those values it may always stay on, or need very bright light.
      It would also be smart to incorperate hysterisis so you dont get flickering when the current is “just” right.

  17. i have made a automatic light sensor .if i use greater or less than 6V battery will it work? why different resistors are used?

    • add a relay to the output with a protection diode in front of the relay or search for connecting a relay on google and you will understand better.

  18. sir this video is very helpful bt pls sir i wnt the working of dark sensor today only as soon as possible … as tomorw is my practical nd i hve made this circuit nd it is now working bt i dont know how it is working…. thank you sir

  19. sir..
    i follow your circuit in the video,but it doesn’t work..
    i also do the automatic dark detector circuit on the breadboard but replace the transistor with 2N3904/BC547..
    But,it work reversely..the led turns off when dark..
    can u help me how to do it properly?

  20. Hi, I would like to ask why transistor is needed for lighting up the LED? Since LDR has almost similar characteristics as a variable resistor, through voltage divider rules, LED still turned on, right? Hope to receive your feedback. Thanks.

  21. Dear sir,
    How many bulbs or lamps can the above dark light detector control?Can it be modified to handle strong lamps?If yes help me with materials used thanks

  22. Hi…. In this dark sensor circuit .. i want to illuminate the led using AC supply and not the dc voltage…. Can anyone help me out with this

  23. I want to run a 9v motor instead of a LED in the Dark Sensor. can you please send me the materials wanted?

  24. First of all I wanna thank you. This circuit is really working fine. But, instead of led, i wanna replace that with 5v DC motor. I replaced BC547 with 2n3055. But it is not providing sufficient current to drive motor. Should I use SL100 ? Could you please help me out with this ?

    Thank You,

    • You could use the darligton pair transistor BC517 to fire 2N3055 which would in turn drive the load.
      That should work fine for your motor.

  25. I want to make an dark detecting sensor. I want to make some changes like in place of led I want a buzzer. How to choose a good buzzer??? It’s for my school project to make security system