How to turn on LED when it is dark

Adding LEDs is a great way to spice up 3D printed models. In my next video I will use a simple circuit to automatically turn on LED when it is dark. Electronics are beyond scope of my youtube channel and I am not an expert so I won’t post a video on my youtbue channel about this circuit. However I can get my head around simple electronics and it can be useful to bring closer the topic.

The simplest LED circuit looks like this:

Simplest LED circuit

As a power source I use 2 AA batteries in series pack which is 3V. Green LED has forward voltage of about 2.2 V and forward current about 20 mA. To calculate resistor value you can use calculator:

http://led.linear1.org/1led.wiz

In this example the calculated resistance is 47 ohms. It is possible to use greater values to limit the current and power consumption but it can affect the LED brightness.

Next step is to add a simple switch so we can manually turn on and off the LED:

LED circuit with a switch

Usually the switch is placed closer to the voltage source. The next step is to replace a switch with a transistor or as in my case with a MOSFET.

MOSFET as a switch

Here I replaced a switch with a 2N700 MOSFET. In this application it is treated as an electronic switch. Depending on your application and source voltage you will probably add a resistor before MOSFET gate (between SW2 and M1).

When switch SW2 connects MOSFET to +3v (up) the LED is on, when connected to ground (down) it acts as a open switch. It can be visually presented like this:

Not exactly how MOSFET works

Ok great I replaced a switch with a MOSFET, but I still need to switch SW2 in order to turn the LED on or off. And this is exactly the next and last step.

Phototransistor as a switch controlling LED

Phototransistor as a switch

Ok that’s it. I replaced switch SW2 with a 1 MΩ resistor and FT06-M phototransitor now the circuit is ready. When the phototransistor is lightened the MOSFET gate is connected to GND (LED goes off), otherwise to +3V via R2 resistor (LED goes on). You can change R2 value to change the LED switch threshold. By adding a potentiometer in series with R2 you can smoothly control it.

Why MOSFET and phototransitor

FT06-M is rated at max 40mA so you can use it without MOSFET to drive max 2 LED at 20mA each. 2N700 is rated at max 200mA. In my case I am using 5 LEDs which is 100mA and that’s enough to burn the phototransistor.

How long it will last

I use 2 AA batteries which is about 1000-2000 mAh. Let’s assume 1500 mAh. For 5 LEDs and 360 Ω limiting resistor I measured the current with a multimeter:

LED off: 0.003 mA

LEDs on: 0.7 mA

Assuming that every day for 12 hours the LED are on and for 12 hours are off. One day is equal to 12*0.003+12*0.7 ≈ 8.5 mAh power consumption. So about 176 days.

By the way I have no idea why I measured 0.7mA. With single 360 Ω resistor the current for LEDs should be 8.3 mA making the batteries last for about 15 days.

Final word

There are a lot of better sources about ‘MOSFET as a switch’ and phototransitors online where you can find more reliable and in depth information.

Be sure to check my next video were I will use this circuit and add LEDs to Swamp Dragon by Raffo San from My Mini Factory:

https://www.myminifactory.com/object/3d-print-skyrim-swamp-dragon-wall-trophy-72903

33 comments

  1. wonderful post, very informative. I wonder why the other experts of this sector don’t notice this. You must continue your writing. I am sure, you’ve a great readers’ base already! Floretta Memmott

  2. We’re a gaggle of volunteers and opening a new scheme in our community. Your web site offered us with useful info to paintings on. You have done an impressive process and our entire community will probably be grateful to you. Jamaal Billington

  3. Hi there. I found your website by the use of Google while searching for a comparable matter, your site got here up. It seems to be good. I have bookmarked it in my google bookmarks to come back then. Dorree Ricardo Creath

  4. You have made some decent points there. I looked on the internet for additional information about the issue and found most people will go along with your views on this web site. Penni Billie Swithbert

  5. Having read this I believed it was rather informative.
    I appreciate you taking the time and energy to put
    this information together. I once again find myself personally spending a lot of time both
    reading and leaving comments. But so what, it
    was still worth it!

  6. Admiring the commitment you put into your blog and in depth information you provide.
    It’s nice to come across a blog every once in a while that isn’t the same unwanted rehashed information. Excellent read!

    I’ve saved your site and I’m adding your RSS feeds to my Google
    account.

Comments are closed.