Lights and Display Board Circuits

Automatic Washroom Light Switch


In this project, I’ll guide you through the process of creating a straightforward Automatic Washroom Light Switch. This device will automatically activate the lights upon entering the washroom and deactivate them upon exiting.

Typically, we switch on the washroom lights upon entering and switch them off upon exiting. However, it’s not uncommon to forget to turn them off, leading to unnecessary energy consumption and a shorter lifespan for the light bulbs. To address these concerns, I’ll demonstrate how to construct a basic circuit that takes care of this automatically—turning the lights on when someone enters the restroom and turning them off when they exit.

This automation offers several advantages, as individuals no longer need to worry about manually operating the light switch every time they use the restroom. The circuit, which we’ll delve into shortly, handles this task automatically.

Moreover, the circuit is designed for energy efficiency, making it suitable for use in both residential and public restrooms without causing any issues.


  • Introduction
  • Automatic Washroom Light Switch Circuit Diagram
  • Components Required 
  • A Brief Note on Reed Switch
  • Circuit Design 
  • Working
  • Operation of the Circuit 

Automatic Washroom Light Switch Circuit Diagram

Components Required 

  • Reed Switch with Magnet (available as combination)
  • LM741 Op-Amp IC 
  • CD4017 Decade Counter IC 
  • 5V Relay Module 
  • Lamp 
  • BC558 PNP Transistor
  • 2 X 10KΩ Resistor 
  • 100Ω Resistor 
  • 820Ω Resistor 
  • Connecting wires 
  • Mini Breadboard 
  • 5V Power Supply

A Brief Note on Reed Switch

A crucial component of this circuit is the Reed Switch, specifically employed to sense the door’s opening and closing in this project. The image below depicts a typical Reed Switch.

Automatic Washroom Light Switch Reed Switch Internal

A Reed Switch is a type of switch that responds to magnetic fields. It features a magnetically sensitive mechanism that will either open or close when subjected to a gentle magnetic force, depending on its design.

Reed switches can be categorized into two types: those with normally open contacts and those with normally closed contacts.

Here’s an image of the Reed Switch utilized in this project. While it’s encased in a housing, the component with wires represents the Reed Switch, and the other part is a magnet.

This is a Normally Open (NO) type switch, meaning it typically remains in the open position. When a magnet is brought close to the switch, it will then transition to the closed state.

Reed Switches are primarily employed for detecting whether a door is open or closed. They can also serve as proximity sensors.

Circuit Design 

The primary component in this setup is the LM741 Op-Amp, configured to operate in comparator mode. Pin 2 serves as the inverting input for the LM741, and it receives input from two 10KΩ resistors.

One terminal of the Reed Switch is linked to the +5V power supply, while the other terminal is connected to the base of a PNP Transistor (BC558). Additionally, a resistor is used to pull down the base of the transistor.

The emitter of the transistor is connected to the non-inverting input of the Op-Amp, while the collector of the transistor is linked to the +5V supply.

Automatic Washroom Light Switch

Pin 1 of LM741 i.e. its output is connected to the CLK input of CD4017 i.e. its Pin 14. Pin 2 of CD4017 is connected to the input of the relay while Pin 4 is connected to Pin 15. 

Rest of the connections can be easily understood from the circuit diagram. 

WARNING: If you are planning to use a real light bulb that runs on AC Supply, be extremely careful when connecting it to the relay and providing the mains supply. 


Before delving into the circuit’s functionality, let’s first understand the planned configuration of the circuit. The magnet is affixed to the door, while the reed switch is positioned on the wall nearby. Initially, let’s assume the door is closed when the washroom is not in use (our starting point), which means the reed switch will be in the closed position as the magnet is near it.

Now, envision entering the washroom through the front door and subsequently closing it behind you. This action will open the reed switch (when the door is first opened) and close it (when you shut the door).

Consequently, the Op-amp’s output goes from HIGH (when the door is opened) to LOW (when the door is closed). This, in turn, triggers the counter to generate a HIGH output at its Pin 2. Given that Pin 2 of the CD4017 is connected to the relay, the light will be switched ON.

Now, when you’ve completed your tasks in the washroom, you’ll open the door once more, leave the washroom, and close the door behind you. This sequence of actions will yield the same outcome: the switch will open and close, causing the Op-Amp output to transition from HIGH to LOW.

However, due to the connection of CD4017’s Pin 4 to the Reset pin, all of the outputs will reset to LOW, leading to the deactivation of the relay, subsequently turning off the light.

Operation of the Circuit 

  1. Make the connections and power on the circuit. 
  2. Open the door of the washroom, enter the washroom and close the door behind you. 
  3. This action will turn ON the light of the washroom. 
  4. Once you are done, open the door, leave the washroom and close the door. 
  5. This action will turn OFF the light of the washroom.



Related Articles

Leave a Reply

Your email address will not be published.

Back to top button