How to Build a Dark-activated Switch

Dark-activated switch


In this project, we will go over how to build a dark-activated switch.

This is a switch that will turn on a circuit or a device when it gets dark.

So when it is bright and there is a lot of light, the switch does not activated. However, once it gets dark, it activates and it turns on whatever device the circuit is wired to turn on.

For example, if we connect an LED to the dark-activated switch, once it gets dark, the switch will trigger and turn on the LED. We can make our circuit power on any load. However, usually it will be a light source, because that's the most useful thing to turn on when it gets dark.

This type of circuit has extreme use because when it gets dark, it will automatically turn on lights. This is extremely useful for people who may live in a house that have vision problems and need the lights to automatically turn on when it gets dark. It's also very useful for elderly people who live in a home who may have difficulty walking to turn on lights when it becomes dark.

In our circuit, we will turn on a LED as soon as the level of light reaches a certain level of darkness. Thus, the place where we place this circuit will always be illuminated, either by the natural light of the day or by the lamp of this circuit turning on when it becomes dark.

Components Needed

  • Photoresistor
  • 100KΩ Resistor
  • 330Ω Resistor
  • 2N3904 NPN Transistor
  • LED
  • 2 AA Batteries or DC Power Supply


One of the main components we will use for this circuit is a photoresistor. Photoresistors are also called light-dependent resistors (LDRs). This can be obtained at tayda electronics at the following link: Tayda Electronics- Photoresistor. If you don't have a photoresistor, just make sure to use one that has a dark resistance of 2MΩ or greater and a light resistance of about 20-30KΩ.

A photoresistor is a resistor whose resistance changes according to the amount of light that it is exposed to. When exposed to total darkness, the photoresistor's resistance is very high. This is called its rated dark resistance. For example, in our case we are using a 2MΩ photoresistor. This means that when exposed to total darkness, its resistance will be around 2MΩ. As the photoresistor is exposed to increasing amounts of light, its resistance begins to drop significantly. There is another rating on the datasheet labeled cell resistance @ illuminance. This is the resistance that the photoresistor will drop to when exposed to bright light, typically 10 lux. It is also called the light resistance (since it is the resistance the photoresistor will have when exposed to bright light). For our photoresistor, in particular the cell resistance @ illuminance is 20-30kΩ. This means the resistance of the photoresistor will drop to 20-30KΩ when exposed to 10 lux level of light.

So a photoresistor is basically a device that gives off very high resistance at dark light levels and low resistance at high light levels. Being that it does this, it can act as a sensor for light, or a photosensor.

With the photoresistor acting as the light sensor, the other significant component is the 2N3904 transistor. The transistor in this circuit will act for a dual purpose, functioning as a switch and an amplifier. When sufficient current is driven into the base of the transistor, it acts a switch, turning the transistor on. With the transistor on, now current can flow across from the emitter of the transistor to its collector to power the load connected to the collector side of the transistor. This is how the transistor acts as a switch. It also acts as an amplifier because when a small current passes through the base, turning the transistor on, a much larger current goes from the emitter to the collector. In this way, it acts as an amplifier so that sufficient current can be produced to power on the load connected to the output of the transistor.

The power we will use for this circuit is 2 volts, which can be obtained from 2 AA batteries connected in series or from a DC power supply.


Dark-activated Switch Schematic

The schematic of the dark-activated switch circuit we will build is shown below:

Dark-activated switch circuit

So, for this circuit, 3 volts is powering the circuit. This 3 volts is in parallel to a 100KΩ resistor and the photoresistor. In the middle of these 2 components is connected the base of the NPN 2N3904 transistor.

This is how the circuit works:

When exposed to bright light, the photoresistor's resistance is very low. It drops to around 20-30KΩ. Current travels through the 100KΩ resistor and then has 2 paths- it can either go through the base of the transistor or go through the photoresistor. The base of the resistor to the collector has a resistance of around 400KΩ. Current always takes the path of least resistance. When the photoresistor is exposed to bright light, its resistance is about 20-30KΩ, which is significantly less than the 400KΩ of resistance the base of the transistor has. Therefore, most of the current will go through the photoresistor and very little will go to the base of the transistor. So the base of the transistor is bypassed. Thus, the transistor does not receive enough current to turn on and power on the LED. Thus, the LED is off when there is a lot of light in the surroundings.

However, when it begins to get dark, the photoresistor's resistance becomes very high. Its resistance goes up to over 2MΩ of resistance. This creates a very high-resistance path. Being that 2MΩ is significantly greater than the 400KΩ of resistance that the base of the transistor offers, most of the current will go through the base of the transistor. This means that current does not go through the photoresistor when it is dark, due to this high resistance. Instead current goes through the 100KΩ resistor and through the base of the transistor. The transistor receives enough current to power on and turn on the LED connected to the collector terminal.

So this is how a dark-activated light circuit can work.

Again, as always, variations of this circuit can be done. Instead of using an LED, we can use any other type of lighting fixture. You may want to use a lamp. You may want to use multiple lights, so you can place different lights in parallel in one another. All you may have to do is adjust the power settings.

Just because lights seem like the most practical and useful component to place in a dark-activated switch doesn't mean you have to use any lighting component at all. Maybe you want a buzzer to go off when it gets dark or a fan to automatically go off when it gets dark or water sprinklers to go off when it gets dark. Use any component which you need to achieve the purpose of the circuit. It could be water sprinklers that go off at night time. It could be some type of sound.


Related Resources

How to Build a Dark-activated Light Circuit

How to Build a Hall Effect Sensor Circuit

How to Build a Touch Sensor Circuit

How to Build a Reed Switch Circuit

HTML Comment Box is loading comments...