Motion Sensor Light Switch using CD4017 & IR sensor

In this 4017 project, I have shown how to make a motion sensor light switch using the CD4017 IC and IR proximity sensor. You can use this motion activated light circuit as an automatic washroom light switch. I have not used any microcontroller or Arduino for this CD4017 project.

automatic washroom light switch
The light turns on when anyone enters the washroom

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

automatic washroom light switch
Light turns off when anyone exits from the washroom

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

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

Circuit of the Motion Sensor Light

Circuit of the Motion Sensor Light

You can easily make this 4017 circuit with some basic components.

CD4017 Pinout
CD4017 Pinout

How the Motion Sensor Circuit works

  1. The IR emitter LED 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 receiver LED.
  2. The LM358 compares the voltage across the IR receiver LED with the predefined value. When any motion is detected the voltage across the IR receiver crosses the predefined value, so the output pin (pin 1) of LM358 becomes high.
  3. The clock pin (Pin-14) of CD4017 IC is connected to the output pin of LM358. 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 the Motion Sensor Switch

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:

1) CD4017 IC
2) LM358 IC
3) BC547 Transistor
4) 100uF 25V Capacitor
5) 1000uF 25V Capacitor
6) 220-ohm 0.25watt Resistors – 4 no
7) 10k 0.25watt Resistor
8) 10k Trimmer
9) LED 5mm – 2no
10) IR LED pair (Detector & Emitter)
11) 1N4007 Diode
12) 5V SPDT Relay
13) Connectors & IC Base

Tutorial Video on Motion sensor Light

In the tutorial video, I have explained all the steps to make the homemade PCB for the motion sensor light circuit. To make the PCB I have used acrylic 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 from

About PCBWay and their services

Steps to order from PCBWay

You can order any custom design PCB from PCBWay at a very affordable price. At PCBWay, all the boards pass through the most stringent tests other than the basic visual check. They use different testing and inspecting equipment, such as Flying Probe Tester, X-Ray Inspection Machine, Automated Optical Inspection (AOI) Machine, etc to make sure the quality of the final product is good.

PCBWay not only produce FR-4 and Aluminum boards, but also advanced PCB like Rogers, HDI, Flexible and Rigid-Flex boards, with very reasonable price.
For the online instant quote page please visit –

PCBWay also offers an Assembly service. The online pricing software can instantly quote for your PCB Assembly service through a rough calculation. Their PCBA prices are very reasonable.
Rough quote online –

You can also explore different PCB projects from their Open-source community

For more details please visit the following articles.
Why PCBway
PCB Capabilities
High-Quality PCB

Steps to order PCB from PCBWay

To order the PCB first visit

Step 2 to order from PCBWay

Then enter the following details:

  1. PCB Size (Length & Width) in mm & PCB quantity
  2. Select masking color for the PCB
  3. Select country and shipping method
  4. Click on the “Save to Cart” button
Step-3 to order from PCBWay

Now click on the “Add Gerber Files” to upload the PCB Gerber file.

Then click on the “Submit Order Now” to place the order.

After that, they will review the Gerber file and accordingly confirm the order.

I have used their services for my different home automation project, I always received the PCB on time and the quality is very good in this price range.

How to make homemade PCB for this 4017 Project

Steps for making the motion sensor light circuit on PCB:

homemade PCB for 4017 Project

Step 1: Print the PCB Layout and stick it on Acrylic sheet

While printing please check the PCB dimension mentioned in the PCB layout. After downloading the PCB layout, you can print the word file (.docx) on the A4 page (Please refer to the tutorial video).

drill the holes

Step 2: Drill the holes for the components on the PCB

Now, drill the holes on the PCB for components as per the PCB layout. Here, I have used a 555 DC motor to drill the holes. You can also use a hand drill for drilling.

placing the components

Step 3: Place & Connect all the components as shown on the PCB layout

After that place all the components on the PCB as marked on the PCB. Here I have used extra leads of the components to connect those components.

After that I have soldered all the components as per the circuit diagram.

Now, our Motion Sensor Light Switch PCB is ready.

Testing the Motion Sensor Switch

Testing the Motion Sensor Switch

Now connect the 5V DC supply and AC bulb as per the circuit.

Please take proper safety precautions while working with 110V \220V AC voltage.

To test the circuit move you hand in front of the IR LEDs the bulb will turn on or off whenever it detects any motion.

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.