roject Report: Motion Sensor
P
Switch
1. Introduction
In modern electrical engineering and home automation, the demand for contactless control
systems has surged due to hygiene concerns, ease of use, and the longevity of mechanical
components. This project details the design and implementation of a sensor-based control
system capable of operating a220V AC, 7-Watt bulbusing a9V DC control circuit.
he primary objective is to achieve galvanic isolation between the high-voltage AC load and
T
the low-voltage user interface. By utilizing an Infrared (IR) sensor pair for detection and digital
logic (CD4017) for state retention, this device functions as a bi-stable toggle switch. This
system eliminates the physical wear and tear associated with traditional mechanical switches
and eliminates the risk of electric shock at the user interface.
2. Theory and Components
his circuit relies on optoelectronics for sensing, digital logic for state management, and
T
electromechanics for switching. Below is a detailed analysis of the components used:
A. IR Sensor Module (IR LED and Photodiode)
The sensing unit consists of an IR Transmitter (LED) and an IR Receiver (Photodiode):-
1.IR LED (Emitter) Function
he IR LED operates on the same principle as a standard Light-Emitting Diode, but it is
T
engineered to produce light in theinfrared spectrum, which is invisible to the human eye.
● E mission:When forward-biased, the IR LED emits photons with wavelengths typically
ranging from 700nm to 1mm, commonly in thenear-infrared(NIR)range (e.g., around
850nm or 940nm).
● Invisible Light:The light is non-visible, makingit ideal for discreet sensing and
communication applications (like TV remotes).
● Material:IR LEDs are often constructed from semiconductor materials likeGallium
Arsenide (GaAs)orAluminum Gallium Arsenide (AlGaAs).
2. The IR Sensing Pair: Emitter and Detector
or proximity or object detection, the IR LED is always paired with an IR detector, most
F
commonly aPhotodiodeor aPhototransistor.
A. The IR Photodiode (Receiver)
The photodiode is the actual sensing component.
● M echanism:It is a p-n junction diode typically operatedinreverse bias. When IR light
(photons) of the matching wavelength strikes the junction, it generates electron-hole
pairs.
● Output:This charge generation causes a decrease in the diode's resistance and a
proportionalincrease in reverse current(photocurrent).This change in
current/voltage is the signal used by the control circuit (like the LM358 comparator in
your project).
B. LM358 Operational Amplifier (Comparator Mode)
The LM358 is a dual op-amp used here as a voltage comparator.
● F unction:It compares the voltage from the photodiode(Input) against a reference
voltage set by the potentiometer.
● Logic Output:When the reflected IR signal causes the input voltage to exceed the
reference voltage, the LM358 output shifts fromLOW (0V)toHIGH. This acts as the
"clock pulse" for the digital logic stage.
C. 10k Potentiometer
his variable resistor forms a voltage divider network connected to the non-inverting input of
T
the LM358. It allows the user to calibrate thesensitivityof the sensor, determining how close
an object must be to trigger the switch.
D. CD4017 Decade Counter IC
The CD4017 is a CMOS counter/divider utilized here to create a "toggle" or latching function.
C
● lock Input (Pin 14):Receives the pulse from the LM358.
● Outputs (Q0-Q9):The IC shifts its high output sequentiallywith every clock pulse.
● Configuration:CLK (Pin 14):This is where the trigger pulse from yourLM358
comparatorwill be connected.
● RST (Pin 15):In your toggle application, this pinis connected toQ2 (Pin 4). This
configuration forces the counter to reset after the second step, creating the "Q0 →Q1
→Reset"
● sequence needed for the ON/OFF toggle.
● Q1 (Pin 2):This is the output used to drive theBC547 transistor, controlling the relay.
E. BC547 Transistor (NPN)
he logic output from the CD4017 (Pin 2) acts as a signal source but lacks the current drive
T
capability required to energize the relay coil.
● S
witching:The BC547 is used in a common-emitter configuration. When the base
receives a HIGH signal from the CD4017, the transistor saturates, allowing current to flow
from the collector to the emitter, effectively grounding the relay coil and energizing it.
F. 5V SPDT Relay
The Single Pole Double Throw (SPDT) relay is the bridge between the DC and AC domains.
● E lectromagnetism:When the coil is energized by theBC547, the internal armature is
magnetically attracted, moving the common contact (COM) from the Normally Closed
(NC) position to the Normally Open (NO) position.
● Isolation:This physically closes the 220V AC circuit, turning on the bulb, while keeping
the 9V DC circuit electrically isolated.
G. 1N4007 diode
F
● unction:Permits current flow in one direction and blocks reverse current.
● Robustness:The most robust in the 1N400x series.
● Key Specification:Notable for its high 1000V PeakRepetitive Reverse Voltage,
allowing it to safely handle greater voltage spikes than others like the 1N4001.
● Polarity Indication:A silver band indicates the cathodeand the direction of forward
current.
[Link] Components
● C apacitor:Placed near the clock input of the CD4017,this acts as a debouncing element
to filter out noise, ensuring a single wave of the hand results in a single clock pulse.
● Indicator LEDs:Provide visual feedback regardingthe status of the sensor (signal
detected) and the load (relay active).
3. Circuit Design and Operation
he circuit operation can be divided into three distinct stages:Sensing, Processing, and
T
Actuation.
1. T he Sensing Stage:
The system is powered by a 9V DC source. The IR transmitter emits light. In the standby
state (no object present), the photodiode receives no light, and the LM358 output
remains LOW.
2. The Processing Stage (The Toggle Logic):
○ When a hand obstructs the sensor, the LM358 output goes HIGH.
○ This HIGH signal serves as aPositive Edge Clock Triggerfor the CD4017 at Pin 14.
○ First Trigger:The CD4017 shifts its high state fromQ0 to Q1 (Pin 2). Q1 goes HIGH.
○ Second Trigger:If the user waves their hand again, the counter shifts to Q2. Since
Q2 is connected to RESET, the IC immediately resets to Q0, making Q1 LOW.
3. The Actuation Stage:
○ When Q1 is HIGH, it biases the base of the BC547 transistor.
○ The transistor turns ON, completing the circuit for the Relay Coil.
○ The Relay clicks, connecting the 220V AC Mains Live wire to the 7-Watt Bulb.
○ When Q1 goes LOW (after the second wave), the transistor cuts off, the relay
de-energizes, and the spring mechanism opens the AC contact, turning the bulb
OFF.
4. Power Considerations and Safety
This project involves two distinct voltage domains, requiring careful design considerations:
● D C Control Circuit (9V):
The logic components (LM358 and CD4017) can operate safely at 9V. However, special
attention must be paid to the 5V Relay. Since the input is 9V, a current-limiting resistor
should be placed in series with the relay coil, or a voltage regulator (like an L7805, if
available) should be used to prevent the relay coil from overheating. The BC547 must be
rated to handle the collector current required by the relay.
● AC Load Circuit (220V):
The 7-Watt bulb draws approximately 30mA (I = P/V). While the current is low, the voltage
is lethal. The relay provides Galvanic Isolation, meaning there is no direct electrical path
between the high-voltage mains and the low-voltage control logic.
○ Safety Note:The AC tracks on the breadboard mustbe kept physically separate
from the DC tracks to prevent arcing.
5. Conclusion
he designed system successfully demonstrates the integration of analog sensing, digital
T
logic, and power electronics to control a high-voltage load. By utilizing the CD4017 IC, the
system achieves a user-friendly toggle functionality using a simple IR proximity sensor.
his project highlights the practical application of transistor-based switching and relay
T
isolation. It serves as a foundational model for advanced home automation systems, offering a
hygienic, touch-free alternative to traditional wall switches, with potential applications in
sterile medical environments, smart washrooms, and accessible technology for individuals
with limited mobility.