Practical case: Visual Charge and Discharge with LED

Visual Charge and Discharge with LED prototype (Maker Style)

Level: Basic – Observe energy storage in an electrolytic capacitor via LED fading.

Objective and use case

You will build a simple circuit where a capacitor acts as a temporary energy reservoir, keeping an LED illuminated briefly after the power source is disconnected.

  • Why it is useful:

    • Demonstrates how capacitors store and release electrical energy.
    • Simulates the «smoothing» effect used in power supply adapters to maintain steady voltage.
    • Visualizes the RC time constant (the relationship between resistance, capacitance, and time).
    • Introduces the concept of «hold-up time» in power failures.
  • Expected outcome:

    • Switch ON: The LED lights up immediately.
    • Switch OFF: The LED does not turn off instantly; instead, it slowly fades out over several seconds.
    • Visual: A smooth transition from bright light to darkness.
    • Audience: Students and hobbyists interested in basic component behavior.

Materials

  • V1: 9 V DC battery or power supply, function: main energy source.
  • S1: SPST toggle switch or push-button, function: controls the connection to the power source.
  • C1: 2200 µF electrolytic capacitor (16 V or higher), function: energy storage reservoir.
  • R1: 470 Ω resistor, function: LED current limiting and discharge timing control.
  • D1: Red LED, function: visual indicator of current flow and stored charge.

Wiring guide

Use the following explicit node connections to build the circuit. The standard ground reference is node 0.

  • Power and Switch:

    • Connect the Positive terminal of V1 to node VCC.
    • Connect the Negative terminal of V1 to node 0 (GND).
    • Connect one side of switch S1 to node VCC.
    • Connect the other side of switch S1 to node V_CAP.
  • Capacitor (The Tank):

    • Connect the Positive (long leg) of C1 to node V_CAP.
    • Connect the Negative (short leg/stripe) of C1 to node 0.
  • LED and Resistor (The Load):

    • Connect resistor R1 between node V_CAP and node V_LED.
    • Connect the Anode (long leg) of D1 to node V_LED.
    • Connect the Cathode (short leg/flat spot) of D1 to node 0.

Conceptual block diagram

Conceptual block diagram — RC Charge/Discharge Circuit
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

Title: Practical case: Visual Charge and Discharge with LED

      [ INPUT / CONTROL ]               [ STORAGE / BUFFER ]               [ OUTPUT / LOAD ]

                                            (Node V_CAP)
    [ 9 V Battery ] --(+)--> [ Switch S1 ] -------+-------> [ Resistor R1 ] --> [ LED D1 ] --> GND
                                                 |
                                                 |
                                                 v
                                          [ Capacitor C1 ]
                                          (   2200 uF    )
                                                 |
                                                GND
Schematic (ASCII)

Electrical diagram

Electrical diagram for case: Visual Charge and Discharge with LED
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

Measurements and tests

  1. Initial State: Ensure S1 is Open (Off). The LED should be dark.
  2. Charge Phase: Close S1. Observe that the LED lights up instantly. The capacitor C1 charges to approximately 9 V almost immediately.
  3. Discharge Phase: Open S1.
    • Observe that the LED remains lit but begins to dim.
    • Use a stopwatch to measure the time from opening the switch until the LED is completely dark.
  4. Repeat: Swap C1 for a smaller value (e.g., 100 µF) and observe how the fade time becomes much shorter (almost instant).

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Visual Charge and Discharge with LED

* --- Power Supply (V1) ---
* 9V DC Battery connected to VCC and GND (0)
V1 VCC 0 DC 9

* --- Switch (S1) ---
* Modeled as a Voltage-Controlled Switch to simulate a physical push-button.
* Connections: VCC to V_CAP
* The switch is controlled by the voltage at node 'CTRL'.
S1 VCC V_CAP CTRL 0 SW_PUSH

* Switch Control Source (Simulates User Interaction)
* Simulates pressing the button at T=0.1s, holding for 1s, then releasing.
* PULSE(V1 V2 TD TR TF PW PER)
V_USER_S1 CTRL 0 PULSE(0 5 0.1 1m 1m 1 5)

* Switch Model Definition
* Ron=1 ohm represents wiring/contact resistance.
.model SW_PUSH SW(Vt=2.5 Ron=1 Roff=100Meg)
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Visual Charge and Discharge with LED

* --- Power Supply (V1) ---
* 9V DC Battery connected to VCC and GND (0)
V1 VCC 0 DC 9

* --- Switch (S1) ---
* Modeled as a Voltage-Controlled Switch to simulate a physical push-button.
* Connections: VCC to V_CAP
* The switch is controlled by the voltage at node 'CTRL'.
S1 VCC V_CAP CTRL 0 SW_PUSH

* Switch Control Source (Simulates User Interaction)
* Simulates pressing the button at T=0.1s, holding for 1s, then releasing.
* PULSE(V1 V2 TD TR TF PW PER)
V_USER_S1 CTRL 0 PULSE(0 5 0.1 1m 1m 1 5)

* Switch Model Definition
* Ron=1 ohm represents wiring/contact resistance.
.model SW_PUSH SW(Vt=2.5 Ron=1 Roff=100Meg)

* --- Capacitor (C1) ---
* 2200uF Energy Storage
* Connections: V_CAP to GND (0)
C1 V_CAP 0 2200u

* --- Resistor (R1) ---
* 470 Ohm Current Limiting Resistor
* Connections: V_CAP to V_LED
R1 V_CAP V_LED 470

* --- LED (D1) ---
* Red LED Indicator
* Connections: Anode (V_LED) to Cathode (0)
D1 V_LED 0 D_LED_RED

* LED Model Definition
* Generic Red LED parameters
.model D_LED_RED D(IS=1e-14 N=2 RS=10 BV=5 IBV=10u)

* --- Analysis Commands ---
* The discharge time constant (Tau) = R * C = 470 * 2200e-6 approx 1.03 seconds.
* Simulation runs for 3 seconds to visualize the charge and discharge cycle.
.tran 10m 3s

* --- Output Directives ---
* Prints the capacitor voltage, LED anode voltage, and switch control signal.
.print tran V(V_CAP) V(V_LED) V(CTRL)

.op
.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (352 rows)
Index   time            v(v_cap)        v(v_led)        v(ctrl)
0	0.000000e+00	8.234122e-01	8.233738e-01	0.000000e+00
1	1.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
2	2.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
3	4.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
4	8.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
5	1.600000e-03	8.234122e-01	8.233738e-01	0.000000e+00
6	3.200000e-03	8.234122e-01	8.233738e-01	0.000000e+00
7	6.400000e-03	8.234122e-01	8.233738e-01	0.000000e+00
8	1.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
9	2.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
10	3.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
11	4.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
12	5.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
13	6.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
14	7.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
15	8.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
16	9.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
17	1.000000e-01	8.234122e-01	8.233738e-01	0.000000e+00
18	1.001000e-01	8.234122e-01	8.233738e-01	5.000000e-01
19	1.002600e-01	8.234122e-01	8.233738e-01	1.300000e+00
20	1.003075e-01	8.234122e-01	8.233738e-01	1.537500e+00
21	1.003906e-01	8.234122e-01	8.233738e-01	1.953125e+00
22	1.004136e-01	8.234122e-01	8.233738e-01	2.068164e+00
23	1.004539e-01	8.234122e-01	8.233738e-01	2.269482e+00
... (328 more rows) ...

Common mistakes and how to avoid them

  1. Reversed Capacitor Polarity: Electrolytic capacitors are polarized. Connecting the negative leg to positive voltage can cause the component to overheat or pop. Solution: Always check the stripe on the side of the capacitor; it marks the negative pin.
  2. Omitting the Resistor: Connecting the LED directly to the 9 V source (or charged capacitor) without R1 will burn out the LED instantly. Solution: Ensure R1 is in series with D1.
  3. Using a very small Capacitor: If C1 is too small (e.g., 100 nF), the discharge will happen so fast the human eye cannot see the fade. Solution: Use values ≥ 1000 µF for visual tests.

Troubleshooting

  • LED never lights up:
    • Check if D1 is inserted backward (Anode/Cathode swapped).
    • Verify S1 is actually closing the circuit.
    • Check battery voltage.
  • LED turns off instantly (no fade):
    • C1 might be disconnected or open-circuit.
    • C1 value is too low.
    • R1 value is too high, making the LED too dim to see the tail end of the fade.
  • Capacitor gets hot:
    • Immediately disconnect power! The polarity of C1 is likely reversed.

Possible improvements and extensions

  1. Variable Timing: Replace R1 with a 1 kΩ potentiometer in series with a 100 Ω fixed resistor. Adjusting the pot will change the discharge time and LED brightness.
  2. Dual Switch Logic: Use a SPDT (Single Pole Double Throw) switch. Connect Node VCC to Position 1, Node 0 to Position 2, and the Common pin to the Capacitor/Resistor network. This allows you to actively «dump» the energy to ground or let it fade naturally.

More Practical Cases on Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.

Quick Quiz

Question 1: What is the primary function of the capacitor in this circuit?




Question 2: What visual effect is expected when the switch is turned OFF?




Question 3: Which component is responsible for limiting the current to the LED?




Question 4: What is the recommended value for the capacitor C1 in this experiment?




Question 5: Why is this circuit useful for understanding power supplies?




Question 6: What happens to the LED immediately after the switch is turned ON?




Question 7: What concept describes the relationship between resistance, capacitance, and time?




Question 8: What is the function of the component labeled V1?




Question 9: What real-world concept related to power failures does this circuit introduce?




Question 10: Who is the intended audience for this specific circuit experiment?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:


Practical case: Basic Infrared Light Barrier

Basic Infrared Light Barrier prototype (Maker Style)

Level: Basic. Build a simple alarm system that detects the interruption of a light beam.

Objective and use case

In this project, you will build an optical detector system consisting of a transmitter (IR LED) and a receiver (Photodiode) that controls a transistor switch. When the invisible infrared beam is interrupted by an object, an alarm LED will light up.

  • Security systems: Used in door or window frames to detect unauthorized entry.
  • Automation: detecting objects on a conveyor belt for counting or sorting.
  • Safety: Emergency stop mechanisms when a hand crosses a dangerous boundary.
  • Touchless switching: Activating devices without physical contact.

Expected outcome:
* Beam Intact (Clear path): The Red Alarm LED is OFF.
* Beam Interrupted (Object present): The Red Alarm LED turns ON.
* Signal: The voltage at the sensing node will transition from Logic Low (approx. 0.1 V – 0.5 V) to Logic High (> 0.7 V) when the beam is broken.
* Target audience: Beginners familiar with breadboarding and basic discrete components.

Materials

  • V1: 5 V DC supply
  • D1: IR LED (Infrared Emitter), function: Beam transmitter (Tx)
  • R1: 220 Ω resistor, function: Current limiting for D1
  • D2: Photodiode, function: Beam receiver (Rx)
  • R2: 100 kΩ resistor, function: Pull-up resistor for the sensing node
  • Q1: 2N2222 (or 2N3904) NPN Transistor, function: Electronic switch
  • R3: 1 kΩ resistor, function: Base current limiter for Q1
  • D3: Red LED, function: Alarm indicator
  • R4: 330 Ω resistor, function: Current limiting for D3

Wiring guide

This circuit is divided into two parts: the Transmitter (Tx) and the Receiver (Rx). Construct them facing each other.

Transmitter (Tx):
* VCC connects to R1.
* R1 connects to the Anode of D1 (Node: TX_ANODE).
* D1 (Cathode) connects to 0 (GND).

Receiver (Rx) – Dark Detector Configuration:
* VCC connects to R2.
* R2 connects to the Cathode of D2 (Node: V_SENSE). Note: Photodiodes are used in reverse bias.
* D2 (Anode) connects to 0 (GND).
* VCC connects to R4.
* R4 connects to the Anode of D3.
* D3 (Cathode) connects to the Collector of Q1 (Node: V_ALARM).
* Q1 (Emitter) connects to 0 (GND).
* Node V_SENSE connects to R3.
* R3 connects to the Base of Q1.

Conceptual block diagram

Conceptual block diagram — Light Barrier Detection
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

+------------------------------------------------------------------------------+
|                   PRACTICAL CASE: BASIC INFRARED LIGHT BARRIER               |
+------------------------------------------------------------------------------+

      [ INPUTS / SENSORS ]              [ LOGIC / CONTROL ]               [ OUTPUT / LOAD ]

      (Transmitter)
      [ VCC ]
         |
         v
      [ R1: 220 ]
         |
         v
      [ D1: IR LED ] ~~~~~(IR Beam)~~~~~> [ D2: Photodiode ]
         |                                (Rx Sensor)
         v                                      |
      [ GND ]                                   |
                                                |
      (Receiver Bias)                           |
      [ VCC ]                                   |
         |                                      |
         v                                      |
      [ R2: 100k ]                              |
         |                                      |
         +-----------(Node: V_SENSE)------------+
         |
         |
         v
      [ R3: 1k ]
         |
         v
      [ Q1: NPN Base ] ----------------> [ Q1: Collector ] <--(Switched Path)-- [ D3: Red LED ]
      (Transistor Switch)                (Sinks Current)                              ^
                                                |                                     |
                                                v                                [ R4: 330 ]
                                         [ Q1: Emitter ]                              ^
                                                |                                     |
                                                v                                  [ VCC ]
                                             [ GND ]

+------------------------------------------------------------------------------+
| SIGNAL FLOW ANALYSIS:                                                        |
| 1. Tx generates IR Beam.                                                     |
| 2. If Beam hits D2 (Clear) -> D2 conducts -> V_SENSE is LOW -> Q1 OFF.       |
| 3. If Beam blocked (Dark)  -> D2 blocks   -> V_SENSE is HIGH -> Q1 ON.       |
| 4. Q1 ON connects D3 to GND -> ALARM ACTIVATED.                              |
+------------------------------------------------------------------------------+
Schematic (ASCII)

Electrical diagram

Electrical diagram for case: Basic Infrared Light Barrier
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

System Logic Table

Physical State IR Beam Status Photodiode (D2) Mode V_SENSE Voltage Transistor (Q1) Alarm LED (D3)
Normal Reaching Rx Conducting (Low Resistance) Low (< 0.6 V) OFF (Cut-off) OFF
Intrusion Blocked/Broken Blocking (High Impedance) High (~VCC) ON (Saturation) ON

Measurements and tests

  1. Tx Verification: Connect power. Use a smartphone camera to look at the IR LED (D1). You should see a faint purple/pink glow on the screen (human eyes cannot see IR).
  2. Rx Voltage Test (Beam Intact): Align D1 and D2 perfectly. Measure voltage at V_SENSE relative to GND. It should be low (typically < 0.6 V) because the light causes the photodiode to conduct current to the ground.
  3. Rx Voltage Test (Beam Broken): Place a card or your hand between D1 and D2. Measure voltage at V_SENSE. It should rise significantly (close to 4 V–5 V) as the photodiode stops conducting and R2 pulls the node high.
  4. Functional Test: Ensure the Red LED (D3) turns ON immediately when the beam is blocked and turns OFF when the path is clear.

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Basic Infrared Light Barrier

* --- Component Models ---
* Standard NPN Transistor
.model 2N2222 NPN (IS=1E-14 BF=200 VAF=100)
* Infrared LED (Tx) - Approx Vf=1.2V
.model IR_LED D (IS=1p N=1.5 RS=5)
* Red LED (Alarm) - Approx Vf=1.8-2.0V
.model RED_LED D (IS=1u N=2 RS=10)
* Photodiode (Rx) - Modeled as diode with low capacitance
.model PD_DIODE D (IS=10p N=1 RS=10 CJO=10p)

* --- Power Supply ---
V1 VCC 0 DC 5

* --- Transmitter (Tx) Circuit ---
* Connectivity: VCC -> R1 -> D1(Anode). D1(Cathode) -> GND.
R1 VCC TX_ANODE 220
D1 TX_ANODE 0 IR_LED

* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Basic Infrared Light Barrier

* --- Component Models ---
* Standard NPN Transistor
.model 2N2222 NPN (IS=1E-14 BF=200 VAF=100)
* Infrared LED (Tx) - Approx Vf=1.2V
.model IR_LED D (IS=1p N=1.5 RS=5)
* Red LED (Alarm) - Approx Vf=1.8-2.0V
.model RED_LED D (IS=1u N=2 RS=10)
* Photodiode (Rx) - Modeled as diode with low capacitance
.model PD_DIODE D (IS=10p N=1 RS=10 CJO=10p)

* --- Power Supply ---
V1 VCC 0 DC 5

* --- Transmitter (Tx) Circuit ---
* Connectivity: VCC -> R1 -> D1(Anode). D1(Cathode) -> GND.
R1 VCC TX_ANODE 220
D1 TX_ANODE 0 IR_LED

* --- Receiver (Rx) Circuit ---
* Sensor Stage: VCC -> R2 -> D2(Cathode). D2(Anode) -> GND.
* Node V_SENSE is the junction of R2 and D2.
R2 VCC V_SENSE 100k
D2 0 V_SENSE PD_DIODE

* PHYSICAL STIMULUS: IR Beam Simulation
* In a real circuit, D1 emits light which D2 receives.
* We model this optical coupling with a Current Source (Photocurrent) in parallel with D2.
* Direction: Photocurrent flows Cathode to Anode (V_SENSE to GND).
* Logic:
*   - 50uA = Light Detected (Beam Intact) -> V_SENSE pulled Low -> Alarm OFF.
*   - 0A   = Dark (Beam Broken) -> V_SENSE pulled High by R2 -> Alarm ON.
* Timing: Start with Light (50uA), break beam at 1ms (0A), restore at 3ms.
I_Beam V_SENSE 0 PULSE(50u 0 1m 10u 10u 2m 5m)

* Switch Stage: V_SENSE -> R3 -> Q1(Base)
R3 V_SENSE Q1_BASE 1k
* Q1: Collector=V_ALARM, Base=Q1_BASE, Emitter=GND
Q1 V_ALARM Q1_BASE 0 2N2222

* Alarm Indicator Stage: VCC -> R4 -> D3(Anode). D3(Cathode) -> Q1(Collector).
R4 VCC LED_ANODE 330
D3 LED_ANODE V_ALARM RED_LED

* --- Analysis Directives ---
* Transient analysis for 5ms to capture the beam break event
.tran 10u 5m

* Print required voltages for verification
.print tran V(V_SENSE) V(Q1_BASE) V(V_ALARM) V(TX_ANODE)

.op
.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (1072 rows)
Index   time            v(v_sense)      v(q1_base)      v(v_alarm)
0	0.000000e+00	5.009804e-07	5.059904e-07	4.999999e+00
1	1.000000e-07	5.009804e-07	5.059904e-07	4.999999e+00
2	2.000000e-07	5.009804e-07	5.059904e-07	4.999999e+00
3	4.000000e-07	5.009804e-07	5.059904e-07	4.999999e+00
4	8.000000e-07	5.009804e-07	5.059904e-07	4.999999e+00
5	1.600000e-06	5.009804e-07	5.059904e-07	4.999999e+00
6	3.200000e-06	5.009804e-07	5.059904e-07	4.999999e+00
7	6.400000e-06	5.009804e-07	5.059904e-07	4.999999e+00
8	1.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
9	2.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
10	3.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
11	4.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
12	5.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
13	6.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
14	7.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
15	8.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
16	9.280000e-05	5.009804e-07	5.059904e-07	4.999999e+00
17	1.028000e-04	5.009804e-07	5.059904e-07	4.999999e+00
18	1.128000e-04	5.009804e-07	5.059904e-07	4.999999e+00
19	1.228000e-04	5.009804e-07	5.059904e-07	4.999999e+00
20	1.328000e-04	5.009804e-07	5.059904e-07	4.999999e+00
21	1.428000e-04	5.009804e-07	5.059904e-07	4.999999e+00
22	1.528000e-04	5.009804e-07	5.059904e-07	4.999999e+00
23	1.628000e-04	5.009804e-07	5.059904e-07	4.999999e+00
... (1048 more rows) ...

Common mistakes and how to avoid them

  1. Reversed Photodiode: Unlike regular LEDs, photodiodes must be connected in reverse bias (Cathode to positive side, Anode to negative side) to detect light. If connected forward, it acts like a normal diode and clamps the voltage, disabling the sensor.
  2. Misalignment: IR light is highly directional. If the Tx LED and Rx Photodiode are not pointing directly at each other, the alarm will stay ON permanently.
  3. Ambient Light Interference: Strong sunlight or overhead lamps can flood the photodiode, keeping the voltage low even when you block the IR beam. Use a small tube or black tape around the photodiode to shield it from side light.

Troubleshooting

  • Alarm never turns ON:
    • Cause: Transistor base not receiving enough voltage.
    • Fix: Check if the object is truly blocking the light. Increase R2 (e.g., to 220 kΩ) to make the pull-up stronger against leakage.
  • Alarm never turns OFF:
    • Cause: Photodiode not receiving enough IR light to pull the base voltage down.
    • Fix: Re-align the LEDs. Decrease R1 to make the IR LED brighter (do not go below 100 Ω). Ensure the photodiode is inserted with the correct polarity.
  • System flickers:
    • Cause: Edge detection or unstable light source.
    • Fix: Ensure the power supply is stable. Add a small capacitor (e.g., 100 nF) between V_SENSE and GND to filter noise (note: this slows response slightly).

Possible improvements and extensions

  1. Schmitt Trigger: Replace the simple transistor driver with a Schmitt Trigger (or 555 timer) to prevent the LED from fading in/out effectively creating a «snap» action switch.
  2. Modulation: Use a 38 kHz receiver module (like a TSOP sensor) and pulse the IR LED at 38 kHz. This makes the system completely immune to sunlight and room lighting.

More Practical Cases on Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.

Quick Quiz

Question 1: What is the primary function of the IR LED (D1) in this project?




Question 2: Which component acts as the 'Beam receiver' in this circuit?




Question 3: What happens to the Red Alarm LED when the infrared beam is interrupted by an object?




Question 4: What is the expected voltage state at the sensing node when the beam is broken?




Question 5: Based on the context, what is the role of resistor R2 (100 kΩ)?




Question 6: What is the function of the NPN Transistor (Q1) in this circuit?




Question 7: Which of the following is a listed use case for this alarm system?




Question 8: What is the state of the Red Alarm LED when the beam path is clear (intact)?




Question 9: What is the purpose of resistor R1 (220 Ω) connected to D1?




Question 10: What is the target audience for this project?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:


Practical case: Photodiode vs photoresistor comparison

Photodiode vs photoresistor comparison prototype (Maker Style)

Level: Basic – Analyze speed and linearity differences between an LDR and a photodiode.

Objective and use case

You will build a dual comparison circuit featuring a Light Dependent Resistor (LDR) and a Photodiode side-by-side, both stimulated by a pulsed LED light source. This setup demonstrates why specific sensors are chosen for different applications based on response time and linearity.

  • High-speed data transmission: Photodiodes are essential for fiber optics and remote controls where signals switch rapidly.
  • Ambient light sensing: LDRs are cost-effective for streetlights (dusk-to-dawn) where reaction speed does not matter.
  • Precision metering: Photodiodes provide a linear current output proportional to light intensity, ideal for lux meters.

Expected outcome:
* LDR Output: A slow, curved voltage response («shark fin» shape) when exposed to a fast-blinking light.
* Photodiode Output: A sharp, square voltage response tracking the light source accurately.
* Voltage Levels: Distinct voltage changes at nodes V_LDR and V_PD corresponding to light intensity.
* Target Audience: Students and hobbyists interested in analog sensors and optoelectronics.

Materials

  • V1: 5 V DC supply, function: Main circuit power.
  • V2: 0 V to 5 V Pulse Generator (100 Hz), function: Driver for the test LED (Stimulus).
  • R1: 330 Ω resistor, function: Current limiting for the stimulus LED.
  • D_STIM: Green LED, function: Light source to trigger sensors (Chosen for distinct forward voltage).
  • R_LDR: Light Dependent Resistor (LDR), function: Slow photo-resistive sensor.
  • R2: 10 kΩ resistor, function: Voltage divider bottom leg for LDR.
  • D_PD: Silicon Photodiode (e.g., BPW34), function: Fast photo-current sensor.
  • R3: 220 kΩ resistor, function: Load resistor to convert photo-current to voltage.

Wiring guide

The circuit consists of three distinct sections: the Stimulus (pulsing light), the LDR divider, and the Photodiode divider.

Stimulus Section:
* V2 (Pulse Source) connects between V_PULSE and 0 (GND).
* R1 connects between V_PULSE and NODE_LED.
* D_STIM (Anode) connects to NODE_LED.
* D_STIM (Cathode) connects to 0 (GND).
* Note: Place D_STIM physically close to both R_LDR and D_PD to ensure they receive the light.

LDR Sensor Section:
* V1 (DC Source) connects between VCC and 0 (GND).
* R_LDR connects between VCC and V_LDR.
* R2 connects between V_LDR and 0 (GND).

Photodiode Sensor Section:
* D_PD (Cathode) connects to VCC. (Note: Photodiodes operate in reverse bias for photoconductive mode).
* D_PD (Anode) connects to V_PD.
* R3 connects between V_PD and 0 (GND).

Conceptual block diagram

Conceptual block diagram — Light Sensor Comparison
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

Title: Practical case: Photodiode vs photoresistor comparison

      [ INPUT SOURCES ]               [ SENSOR / OPTICAL BLOCK ]             [ OUTPUTS ]

                                   +--> [ R_LDR: Photoresistor ] --+------> < V_LDR >
                                   |    (Light Dependent Res.)     |
                                   |             ^                 v
                                   |             ~            [ R2: 10k ]
                                   |             ~ Light           |
    ( V1: 5 V DC Supply ) ----------+             ~                GND
                                   |             ~
                                   |             ~
                                   +--> [ D_PD: Photodiode ] ------+------> < V_PD >
                                        (Reverse Biased)           |
                                                 ^                 v
                                                 ~            [ R3: 220k ]
                                                 ~ Light           |
                                                 ~                GND
                                                 ~
                                                 ~
    ( V2: Pulse Gen ) --> [ R1: 330 ] --> [ D_STIM: Green LED ] ----------> GND
Schematic (ASCII)

Electrical diagram

Electrical diagram for case: Practical case: Photodiode vs photoresistor comparison
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

Measurements and tests

To validate the differences between the sensors, follow these steps:

  1. Static Testing (DC):

    • Turn off V2 (Pulse). Keep V1 (5 V) on.
    • Cover both sensors (Dark condition). Measure voltage at V_LDR and V_PD. Both should be close to 0 V.
    • Shine a constant light (using the Green LED or a flashlight). Measure voltage at V_LDR and V_PD. Both voltages should rise significantly.
  2. Dynamic Testing (AC/Response Time):

    • Enable V2 (Pulse Generator) at 100 Hz (50% duty cycle).
    • Connect Oscilloscope Channel 1 to V_PULSE (Reference).
    • Connect Oscilloscope Channel 2 to V_LDR.
    • Connect Oscilloscope Channel 3 to V_PD.
    • Observation: Compare the waveforms. Channel 3 (Photodiode) should look like a square wave, matching Channel 1. Channel 2 (LDR) will look distorted, with slow rising and falling edges («shark fin»), failing to reach full amplitude if the frequency is too high.

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Photodiode vs photoresistor comparison

* --- Component Models ---
* Generic Green LED Model
.model DLED D(IS=1e-22 RS=5 N=1.5 CJO=10p)
* Silicon Photodiode Model (BPW34 - Dark Characteristics)
.model D_BPW34 D(IS=1e-9 RS=5 N=1 CJO=20p)

* --- Power Supplies ---
* V1: Main Circuit Power (5V DC)
V1 VCC 0 DC 5

* V2: Pulse Generator (Stimulus)
* 0V to 5V, 100Hz (10ms period), 50% Duty Cycle
* Rise/Fall time 100us to ensure convergence
V2 V_PULSE 0 PULSE(0 5 0 100u 100u 5m 10m)

* --- Stimulus Section ---
* R1: Current limiting resistor for LED
R1 V_PULSE NODE_LED 330
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Photodiode vs photoresistor comparison

* --- Component Models ---
* Generic Green LED Model
.model DLED D(IS=1e-22 RS=5 N=1.5 CJO=10p)
* Silicon Photodiode Model (BPW34 - Dark Characteristics)
.model D_BPW34 D(IS=1e-9 RS=5 N=1 CJO=20p)

* --- Power Supplies ---
* V1: Main Circuit Power (5V DC)
V1 VCC 0 DC 5

* V2: Pulse Generator (Stimulus)
* 0V to 5V, 100Hz (10ms period), 50% Duty Cycle
* Rise/Fall time 100us to ensure convergence
V2 V_PULSE 0 PULSE(0 5 0 100u 100u 5m 10m)

* --- Stimulus Section ---
* R1: Current limiting resistor for LED
R1 V_PULSE NODE_LED 330

* D_STIM: Green LED (Light Source)
* Anode to NODE_LED, Cathode to GND
D_STIM NODE_LED 0 DLED

* --- Light Coupling & Physics Simulation (Behavioral) ---
* These elements simulate the physical behavior of light transfer
* from the LED to the sensors.

* 1. LDR Latency Simulation (RC Filter)
* Simulates the slow response time of the photo-resistive material.
* R_PHYS and C_PHYS create a delay on the control signal.
R_PHYS NODE_LED V_LIGHT_LDR 10k
C_PHYS V_LIGHT_LDR 0 1u

* --- LDR Sensor Section ---
* R_LDR: Light Dependent Resistor
* Modeled as a behavioral resistor (ngspice syntax).
* Resistance varies from ~1Meg (Dark) to ~2k (Light).
* Controlled by the delayed light signal (V_LIGHT_LDR) with a sigmoid transition.
R_LDR VCC V_LDR R = '2k + (1Meg - 2k) / (1 + exp(10 * (V(V_LIGHT_LDR) - 1.0)))'

* R2: Voltage divider bottom leg (10k)
R2 V_LDR 0 10k

* --- Photodiode Sensor Section ---
* D_PD: Silicon Photodiode (BPW34)
* Connected in reverse bias: Cathode to VCC, Anode to V_PD.
D_PD V_PD VCC D_BPW34

* Photocurrent Source (Behavioral)
* Represents the current generated by light (Cathode to Anode).
* Controlled directly by NODE_LED (Fast response).
* Generates ~20uA when LED is ON.
B_PD_PHOTO VCC V_PD I = '20u * (1 / (1 + exp(-10 * (V(NODE_LED) - 1.0))))'

* R3: Load resistor for Photodiode (220k)
* Converts photocurrent to voltage.
R3 V_PD 0 220k

* --- Simulation Directives ---
.op
* Transient analysis: 100us step size, 30ms duration (3 full cycles)
.tran 100u 30m

* Print directives for logging results
.print tran V(V_PULSE) V(NODE_LED) V(V_LDR) V(V_PD)

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (764 rows)
Index   time            v(v_pulse)      v(node_led)     v(v_ldr)
0	0.000000e+00	0.000000e+00	2.716431e-145	4.950717e-02
1	1.000000e-06	5.000000e-02	4.824684e-02	4.950717e-02
2	1.083830e-06	5.419150e-02	5.230192e-02	4.950717e-02
3	1.251490e-06	6.257451e-02	6.041598e-02	4.950717e-02
4	1.586811e-06	7.934053e-02	7.664554e-02	4.950717e-02
5	2.257451e-06	1.128726e-01	1.091032e-01	4.950717e-02
6	3.598733e-06	1.799366e-01	1.740197e-01	4.950717e-02
7	6.281296e-06	3.140648e-01	3.038499e-01	4.950717e-02
8	1.164642e-05	5.823211e-01	5.635005e-01	4.950718e-02
9	2.048297e-05	1.024149e+00	9.911337e-01	4.950719e-02
10	3.049268e-05	1.524634e+00	1.474550e+00	4.950722e-02
11	3.675621e-05	1.837811e+00	1.660693e+00	4.950724e-02
12	4.338068e-05	2.169034e+00	1.711124e+00	4.950727e-02
13	4.777134e-05	2.388567e+00	1.729852e+00	4.950729e-02
14	5.403581e-05	2.701791e+00	1.750179e+00	4.950731e-02
15	6.656476e-05	3.328238e+00	1.778506e+00	4.950737e-02
16	9.162266e-05	4.581133e+00	1.819947e+00	4.950748e-02
17	1.000000e-04	5.000000e+00	1.831535e+00	4.950751e-02
18	1.050116e-04	5.000000e+00	1.831601e+00	4.950754e-02
19	1.150347e-04	5.000000e+00	1.831470e+00	4.950759e-02
20	1.350811e-04	5.000000e+00	1.831473e+00	4.950768e-02
21	1.751737e-04	5.000000e+00	1.831478e+00	4.950788e-02
22	2.553590e-04	5.000000e+00	1.831491e+00	4.950831e-02
23	3.553590e-04	5.000000e+00	1.831507e+00	4.950895e-02
... (740 more rows) ...

Common mistakes and how to avoid them

  1. Reversing the Photodiode: A photodiode in a divider setup usually requires reverse bias (Cathode to VCC). If connected forward (Anode to VCC), it acts like a normal diode, clamping the voltage and ruining the sensing range.
  2. Using too small a resistor for the Photodiode: Photodiodes generate very small currents (microamps). Using a 1 kΩ resistor for R3 will result in tiny signals. We use 220 kΩ here to ensure the output voltage swing is large enough to see clearly on an oscilloscope.
  3. Expecting the LDR to react instantly: Students often think the circuit is broken because the LDR signal looks «rounded» or «wavy» at high frequencies. This is the inherent physical limitation of the chemical material (Cadmium Sulfide), not a wiring error.

Troubleshooting

  • Symptom: No voltage change on V_PD when light shines.
    • Cause: Photodiode might be reversed or R3 is too small for the ambient light level.
    • Fix: Ensure Cathode is at VCC and Anode is at the measurement node. Check that the Stimulus LED is actually blinking and bright enough.
  • Symptom: V_LDR is always stuck at High (near 5 V).
    • Cause: R_LDR resistance is too low compared to R2, or ambient light is too bright.
    • Fix: Ensure the «dark» test is actually dark. Decrease R2 if the LDR resistance is naturally low.
  • Symptom: V_PD signal is extremely noisy.
    • Cause: High impedance node (V_PD with 220 kΩ resistor) picks up mains hum (50/60Hz).
    • Fix: Use shorter wires or add a small capacitor (e.g., 100pF) in parallel with R3, though this slightly reduces speed.

Possible improvements and extensions

  1. Transimpedance Amplifier (TIA): Replace the passive resistor R3 with an Op-Amp configured as a transimpedance amplifier. This provides a much faster response and a low-impedance output suitable for driving other circuits.
  2. Frequency Sweep: Use a variable frequency generator for V2. Slowly increase the frequency from 10 Hz to 10 kHz to find the «cutoff frequency» where the LDR stops responding completely, while the photodiode continues to work.

More Practical Cases on Prometeo.blog

Quick Quiz

Question 1: What is the primary objective of the dual comparison circuit described?




Question 2: Which sensor is identified as essential for high-speed data transmission like fiber optics?




Question 3: What is a typical use case mentioned for LDRs where reaction speed is not critical?




Question 4: How is the LDR's voltage response described when exposed to a fast-blinking light?




Question 5: Which component acts as the light stimulus for the sensors in this experiment?




Question 6: Why are photodiodes preferred for precision metering applications?




Question 7: What is the expected shape of the Photodiode output voltage?




Question 8: Which characteristic makes LDRs suitable for streetlights but not fiber optics?




Question 9: What distinct outcome is expected at the voltage nodes V_LDR and V_PD?




Question 10: Who is the primary target audience for this circuit experiment?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:


Practical case: Simple twilight switch

Simple twilight switch prototype (Maker Style)

Level: Basic. Objective: Build a circuit that activates an LED when light levels drop.

Objective and use case

In this practical case, you will design and assemble a light-sensing circuit that automatically turns on an LED when the environment becomes dark. This circuit uses a photodiode to control an NPN transistor acting as a switch.

  • Real-world applications:
    • Automatic street lighting systems.
    • Emergency corridor lights that activate during power outages (if light absent).
    • Battery-saving garden solar lights.
    • Security systems triggered by shadows or obstruction of light beams.
  • Expected outcome:
    • Bright light: The LED remains OFF; the voltage at the transistor base is low.
    • Darkness: The LED turns ON; the voltage at the transistor base rises above 0.7 V.
    • Transition: The circuit reacts to the absence of light (dark sensor logic).
  • Target audience: Beginners and electronics students.

Materials

  • V1: 5 V DC supply, function: main power source.
  • R1: 100 kΩ resistor, function: base pull-up resistor (sets sensitivity).
  • R2: 330 Ω resistor, function: LED current limiting.
  • D1: Generic silicon photodiode, function: light sensor.
  • Q1: 2N2222 (or BC547) NPN Transistor, function: electronic switch.
  • D2: Red LED, function: visual output indicator.

Wiring guide

This guide uses specific node names to define the connections clearly.
* Nodes defined: VCC (5 V), GND (0 V), V_BASE (Control voltage), V_COL (Collector voltage).

  • V1 (Source): Connect positive terminal to VCC and negative terminal to GND.
  • R1 (Bias): Connect between VCC and V_BASE.
  • D1 (Photodiode):
    • Connect the Cathode to V_BASE.
    • Connect the Anode to GND.
    • Note: The photodiode is used in reverse bias mode.
  • Q1 (Transistor):
    • Connect the Base to V_BASE.
    • Connect the Emitter to GND.
    • Connect the Collector to V_COL.
  • R2 & D2 (Output Loop):
    • Connect R2 between VCC and the Anode of D2.
    • Connect the Cathode of D2 to V_COL (the Collector of Q1).

Conceptual block diagram

Conceptual block diagram — 74HC14 Photodiode
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

[ INPUT / SENSING ]                     [ LOGIC / SWITCHING ]                   [ OUTPUT / LOAD ]

      [ VCC (5 V) ]                                                                       [ VCC (5 V) ]
           |                                                                                  |
           |                                                                                  |
           v                                                                                  v
    [ R1: 100k Bias ] --(Pull Up)--+                                                  [ R2: 330 Ohm ]
                                   |                                                          |
                                   |                                                          |
                                (V_BASE)                                                      v
                                   |                                                    [ D2: Red LED ]
                                   |                                                          |
                                   +--(Control Sig)--> [ Q1: NPN Base ]                       |
                                   |                   [              ]                       |
                                   |                   [ Q1 Collector ] <--(Sink Current)-----+
    [ D1: Photodiode ] --(Sensor)--+                   [              ]                 (V_COL Node)
    (Reverse Biased)               |                   [ Q1 Emitter   ]
           |                       |                          |
           |                       |                          |
           v                       |                          v
        [ GND ]                    +---------------------> [ GND ]
Schematic (ASCII)

Electrical diagram

Electrical diagram for case: Practical case: Simple twilight switch
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

Measurements and tests

Perform the following validation steps using a multimeter to ensure the circuit works as intended.

  1. Check Supply Voltage:
    • Measure between VCC and GND. It should read approximately 5 V.
  2. Test Light Condition (LED OFF):
    • Shine a bright light directly on the photodiode D1.
    • Measure voltage at V_BASE. It should be low (typically < 0.5 V) because the photodiode conducts current to ground.
    • Observe D2 (LED). It should be OFF.
    • Measure voltage at V_COL. It should be close to VCC (High) as the transistor is in cutoff.
  3. Test Dark Condition (LED ON):
    • Cover D1 completely with your hand or a dark cap.
    • Measure voltage at V_BASE. It should rise above 0.6 V – 0.7 V.
    • Observe D2 (LED). It should turn ON.
    • Measure voltage at V_COL. It should drop to near 0 V (saturation voltage ~0.2 V).

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Simple twilight switch

* --- Power Supply ---
* V1: 5 V DC supply
V1 VCC 0 DC 5

* --- Input Stage (Light Sensor) ---
* R1: 100 kΩ resistor (Base pull-up)
* Connect between VCC and V_BASE
R1 VCC V_BASE 100k

* D1: Generic silicon photodiode
* Connect the Cathode to V_BASE, Anode to GND (Reverse Bias)
* SPICE Syntax: Dname Anode Cathode Model
D1 0 V_BASE D_GENERIC

* OPTICAL STIMULUS SIMULATION
* The photodiode generates a photocurrent flowing from Cathode to Anode 
* (Reverse current) proportional to light intensity.
* We simulate this with a Current Source (I_LIGHT) in parallel with D1.
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Simple twilight switch

* --- Power Supply ---
* V1: 5 V DC supply
V1 VCC 0 DC 5

* --- Input Stage (Light Sensor) ---
* R1: 100 kΩ resistor (Base pull-up)
* Connect between VCC and V_BASE
R1 VCC V_BASE 100k

* D1: Generic silicon photodiode
* Connect the Cathode to V_BASE, Anode to GND (Reverse Bias)
* SPICE Syntax: Dname Anode Cathode Model
D1 0 V_BASE D_GENERIC

* OPTICAL STIMULUS SIMULATION
* The photodiode generates a photocurrent flowing from Cathode to Anode 
* (Reverse current) proportional to light intensity.
* We simulate this with a Current Source (I_LIGHT) in parallel with D1.
* Logic: 
*   0uA = Dark (Night) -> Base High -> Q1 ON -> LED ON
*   100uA = Light (Day) -> Base Low -> Q1 OFF -> LED OFF
* Waveform: Dark (0uA) transitioning to Light (100uA)
I_LIGHT V_BASE 0 PULSE(0 100u 100u 100u 100u 2m 5m)

* --- Switching Stage ---
* Q1: 2N2222 NPN Transistor
* Base to V_BASE, Emitter to GND, Collector to V_COL
* SPICE Syntax: Qname Collector Base Emitter Model
Q1 V_COL V_BASE 0 2N2222

* --- Output Stage ---
* R2: 330 Ω resistor
* Connect between VCC and the Anode of D2 (Node V_LED_ANODE)
R2 VCC V_LED_ANODE 330

* D2: Red LED
* Connect Anode to V_LED_ANODE, Cathode to V_COL
D2 V_LED_ANODE V_COL LED_RED

* --- Models ---
* Standard NPN Transistor Model
.model 2N2222 NPN (IS=1E-14 VAF=100 BF=200 IKF=0.3 XTB=1.5 BR=3 CJC=8E-12 CJE=25E-12 TR=46.91E-9 TF=411.1E-12 ITF=0.6 VTF=1.7 XTF=3 RB=10 RC=1 RE=0.1)

* Generic Red LED Model (Approx 1.8V-2V drop)
.model LED_RED D (IS=93.2p RS=42m N=3.73 BV=5 IBV=10u CJO=2.97p VJ=0.75 M=0.333 TT=4.32u)

* Generic Silicon Diode Model for Photodiode (Dark characteristics)
.model D_GENERIC D (IS=1N N=1 RS=0.1)

* --- Analysis Directives ---
* Transient analysis to show the switching behavior
.tran 10u 5m

* Print required voltages to verify operation
* V(V_BASE): Sensor voltage (High = Dark, Low = Light)
* V(V_COL): Output state (Low = LED ON, High/Floating = LED OFF)
.print tran V(V_BASE) V(V_COL)

.op
.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (534 rows)
Index   time            v(v_base)       v(v_col)
0	0.000000e+00	7.119659e-01	4.863696e-01
1	1.000000e-07	7.119659e-01	4.863696e-01
2	2.000000e-07	7.119659e-01	4.863696e-01
3	4.000000e-07	7.119659e-01	4.863696e-01
4	8.000000e-07	7.119659e-01	4.863696e-01
5	1.600000e-06	7.119659e-01	4.863696e-01
6	3.200000e-06	7.119659e-01	4.863696e-01
7	6.400000e-06	7.119659e-01	4.863696e-01
8	1.280000e-05	7.119659e-01	4.863696e-01
9	2.280000e-05	7.119659e-01	4.863696e-01
10	3.280000e-05	7.119659e-01	4.863696e-01
11	4.280000e-05	7.119659e-01	4.863696e-01
12	5.280000e-05	7.119659e-01	4.863696e-01
13	6.280000e-05	7.119659e-01	4.863696e-01
14	7.280000e-05	7.119659e-01	4.863696e-01
15	8.280000e-05	7.119659e-01	4.863696e-01
16	9.280000e-05	7.119659e-01	4.863696e-01
17	1.000000e-04	7.119659e-01	4.863696e-01
18	1.006859e-04	7.117420e-01	5.075675e-01
19	1.020576e-04	7.110644e-01	5.716214e-01
20	1.044620e-04	7.094358e-01	7.222583e-01
21	1.068767e-04	7.077111e-01	8.743413e-01
22	1.096009e-04	7.056321e-01	1.048175e+00
23	1.150494e-04	7.009675e-01	1.400214e+00
... (510 more rows) ...

Common mistakes and how to avoid them

  1. Reversing the Photodiode:
    • Error: Connecting the Anode to Base and Cathode to Ground.
    • Result: The diode acts like a standard forward-biased diode, clamping the Base to ~0.7 V permanently or conducting fully, preventing the switching logic.
    • Solution: Ensure the Cathode (marked with a line or flat side) connects to the positive side (Base) for reverse bias operation.
  2. Incorrect Transistor Pinout:
    • Error: Swapping Collector and Emitter on the 2N2222.
    • Result: The gain is significantly reduced, and the LED may not turn on fully or the transistor might overheat.
    • Solution: Verify the pinout (E-B-C) in the datasheet before insertion.
  3. Wrong Resistor Value for R1:
    • Error: Using a very low value (e.g., 1 kΩ) for R1.
    • Result: The photodiode current cannot pull the voltage down enough in bright light, keeping the LED ON permanently.
    • Solution: Use a high value (100 kΩ to 330 kΩ) to allow the small photocurrent to control the voltage divider effectively.

Troubleshooting

  • Symptom: LED is always ON, even in bright light.
    • Cause: R1 is too small, or the ambient light is not strong enough to generate sufficient photocurrent.
    • Fix: Increase R1 to 220 kΩ or 330 kΩ, or bring the light source closer.
  • Symptom: LED is always OFF, even in total darkness.
    • Cause: Photodiode is shorted, R1 is open, or Transistor is blown.
    • Fix: Check continuity on R1. Remove D1; if LED turns on, D1 was shorted or installed backward (forward biased).
  • Symptom: LED glows dimly in the dark.
    • Cause: Q1 is not fully saturating.
    • Fix: Decrease R2 slightly (ensure it stays above 220 Ω) or check if V1 is actually 5 V.

Possible improvements and extensions

  1. Sensitivity Adjustment: Replace R1 with a 500 kΩ potentiometer (in series with a 10 kΩ safety resistor) to manually tune the light level at which the LED triggers.
  2. Hysteresis/Clean Switching: Add a second transistor or a Schmitt Trigger (e.g., 74HC14) between the photodiode node and the driver transistor to prevent the LED from flickering at the «twilight» threshold.

More Practical Cases on Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.

Quick Quiz

Question 1: What is the primary objective of the circuit described in the text?




Question 2: Which component acts as the electronic switch in this circuit?




Question 3: What happens to the LED when the environment is bright?




Question 4: What is the function of the 330 Ω resistor (R2)?




Question 5: Which voltage threshold at the transistor base is mentioned for turning the LED ON?




Question 6: What real-world application is listed for this type of circuit?




Question 7: What is the role of resistor R1 (100 kΩ)?




Question 8: What is the function of the V1 component in the materials list?




Question 9: How does the circuit behave during the transition from light to dark?




Question 10: Who is the target audience for this circuit project?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:


Practical case: Reverse Bias Photodiode Light Detection

Reverse Bias Photodiode Light Detection prototype (Maker Style)

Level: Basic – Understand how a reverse-biased photodiode acts as a light sensor.

Objective and use case

In this practical case, you will build a circuit that utilizes a photodiode in reverse bias mode to detect varying levels of light intensity. By measuring the voltage drop across a series resistor, you will observe the relationship between photon incidence and leakage current.

  • Real-world utility:

    • Optical communications: Used in fiber optic receivers to convert light pulses back into electrical data.
    • Smoke detectors: Detects light scattered by smoke particles in an optical chamber.
    • Ambient light sensors: Adjusts screen brightness on smartphones based on surrounding light.
    • Safety curtains: Stops industrial machinery when a light beam is interrupted.
  • Expected outcome:

    • Dark condition: The voltage output will be near 0 V (minimal dark current).
    • Light condition: The voltage output will rise proportionally to the light intensity.
    • Linearity: The photodiode acts as a current source where Iphoto is linear with respect to illuminance (Lux).
  • Target audience: Students and hobbyists introducing themselves to semiconductor sensors.

Materials

  • V1: 5 V DC supply, function: Reverse bias voltage source.
  • D1: Photodiode (e.g., BPW34 or generic silicon photodiode), function: Light sensor.
  • R1: 100 kΩ resistor, function: Current-to-voltage conversion (Load resistor).
  • L1: White LED or Flashlight, function: External light stimulus.
  • M1: Multimeter, function: Voltmeter for V_OUT.

Wiring guide

This circuit uses a series configuration to measure the reverse photocurrent. We define the nodes as VCC (5 V source), V_OUT (Measurement point), and 0 (Ground).

  • V1: Connect the positive terminal to node VCC and the negative terminal to node 0.
  • D1 (Photodiode): Connect the Cathode (marked side) to node VCC. Connect the Anode to node V_OUT. Note: This ensures the diode is reverse-biased.
  • R1: Connect one leg to node V_OUT and the other leg to node 0.
  • M1 (Voltmeter): Connect the positive probe to V_OUT and the negative probe to 0.

Conceptual block diagram

Conceptual block diagram — LM393 Reverse-Biased Photodiode
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

[ STIMULUS & POWER ]               [ SENSOR LOGIC ]                     [ OUTPUT ]

    [ Light Source L1 ] ~~~(Light)~~~>+---------------------+
                                      |    Photodiode D1    |
                                      | (Sensor / Rev Bias) |
    [ 5 V Supply V1 ] -----(VCC)------>| Cathode       Anode |----(V_OUT)---> [ Multimeter M1 ]
                                      +----------+----------+      (Volts)
                                                 |
                                           (Photocurrent)
                                                 |
                                                 v
                                      +----------+----------+
                                      |     Resistor R1     |
                                      |      (100 kΩ)       |
                                      +----------+----------+
                                                 |
                                                 v
                                          [ GND (0 V) ]
Schematic (ASCII)

Electrical diagram

Electrical diagram for case: Reverse Bias Photodiode Light Detection
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

Measurements and tests

  1. Dark Test: Cover the photodiode completely with an opaque object or your hand. Measure the voltage at V_OUT.
    • Expectation: The reading should be very close to 0 V (typically in the microvolt or low millivolt range), representing the dark current.
  2. Ambient Light Test: Expose the sensor to normal room lighting.
    • Expectation: V_OUT should rise significantly (e.g., 0.5 V to 2.0 V, depending on brightness and the exact value of R1).
  3. High Intensity Test: Shine a flashlight or bright LED (L1) directly at D1.
    • Expectation: V_OUT should increase further, potentially approaching the supply voltage limit if the light is very intense.
  4. Calculation: Use Ohm’s Law to calculate the photocurrent at any specific light level: Ireverse = VOUT / R1.

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Reverse Bias Photodiode Light Detection

* --- Models ---
* Generic Photodiode Model (Approximation for BPW34)
* Parameters: IS (Sat Current), CJO (Junction Cap), BV (Breakdown), RS (Series Res)
.model BPW34 D(IS=10n RS=5 N=1.1 BV=60 IBV=10u CJO=70p M=0.45 VJ=0.75)

* --- Components ---

* V1: 5 V DC supply
* Wiring: Positive to VCC, Negative to 0 (Ground)
V1 VCC 0 DC 5

* D1: Photodiode (Sensor)
* Wiring Guide: Cathode to VCC, Anode to V_OUT
* Note: SPICE Diode syntax is D   
D1 V_OUT VCC BPW34

* L1: External Light Stimulus (White LED/Flashlight)
* Modeled as a Current Source (I_L1) representing the generated photocurrent.
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Reverse Bias Photodiode Light Detection

* --- Models ---
* Generic Photodiode Model (Approximation for BPW34)
* Parameters: IS (Sat Current), CJO (Junction Cap), BV (Breakdown), RS (Series Res)
.model BPW34 D(IS=10n RS=5 N=1.1 BV=60 IBV=10u CJO=70p M=0.45 VJ=0.75)

* --- Components ---

* V1: 5 V DC supply
* Wiring: Positive to VCC, Negative to 0 (Ground)
V1 VCC 0 DC 5

* D1: Photodiode (Sensor)
* Wiring Guide: Cathode to VCC, Anode to V_OUT
* Note: SPICE Diode syntax is D   
D1 V_OUT VCC BPW34

* L1: External Light Stimulus (White LED/Flashlight)
* Modeled as a Current Source (I_L1) representing the generated photocurrent.
* In reverse bias, photocurrent flows from Cathode to Anode (internally),
* effectively injecting current from VCC into V_OUT.
* Simulation: Pulsing light from Dark (0A) to Light (30uA).
* Timing: Delay 100us, Rise/Fall 10us, Width 400us, Period 1ms.
I_L1 VCC V_OUT PULSE(0 30u 100u 10u 10u 400u 1m)

* R1: 100 kOhm Load Resistor
* Wiring: One leg to V_OUT, other leg to 0
R1 V_OUT 0 100k

* M1: Multimeter (Voltmeter)
* Function: Measure voltage at V_OUT relative to Ground.
* Implemented via .print output directives below.

* --- Analysis Directives ---

* Transient Analysis:
* Step: 10us, Stop: 3ms (Captures 3 full light pulses)
.tran 10u 3m

* Operating Point Analysis (Initial DC Check):
.op

* Output Printing:
* Prints the voltage at the output node (V_OUT) and supply (VCC)
.print tran V(V_OUT) V(VCC)

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (347 rows)
Index   time            v(v_out)        v(vcc)
0	0.000000e+00	1.000500e-03	5.000000e+00
1	1.000000e-07	1.000500e-03	5.000000e+00
2	2.000000e-07	1.000500e-03	5.000000e+00
3	4.000000e-07	1.000500e-03	5.000000e+00
4	8.000000e-07	1.000500e-03	5.000000e+00
5	1.600000e-06	1.000500e-03	5.000000e+00
6	3.200000e-06	1.000500e-03	5.000000e+00
7	6.400000e-06	1.000500e-03	5.000000e+00
8	1.280000e-05	1.000500e-03	5.000000e+00
9	2.280000e-05	1.000500e-03	5.000000e+00
10	3.280000e-05	1.000500e-03	5.000000e+00
11	4.280000e-05	1.000500e-03	5.000000e+00
12	5.280000e-05	1.000500e-03	5.000000e+00
13	6.280000e-05	1.000500e-03	5.000000e+00
14	7.280000e-05	1.000500e-03	5.000000e+00
15	8.280000e-05	1.000500e-03	5.000000e+00
16	9.280000e-05	1.000500e-03	5.000000e+00
17	1.000000e-04	1.000500e-03	5.000000e+00
18	1.010000e-04	7.978912e-02	5.000000e+00
19	1.030000e-04	3.507154e-01	5.000000e+00
20	1.070000e-04	1.270928e+00	5.000000e+00
21	1.100000e-04	2.076364e+00	5.000000e+00
22	1.108000e-04	2.250021e+00	5.000000e+00
23	1.124000e-04	2.525718e+00	5.000000e+00
... (323 more rows) ...

Common mistakes and how to avoid them

  1. Forward Biasing the Photodiode: Connecting the Anode to VCC makes the photodiode act like a regular diode (or LED), conducting current constantly regardless of light.
    • Solution: Ensure the Cathode (stripe) connects to the positive supply (VCC).
  2. Resistor Value too Low: Using a 100 Ω or 1 kΩ resistor might result in a voltage output too small for a standard multimeter to read easily.
    • Solution: Use a high value resistor (100 kΩ to 1 MΩ) to convert the small microampere photocurrent into a readable voltage.
  3. Multimeter in Current Mode: Connecting the multimeter in parallel while set to Ammeter mode effectively shorts V_OUT to ground.
    • Solution: Always ensure the multimeter is set to DC Volts and connected in parallel with R1.

Troubleshooting

  • Symptom: Output voltage is always constant near 5 V (VCC).
    • Cause: The photodiode is likely connected in forward bias (Anode to VCC), or the photodiode is shorted.
    • Fix: Reverse the photodiode orientation.
  • Symptom: Output voltage stays at 0 V even with bright light.
    • Cause: Open circuit connections, R1 is shorted, or the photodiode is damaged.
    • Fix: Check continuity on the breadboard; verify D1 is actually a photodiode and not a standard LED (which also produces current but much less).
  • Symptom: Readings are unstable or «jumpy».
    • Cause: Interference from AC powered lights (50/60 Hz flicker) picked up by the high-impedance node V_OUT.
    • Fix: Test using a DC light source (flashlight) or add a small capacitor (e.g., 100 nF) in parallel with R1 to filter noise.

Possible improvements and extensions

  1. Transimpedance Amplifier (TIA): Replace R1 with an Operational Amplifier configured as a TIA. This provides a much faster response time and linear output voltage buffered from the load.
  2. Light Threshold Alarm: Feed V_OUT into a voltage comparator (like an LM393) to trigger a buzzer or LED when the light level exceeds a specific setpoint.

More Practical Cases on Prometeo.blog

        <div class="amazon-affiliate">
          <p><strong>Find this product and/or books on this topic on Amazon</strong></p>
          <p><a class="amazon-affiliate-btn" href="https://amzn.to/4mt8r4C" target="_blank" rel="nofollow sponsored noopener">Go to Amazon</a></p>
          <p class="amazon-affiliate-disclaimer">As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.</p>
        </div>

Quick Quiz

Question 1: What is the primary function of the photodiode in the described circuit?




Question 2: In which mode is the photodiode operated in this practical case?




Question 3: What is the role of the series resistor in the circuit?




Question 4: What is the expected voltage output in a 'dark condition'?




Question 5: How does the photodiode behave with respect to illuminance (Lux)?




Question 6: Which of the following is listed as a real-world utility for this circuit?




Question 7: What physical phenomenon is observed when measuring the voltage drop across the resistor?




Question 8: What happens to the voltage output when the light condition changes from dark to light?




Question 9: How are photodiodes utilized in optical communications?




Question 10: What is the function of a photodiode in a smoke detector?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:


Practical case: Voltage limiter with series diodes

Voltage limiter with series diodes prototype (Maker Style)

Level: Basic – Build a circuit to clamp load voltage using diode forward drops.

Objective and use case

In this practical case, you will build a passive voltage limiter (clipper) circuit. By placing multiple silicon diodes in series parallel to the load, you will create a hard «ceiling» for the output voltage, preventing it from exceeding the sum of the forward voltage drops of the diodes.

  • Input protection: Prevents high voltage spikes from damaging sensitive microcontroller inputs (ADCs).
  • Simple regulation: Provides a crude but effective constant voltage reference without a Zener diode.
  • Signal conditioning: Used in audio circuits to create distortion or «fuzz» effects by clipping signal peaks.
  • Logical reference: Can be used to establish specific logic threshold levels in analog computing.

Expected outcome:
* When Input Voltage < ~2.1 V: The output voltage follows the input (minus minor resistive losses).
* When Input Voltage > ~2.1 V: The output voltage clamps and remains stable at approximately 2.1 V.
* The current through the diodes increases significantly once the threshold is reached.
* Target audience: Students and hobbyists learning about diode I-V characteristics.

Materials

  • V1: 0 V to 9 V Variable DC Power Supply, function: Input signal source.
  • R1: 1 kΩ resistor, function: Current limiting for the diodes and source protection.
  • R2: 10 kΩ resistor, function: Load resistor (simulating a downstream circuit).
  • D1: 1N4148 Silicon Diode, function: First voltage drop element (~0.7 V).
  • D2: 1N4148 Silicon Diode, function: Second voltage drop element (~0.7 V).
  • D3: 1N4148 Silicon Diode, function: Third voltage drop element (~0.7 V).

Wiring guide

Construct the circuit following these connections. The node names (e.g., VIN, VOUT, 0) refer to specific electrical points in the circuit. Node 0 represents the Ground (GND).

  • V1 (Source): Connect the positive terminal to node VIN and the negative terminal to node 0.
  • R1 (Limiter): Connect one pin to node VIN and the other pin to node VOUT.
  • R2 (Load): Connect one pin to node VOUT and the other pin to node 0.
  • D1: Connect the Anode to node VOUT and the Cathode to intermediate node N1.
  • D2: Connect the Anode to intermediate node N1 and the Cathode to intermediate node N2.
  • D3: Connect the Anode to intermediate node N2 and the Cathode to node 0.

Note: This creates a chain where D1, D2, and D3 are in series with each other, and that entire string is in parallel with R2.

Conceptual block diagram

Conceptual block diagram — Series Diode Limiter
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

[ INPUT SOURCE ]              [ SERIES LIMITER ]                  [ OUTPUT NODE & BRANCHES ]

                                                                 /------> [ R2: 10 kΩ Load ] ---------> GND (0)
                                                                 |
[ V1: 0-9 V Variable ] --(VIN)--> [ R1: 1 kΩ Resistor ] --(VOUT)-->+
                                                                 |
                                                                 |        [ VOLTAGE CLAMP CHAIN ]
                                                                 |
                                                                 \------> [ D1: 1N4148 ] --(N1)-->+
                                                                                                  |
                                                                          [ D2: 1N4148 ] <--------+
                                                                          |
                                                                          +--(N2)--> [ D3: 1N4148 ] --> GND (0)
Schematic (ASCII)

Electrical diagram

Electrical diagram for practical case: Voltage limiter with series diodes
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

Measurements and tests

Follow these steps to validate the limiting behavior.

  1. Low Voltage Test (Below Threshold):

    • Set V1 to 1.0 V.
    • Measure the voltage at VOUT relative to GND.
    • Expected Result: VOUT should be approximately 0.9 V – 1.0 V (diodes are off/high impedance; R1 and R2 form a voltage divider).
  2. Transition Test (Near Threshold):

    • Set V1 to 2.5 V.
    • Measure the voltage at VOUT.
    • Expected Result: VOUT begins to lag behind VIN. Diodes start conducting. VOUT will likely be around 1.8 V to 2.0 V.
  3. Clamping Test (Above Threshold):

    • Set V1 to 9.0 V.
    • Measure the voltage at VOUT.
    • Expected Result: VOUT should be clamped at approximately 2.1 V to 2.2 V (3 diodes × ~0.7 V each). It will NOT reach 9 V.
  4. Transfer Curve Sweep:

    • Slowly increase V1 from 0 V to 9 V while monitoring VOUT.
    • Observe that VOUT rises linearly initially, then «knees» over and flattens out around 2.1 V.

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Voltage limiter with series diodes

* --- Power Supply / Input Signal ---
* V1: 0 V to 9 V Variable DC Power Supply
* Modeled as a linear ramp (PWL) from 0V to 9V over 10ms
* This allows the transient analysis to show the voltage limiting characteristic.
V1 VIN 0 PWL(0 0 10m 9)

* --- Resistors ---
* R1: 1 kΩ resistor (Current limiting)
* Connects VIN to VOUT
R1 VIN VOUT 1k

* R2: 10 kΩ resistor (Load)
* Connects VOUT to Ground (0)
R2 VOUT 0 10k

* --- Diodes ---
* Chain of 3 diodes in series, connected in parallel with the load (R2).
* This clamps VOUT to approximately 3 * 0.7V = 2.1V.
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Voltage limiter with series diodes

* --- Power Supply / Input Signal ---
* V1: 0 V to 9 V Variable DC Power Supply
* Modeled as a linear ramp (PWL) from 0V to 9V over 10ms
* This allows the transient analysis to show the voltage limiting characteristic.
V1 VIN 0 PWL(0 0 10m 9)

* --- Resistors ---
* R1: 1 kΩ resistor (Current limiting)
* Connects VIN to VOUT
R1 VIN VOUT 1k

* R2: 10 kΩ resistor (Load)
* Connects VOUT to Ground (0)
R2 VOUT 0 10k

* --- Diodes ---
* Chain of 3 diodes in series, connected in parallel with the load (R2).
* This clamps VOUT to approximately 3 * 0.7V = 2.1V.

* D1: 1N4148 Silicon Diode
* Anode -> VOUT, Cathode -> N1
D1 VOUT N1 1N4148

* D2: 1N4148 Silicon Diode
* Anode -> N1, Cathode -> N2
D2 N1 N2 1N4148

* D3: 1N4148 Silicon Diode
* Anode -> N2, Cathode -> Ground (0)
D3 N2 0 1N4148

* --- Models ---
* Standard model for 1N4148 small signal diode
.model 1N4148 D (IS=2.682n N=1.836 RS=0.5664 BV=100 IBV=20n CJO=4p TT=11.54n)

* --- Simulation Directives ---
* Perform a transient analysis for 10ms (matching the input ramp duration)
* Step size 10us
.tran 10u 10m

* Calculate DC operating point
.op

* Output data for plotting/logging
.print tran V(VIN) V(VOUT) V(N1) V(N2)

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (2016 rows)
Index   time            v(vin)          v(vout)         v(n1)
0	0.000000e+00	0.000000e+00	-9.87864e-23	2.810146e-18
1	1.000000e-07	9.000000e-05	8.083682e-05	5.389121e-05
2	2.000000e-07	1.800000e-04	1.626418e-04	1.084279e-04
3	4.000000e-07	3.600000e-04	3.262751e-04	2.175167e-04
4	8.000000e-07	7.200000e-04	6.535424e-04	4.356949e-04
5	1.600000e-06	1.440000e-03	1.308076e-03	8.720508e-04
6	3.200000e-06	2.880000e-03	2.617144e-03	1.744763e-03
7	6.400000e-06	5.760000e-03	5.235279e-03	3.490186e-03
8	1.280000e-05	1.152000e-02	1.047155e-02	6.981032e-03
9	2.280000e-05	2.052000e-02	1.865321e-02	1.243547e-02
10	3.280000e-05	2.952000e-02	2.683486e-02	1.788991e-02
11	4.280000e-05	3.852000e-02	3.501650e-02	2.334434e-02
12	5.280000e-05	4.752000e-02	4.319814e-02	2.879876e-02
13	6.280000e-05	5.652000e-02	5.137976e-02	3.425317e-02
14	7.280000e-05	6.552000e-02	5.956137e-02	3.970758e-02
15	8.280000e-05	7.452000e-02	6.774297e-02	4.516198e-02
16	9.280000e-05	8.352000e-02	7.592455e-02	5.061637e-02
17	1.028000e-04	9.252000e-02	8.410612e-02	5.607075e-02
18	1.128000e-04	1.015200e-01	9.228768e-02	6.152512e-02
19	1.228000e-04	1.105200e-01	1.004692e-01	6.697948e-02
20	1.328000e-04	1.195200e-01	1.086507e-01	7.243383e-02
21	1.428000e-04	1.285200e-01	1.168323e-01	7.788817e-02
22	1.528000e-04	1.375200e-01	1.250137e-01	8.334250e-02
23	1.628000e-04	1.465200e-01	1.331952e-01	8.879681e-02
... (1992 more rows) ...

Common mistakes and how to avoid them

  1. Reversing diode polarity: If diodes are connected Cathode-to-Anode (facing up towards positive), they will not conduct in forward bias. Solution: Ensure the band (Cathode) of D3 connects to Ground, and the arrows point from VOUT to Ground.
  2. Omitting R1: Connecting the source directly to the diode string without R1 causes a short circuit when V1 > 2.1 V, likely destroying the diodes. Solution: Always include a series resistor (R1) to drop the excess voltage.
  3. Using a low resistance load (R2): If R2 is very small (e.g., 100 Ω), it will dominate the circuit and reduce VOUT below the clamping threshold purely by voltage division. Solution: Ensure the load R2 is significantly larger than R1 (at least 10x larger) for sharp clamping action.

Troubleshooting

  • Symptom: VOUT equals VIN for the entire 0-9 V range.
    • Cause: The diode path is open.
    • Fix: Check for loose connections in the D1-D2-D3 string or a backwards diode blocking current.
  • Symptom: VOUT stays near 0 V even when VIN is increased.
    • Cause: Diodes are shorted or one diode is reversed and connected in parallel with the supply incorrectly (though R1 usually protects this).
    • Fix: Check diode orientation. If a diode is reversed parallel to the load, it clamps at -0.7 V (essentially 0 V in this setup).
  • Symptom: The clamping voltage is ~0.7 V or ~1.4 V instead of ~2.1 V.
    • Cause: One or two diodes are shorted or bypassed.
    • Fix: Verify that exactly three healthy diodes are in the series string.

Possible improvements and extensions

  1. Adjustable Clamp: Replace the fixed D1-D3 string with a Zener diode (e.g., 3.3 V or 5.1 V) to set a specific protection voltage with a single component.
  2. Visual Indication: Replace one of the standard diodes with a red LED. The clamp voltage will rise (LEDs drop ~1.8 V – 2.0 V), and the LED will light up when the input voltage exceeds the limit, acting as an «Overvoltage Warning.»

More Practical Cases on Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.

Quick Quiz

Question 1: What is the primary function of the circuit described in this practical case?




Question 2: How is the voltage 'ceiling' established in this specific circuit design?




Question 3: What happens to the output voltage when the input voltage exceeds approximately 2.1 V?




Question 4: What is the primary purpose of the resistor R1 (1 kΩ) in this circuit?




Question 5: Which component represents the downstream circuit or load in this experiment?




Question 6: What is the approximate forward voltage drop of a single standard silicon diode like the 1N4148?




Question 7: When used for input protection, what specific threat does this circuit mitigate?




Question 8: In the context of audio circuits, what effect does this clipping signal conditioning produce?




Question 9: How does the current flowing through the diodes behave once the voltage threshold is reached?




Question 10: To achieve a clamping threshold of ~2.1 V using silicon diodes (approx. 0.7 V drop each), how many are needed in series?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me: