How to Make Light Sensor and Darkness Detector With BC547

Whether you’re a beginner in electronics or a hobbyist wanting to expand your skills, building a light sensor and darkness detector is a classic and rewarding project. These circuits detect changes in ambient light and activate an output — such as an LED — based on brightness or darkness.

This article will walk you through everything you need to know to build both circuits using a BC547 NPN transistor and an LDR (Light Dependent Resistor).

What You’ll Build

You’ll create two related projects:

  1. A Light Sensor Circuit – Turns ON a LED when light is present.
  2. A Darkness Detector Circuit – Turns ON a LED when light is absent (dark).

These circuits are great for learning how transistors switch loads based on sensor input, and they form the basis for things like automatic night lights, light alarms, or smart gadgets.

Required Components

Here’s what you’ll need:

ComponentQuantity
BC547 Transistor (NPN)1
LDR (Light Dependent Resistor)1
LED (any color)1
Resistors~470 Ω, 1 kΩ, 47 kΩ (depending on circuit)
Breadboard & Jumper WiresAs needed
9 V battery and connector1
Optional: Potentiometer (10 kΩ or higher)1 (for sensitivity)

Tip: Using a potentiometer lets you adjust how sensitive the circuit is to light and darkness.

Understanding the Main Components

LDR (Light Dependent Resistor)

An LDR is a photoresistor whose resistance changes with light intensity.

  • Bright Light → Low resistance
  • Darkness → High resistance
    This change is the basis for both light and dark sensing.

BC547 Transistor

The BC547 is a widely used NPN bipolar junction transistor (BJT). When the base gets sufficient voltage (from the voltage divider involving the LDR), it allows current to flow between its collector (C) and emitter (E) — effectively acting as a switch.

Circuit Basics: How It Works

Your circuit uses a voltage divider made from the LDR and a resistor. The combined voltage at the divider feeds the base of the BC547, controlling whether the transistor turns ON or OFF:

  • In the Light Sensor: Light causes the LDR resistance to drop → more base voltage → transistor switches ON → LED lights.
  • In the Darkness Detector: Darkness causes the LDR resistance to rise → the base gets enough voltage → transistor switches ON → LED lights.

In both cases, the BC547 amplifies this simple resistance change into a usable output (the LED).

Step-by-Step: Light Sensor Circuit

1. Set Up Power

Connect your 9 V battery into the breadboard rails: positive on the top row and negative on the bottom row.

2. Build the Voltage Divider

  • Attach the LDR from the positive rail to a point on the breadboard.
  • Connect a fixed resistor (e.g., 47 kΩ) between that point and ground.
    This sets a variable voltage at their junction based on light levels.

3. Prepare the Transistor

Identify the pins of the BC547 (emitter, base, collector). Later you’ll connect:

  • Base → the voltage divider junction.
  • Collector → LED (via a resistor).
  • Emitter → ground (negative rail).

4. Connect the LED

Plug the LED into the breadboard so its longer leg (anode) goes to the collector through a current-limiting resistor (~470 Ω or 1 kΩ), and the shorter leg (cathode) goes to ground.

5. Test

Expose the LDR to light. If wired correctly, the transistor will turn ON and light up the LED when there’s enough light.

Step-by-Step: Darkness Detector Circuit

This is very similar — but arranged so the circuit activates when light fades:

1. Power and Divider

Same setup as before, but swap where the LDR and fixed resistor go in the voltage divider — this changes how the base voltage reacts when the light changes.

2. Base Trigger

The junction between LDR and resistor still feeds the base of BC547, but now when darkness causes the LDR resistance to rise, the transistor gets biased more easily → turning ON and lighting the LED.

3. LED Connection

Connect your LED from power → resistor → transistor collector → emitter → ground. When in darkness, the base triggers, transistor conducts, and the LED glows.

Reading Your Circuit

Here’s what happens in each condition:

ConditionLDR ResistanceBase VoltageTransistor StateLED
Bright LightLowLow (light sensor)OFFOFF
DarknessHighHighONON

That’s why arranging the resistor and LDR differently changes whether the LED lights in light or dark.

Tips & Enhancements

Sensitivity Adjustment

Use a 10 kΩ potentiometer instead of a fixed resistor so you can tweak the light/dark switching threshold.

Adding a Relay

Want to control higher-power lights instead of just an LED? Add a relay connected to the transistor’s collector. When the transistor switches, it will activate the relay.

Breadboard Clean-Up

Ensure all connections are secure and use jumper wires neatly — loose connections can lead to inconsistent behavior.

Practical Applications

Once you’ve built and understood these circuits, you can adapt them for:

✅ Automatic night lights
✅ Lighting control systems (e.g., street light automation)
✅ Light-triggered alarms
✅ Art or sensory projects

These small projects lay the foundation for more advanced electronics design.

Conclusion

Building a light sensor and darkness detector with a BC547 and an LDR is an excellent introductory electronics project. You’ll learn how sensors, voltage dividers, and transistors work together to turn environmental changes into actions — a real-world building block of smart electronic devices.

Give it a try on a breadboard, tweak the resistor values, and soon you’ll be comfortable designing your own automatic light-sensitive gadgets!