Motion Sensor Light using IR Proximity Sensor & CD4017

In this CD4017 project, I have shown how to make a motion sensor light using the E18-D80NK IR proximity sensor and CD4017 IC.

motion-activated light switch

You can use this motion-activated light circuit as an automatic washroom light switch. I have not used any microcontroller or Arduino for this 4017 IC project.

When anyone enters the washroom the IR proximity sensor senses the motion and turns on the washroom light.

After that, when he or she exits the washroom, the IR sensor again senses the motion and turns off the light automatically.

Here, each time the IR proximity sensor detects any motion, it sends the clock pulse to CD4017 IC. Then the 4017 IC changes the previous state of PIN 2.

Control toilet light with manual switch

You can also control the light with manual switch.

Circuit of the Motion Sensor Light Switch

Circuit of the Motion Sensor Switch

How the Motion Sensor Circuit works

  1. The IR proximity sensor continuously emits infrared. When any object comes within the range, some amount of infrared reflects from the object’s surface and that reflected infrared can be detected by the IR proximity sensor.
  2. When any motion detects, the output pin (connected with the base of BC557 PNP transistor) of the IR proximity sensor becomes LOW. So the BC557 PNP transistor turns ON.
  3. The clock pin (Pin-14) of CD4017 IC is connected with the Emitter of the BC557 transistor. So when any motion is detected, the 4017 IC receives a clock pulse and changes the current state of Pin-2.
  4. The Pin-2 of CD4017 is connected with the base of the BC547 NPN transistor, So when the Pin-2 becomes high the transistor turns on.
  5. When the transistor turns on, the current can flow through the relay coil. So the load connected with the relay also turns on.
  6. When the IR LEDs detect any motion the second time, it sends the next clock pulse to CD4017 IC. Then the Pin-2 becomes low.
  7. If the Pin-2 becomes low, the transistor turns off, and accordingly, the load connected with the relay also turns off.

PCB Layout of the Motion Sensor Switch

PCB Layout of Motion Sensor light

Please download the PCB layout, then print it on the A4 page.

Please check the PCB size while printing, it should be the same as mentioned in Layout.

Required Components for this 4017 Project:

Required Components for this 4017 Project.

1) CD4017 IC
2) BC557 PNP Transistor
3) BC547 NPN Transistor
4) 100uF 25V Capacitor
5) 1000uF 25V Capacitor
6) 220-ohm 0.25watt Resistors – 3 no
7) 1k 0.25watt Resistor
8) 10k 0.25watt Resistor
9) LEDs 5mm – 2no
10) E18-D80NK IR proximity sensor
11) 1N4007 Diode
12) 5V SPDT Relay
13) HLK-PM01 5V AC to DC converter
14) Connectors & IC Base

Tutorial Video on Motion Sensor Light Switch

In this tutorial video, I have explained all the steps to make the homemade PCB for the LED chaser light circuit. To make the PCB I have used an acrylic sheet.

How to make DIY PCB using plastic sheet

PCB for Motion Sensor light 4017 circuit

But you can also download the PCB Gerber file for this project, and order the custom design PCB for this CD4017 IC project.

PCB for this Motion Sensor Light Switch

PCB for this Motion Sensor Light Switch

You can also order the custom design PCB for this electronics project from PCBWay.

This image has an empty alt attribute; its file name is PCBWay-750x161-Banner.jpg

About PCBWay and their services

  1. PCB Prototyping and Manufacturing
    PCBWay not only produces FR-4 and Aluminum boards, but also advanced PCB like Rogers, HDI, Flexible, and Rigid-Flex boards, at a very reasonable price.
    For the online instant quote page please visit –
    Inspect your Gerber file before placing the order – OnlineGerberViewer
  2. PCB assembly
    The SMT & THT assembly starts from only $30 with the free stencil and free worldwide shipping.
    The components can be sourced and provided by us, or by the clients themselves
    Rough quote online –

Testing the IR Proximity Motion Sensor Switch

Testing the IR Proximity Motion Sensor Switch

While testing the circuit, whenever the IR Proximity sensor detects any object nearby, the RED LED turns ON, and toggles the current state of the relay. The Green LED is the indicator for the relay.

Connect the Motion Switch with Toilet Light

Connect the Motion Switch with Toilet Light

Please refer to the above circuit diagram to connect the motion switch circuit with the AC supply, switch, and AC lamp.

Please take proper safety precautions while working with high voltage.

Automatic washroom light

Please share your feedback on this mini-project and also let me know if you have any queries.

You can also subscribe to our newsletter to receive more such useful electronics projects through email.

I hope you have liked this electronics project, Thank you for your time.