Practical case: Simple security code validation

Simple security code validation prototype (Maker Style)

Level: Medium – Implement a dual-switch authentication system to trigger an electronic lock mechanism.

Objective and use case

In this project, you will build a hardware-based security circuit that controls an electronic lock (solenoid) using a 74HC08 AND gate. The system validates that two distinct authorization signals are present simultaneously before granting access.

Why it is useful:
* Safety Interlocks: Mimics industrial machinery controls requiring two-hand operation to prevent injury.
* Security Access: Simulates a simplified «Two-Factor Authentication» (2FA) where a key and a code must be active at the same time.
* Logic Control: Demonstrates how to interface low-power logic gates with high-power electromechanical actuators.

Expected outcome:
* The Solenoid activates (unlocks) ONLY when both Switch A AND Switch B are set to HIGH (logic 1).
* The Indicator LED lights up simultaneously with the solenoid activation.
* Logic Output: Measures ~5V at the gate output during activation and ~0V otherwise.
* Target audience: Intermediate electronics students familiar with basic digital logic.

Materials

  • V1: 5 V DC Power Supply, function: Main circuit power.
  • U1: 74HC08, function: Quad 2-Input AND Gate IC.
  • S1: DIP Switch (SPST), function: Input A (Security Key 1).
  • S2: DIP Switch (SPST), function: Input B (Security Key 2).
  • R1: 10 kΩ resistor, function: Pull-down for Input A.
  • R2: 10 kΩ resistor, function: Pull-down for Input B.
  • R3: 1 kΩ resistor, function: Transistor base current limiting.
  • R4: 330 Ω resistor, function: LED current limiting.
  • Q1: 2N2222 (NPN BJT), function: Driver switch for the solenoid.
  • D1: 1N4007 Diode, function: Flyback/Snubber protection for the transistor.
  • D2: Green LED, function: Visual status indicator.
  • L1: 5 V / 100 mA Solenoid (represented as Inductor+Resistor), function: Electronic lock mechanism.

Pin-out of the 74HC08

Selected Chip: 74HC08 (Quad 2-Input AND Gate)

Pin Name Logic Function Connection in this case
1 1A Input A Connected to Node VA (Switch S1)
2 1B Input B Connected to Node VB (Switch S2)
3 1Y Output Connected to Node V_GATE
7 GND Ground Connected to Node 0
14 VCC Power Supply Connected to Node VCC (+5V)

Wiring guide

Construct the circuit following these explicit node connections:

  • Power Rail:
  • Connect V1 positive terminal to node VCC.
  • Connect V1 negative terminal to node 0 (GND).
  • Connect U1 pin 14 to VCC and pin 7 to 0.

  • Input Stage (Sensors):

  • Connect S1 between VCC and node VA.
  • Connect R1 between VA and 0.
  • Connect U1 pin 1 (Input 1A) to node VA.
  • Connect S2 between VCC and node VB.
  • Connect R2 between VB and 0.
  • Connect U1 pin 2 (Input 1B) to node VB.

  • Logic Stage:

  • U1 pin 3 (Output 1Y) defines node V_GATE.

  • Output Stage (Actuator Driver):

  • Connect R3 between V_GATE and the Base of Q1.
  • Connect the Emitter of Q1 directly to 0.
  • Connect the Collector of Q1 to node V_LOCK.
  • Connect L1 (Solenoid) between VCC and V_LOCK.
  • Connect D1 (Cathode to VCC, Anode to V_LOCK) across the solenoid to protect Q1.

  • Indicator Stage:

  • Connect R4 between V_LOCK and the Anode of D2.
  • Connect the Cathode of D2 to node 0? Correction: Since Q1 switches the low side, connect R4 + D2 in parallel with the solenoid to see when it is energized, or simply connect R4 from V_GATE to D2 Anode, and D2 Cathode to 0 to visualize the logic signal. Let’s use the latter for clearer logic visualization: Connect R4 between V_GATE and D2 Anode; D2 Cathode to 0.

Conceptual block diagram

Conceptual block diagram — 74HC08 AND gate

Schematic

[ INPUT SENSORS ]              [ LOGIC PROCESSING ]               [ OUTPUT ACTUATORS ]

                                                                     (Visual Status)
    [ Switch S1 ]                  +----------------+          +---> [ Resistor R4 ] --> [ LED D2 ] --> GND
    (w/ R1 Pull-down) --(Node VA)->|  Pin 1         |          |
                                   |                |          |
                                   |   U1: 74HC08   |--(V_GATE)+
                                   |   (AND Gate)   |  (Pin 3) |
                                   |                |          |
    [ Switch S2 ]                  |  Pin 2         |          |     (Solenoid Driver)
    (w/ R2 Pull-down) --(Node VB)->|                |          +---> [ Resistor R3 ] --> [ Transistor Q1 ]
                                   +----------------+                                         |
                                                                                         (Collector)
                                                                                              |
                                                                                              V
                                                                                     [ Solenoid L1 + Diode D1 ]
                                                                                     (Connected to VCC)
Schematic (ASCII)

Truth table

This table describes the logic state of the 74HC08 output and the physical state of the solenoid.

Input A (S1) Input B (S2) Output Y (V_GATE) Solenoid State
0 (Low) 0 (Low) 0 (Low) Locked (OFF)
0 (Low) 1 (High) 0 (Low) Locked (OFF)
1 (High) 0 (Low) 0 (Low) Locked (OFF)
1 (High) 1 (High) 1 (High) Unlocked (ON)

Measurements and tests

  1. Idle Check: With both switches OFF, measure voltage at V_GATE. It should be near 0 V. The solenoid should be relaxed.
  2. Partial Activation: Turn ON S1 only. Measure voltage at VA (should be 5 V) and VB (should be 0 V). Ensure V_GATE remains 0 V.
  3. Full Activation: Turn ON both S1 and S2.
    • Measure V_GATE: It must read ~5 V (Logic High).
    • Observe L1: The solenoid should retract/click.
    • Measure voltage at V_LOCK: It should drop close to 0 V (saturation voltage of Q1), allowing current to flow from VCC through the solenoid.
  4. Current Draw: Measure the current flowing out of V1. It should increase significantly (e.g., +100mA depending on the solenoid) only when both inputs are High.

SPICE netlist and simulation

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

* Simple security code validation

* ==============================================================================
* POWER SUPPLY
* ==============================================================================
V1 VCC 0 DC 5

* ==============================================================================
* INPUT STAGE (Switches & Pull-downs)
* ==============================================================================
* Note: S1 and S2 are simulated using Pulse Voltage Sources to generate 
* dynamic logic patterns for validation.
* R1 and R2 are included as physical pull-down resistors per BOM.

* Input A (S1)
* Generates a pulse: Low for 0.5ms, High for 1ms, Period 2ms
V_S1 VA 0 PULSE(0 5 0.5m 1u 1u 1m 2m)
R1 VA 0 10k

* Input B (S2)
* Generates a pulse: High for 2ms, Low for 2ms, Period 4ms
V_S2 VB 0 PULSE(0 5 0 1u 1u 2m 4m)
R2 VB 0 10k

* ==============================================================================
* LOGIC STAGE (U1: 74HC08 Quad AND Gate)
* ==============================================================================
* Subcircuit to model one gate of the 74HC08, exposing power pins.
* Uses continuous behavioral modeling (sigmoid) for convergence.
.subckt 74HC08_GATE IN1 IN2 OUT VCC_PIN GND_PIN
* ... (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.

* Simple security code validation

* ==============================================================================
* POWER SUPPLY
* ==============================================================================
V1 VCC 0 DC 5

* ==============================================================================
* INPUT STAGE (Switches & Pull-downs)
* ==============================================================================
* Note: S1 and S2 are simulated using Pulse Voltage Sources to generate 
* dynamic logic patterns for validation.
* R1 and R2 are included as physical pull-down resistors per BOM.

* Input A (S1)
* Generates a pulse: Low for 0.5ms, High for 1ms, Period 2ms
V_S1 VA 0 PULSE(0 5 0.5m 1u 1u 1m 2m)
R1 VA 0 10k

* Input B (S2)
* Generates a pulse: High for 2ms, Low for 2ms, Period 4ms
V_S2 VB 0 PULSE(0 5 0 1u 1u 2m 4m)
R2 VB 0 10k

* ==============================================================================
* LOGIC STAGE (U1: 74HC08 Quad AND Gate)
* ==============================================================================
* Subcircuit to model one gate of the 74HC08, exposing power pins.
* Uses continuous behavioral modeling (sigmoid) for convergence.
.subckt 74HC08_GATE IN1 IN2 OUT VCC_PIN GND_PIN
B_AND OUT GND_PIN V = V(VCC_PIN) * (1 / (1 + exp(-20*(V(IN1)-2.5)))) * (1 / (1 + exp(-20*(V(IN2)-2.5))))
.ends

* Instantiate U1 (only one gate used: Inputs 1A, 1B -> Output 1Y)
* Pin 1=VA, Pin 2=VB, Pin 3=V_GATE, Pin 14=VCC, Pin 7=0 (GND)
XU1 VA VB V_GATE VCC 0 74HC08_GATE

* ==============================================================================
* INDICATOR STAGE
* ==============================================================================
* R4 limits current to LED D2
R4 V_GATE LED_A 330
D2 LED_A 0 LED_GREEN

* ==============================================================================
* OUTPUT STAGE (Actuator Driver)
* ==============================================================================
* Base resistor
R3 V_GATE Q1_B 1k

* Transistor Q1 (2N2222)
* Collector -> V_LOCK, Base -> Q1_B, Emitter -> 0
Q1 V_LOCK Q1_B 0 2N2222

* Solenoid L1 (Modeled as Inductor + Series Resistor)
* 5V / 100mA = 50 Ohm DC resistance. Inductance approx 10mH.
* Connected between VCC and V_LOCK.
R_L1 VCC INT_SOL 50
L1 INT_SOL V_LOCK 10mH

* Flyback Diode D1
* Cathode to VCC, Anode to V_LOCK
D1 V_LOCK VCC 1N4007

* ==============================================================================
* MODELS
* ==============================================================================
.model 2N2222 NPN (IS=1E-14 BF=200 VAF=100 CJC=8p CJE=25p TR=400n TF=1n)
.model 1N4007 D (IS=1N RS=0.1 BV=1000 IBV=10u N=1.7)
.model LED_GREEN D (IS=1e-22 RS=5 N=1.5 BV=5 IBV=10u CJO=10p)

* ==============================================================================
* SIMULATION COMMANDS
* ==============================================================================
.op
.tran 10u 5m

* Print logic states and output voltage
.print tran V(VA) V(VB) V(V_GATE) V(V_LOCK)

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (4960 rows)
Index   time            v(va)           v(vb)           v(v_gate)
0	0.000000e+00	0.000000e+00	0.000000e+00	1.860038e-43
1	1.000000e-08	0.000000e+00	5.000000e-02	3.720076e-43
2	2.000000e-08	0.000000e+00	1.000000e-01	1.011221e-42
3	4.000000e-08	0.000000e+00	2.000000e-01	4.123178e-42
4	8.000000e-08	0.000000e+00	4.000000e-01	5.077732e-41
5	1.600000e-07	0.000000e+00	8.000000e-01	4.990226e-39
6	3.200000e-07	0.000000e+00	1.600000e+00	2.809846e-35
7	6.400000e-07	0.000000e+00	3.200000e+00	4.846845e-28
8	1.000000e-06	0.000000e+00	5.000000e+00	9.644030e-22
9	1.064000e-06	0.000000e+00	5.000000e+00	9.643749e-22
10	1.192000e-06	0.000000e+00	5.000000e+00	9.643749e-22
11	1.448000e-06	0.000000e+00	5.000000e+00	9.643749e-22
12	1.960000e-06	0.000000e+00	5.000000e+00	9.643749e-22
13	2.984000e-06	0.000000e+00	5.000000e+00	9.643749e-22
14	5.032000e-06	0.000000e+00	5.000000e+00	9.643749e-22
15	9.128000e-06	0.000000e+00	5.000000e+00	9.643749e-22
16	1.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
17	2.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
18	3.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
19	4.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
20	5.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
21	6.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
22	7.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
23	8.732000e-05	0.000000e+00	5.000000e+00	9.643749e-22
... (4936 more rows) ...

Common mistakes and how to avoid them

  1. Floating Inputs: Forgetting resistors R1 or R2 causes the inputs to «float,» leading to erratic triggering of the lock caused by static electricity. Always use pull-down resistors with CMOS logic like the 74HC series.
  2. Driving Solenoid Directly: Connecting the solenoid directly to the 74HC08 output pin (pin 3). The chip can only supply ~20mA, while a solenoid needs >100mA. This will destroy the chip. Always use a transistor driver (Q1).
  3. Omitting the Flyback Diode: Forgetting D1 across the solenoid. When the solenoid turns off, it generates a high-voltage spike (back EMF) that destroys the transistor instantly.

Troubleshooting

  • Solenoid does not activate but LED works: The logic is correct, but the drive capability is insufficient. Check Q1 connections and ensure the solenoid power requirement matches the supply.
  • Logic Gate gets hot: You might have shorted the output pin to ground or are trying to drive the solenoid directly. Disconnect immediately and check the wiring of pin 3.
  • Circuit works inversely (Unlocks when switches are OFF): You may have wired the pull-down resistors as pull-ups or connected the transistor to the wrong rail. Verify R1 and R2 go to Ground.
  • Input A triggers the lock without Input B: Check for a short circuit between pin 1 and pin 2, or check if pin 2 is accidentally connected to VCC.

Possible improvements and extensions

  1. Add a Timer: Feed the output of the 74HC08 into a 555 Timer (Monostable mode) so the lock stays open for 5 seconds even if the user releases the switches immediately.
  2. Expand Security: Cascade a second 74HC08 to add a third switch (Switch A AND Switch B AND Switch C) for higher security.

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 74HC08 integrated circuit in this project?




Question 2: Which component is typically used to drive the high-power solenoid in this type of circuit?




Question 3: Under what condition will the solenoid activate?




Question 4: What is the purpose of the 1N4007 Diode (D1) in this circuit?




Question 5: What real-world safety application does this circuit mimic?




Question 6: What is the function of resistors R1 and R2 (10 kΩ) connected to the switches?




Question 7: What voltage level is expected at the logic gate output during activation?




Question 8: Which component limits the current flowing into the base of the transistor?




Question 9: What happens to the Indicator LED when the solenoid activates?




Question 10: Who 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: Conveyor belt start system

Conveyor belt start system prototype (Maker Style)

Level: Medium. Design a safety interlock circuit that activates a conveyor belt only when the operator is present and a load is detected.

Objective and use case

In this practical case, you will build a safety logic circuit using a 74HC08 AND gate to control the activation of a DC motor via a relay. The system ensures the conveyor belt only runs when two distinct safety conditions are met simultaneously.

  • Real-world application: Industrial safety interlocks preventing machinery from starting without an operator at the controls.
  • Efficiency: Automated energy saving by ensuring the belt only runs when a product (load) is actually present on the line.
  • Machine protection: Preventing «dry runs» that might wear out mechanical components unnecessarily.

Expected outcome:
* Logic Output: The 74HC08 output pin goes HIGH (approx. 5V) only when both inputs are HIGH.
* Motor State: The DC motor turns ON only when the Operator Button is held AND the Optical Sensor detects an object.
* Current Drive: A transistor amplifies the weak logic signal to switch the 5V relay coil.
* Target Audience: Engineering students and maintenance technicians (Medium level).

Materials

  • V1: 5V DC Power Supply, function: Main circuit power.
  • U1: 74HC08 Quad 2-Input AND Gate, function: Safety logic processing.
  • S1: Push button (Normally Open), function: Simulates «Operator Presence».
  • S2: Switch (SPST) or Phototransistor module, function: Simulates «Optical Load Sensor» (Active High).
  • R1: 10 kΩ resistor, function: Pull-down for Operator input (S1).
  • R2: 10 kΩ resistor, function: Pull-down for Sensor input (S2).
  • R3: 1 kΩ resistor, function: Base current limiting for Q1.
  • Q1: 2N2222 NPN Transistor, function: Relay driver switch.
  • D1: 1N4007 Diode, function: Flyback protection for the relay coil.
  • K1: 5V Relay (SPDT), function: High-current switch for the motor.
  • M1: 5V DC Motor, function: Conveyor belt drive.
  • C1: 100 nF capacitor, function: Decoupling for U1 power supply.

Pin-out of the IC used

Chip: 74HC08 (Quad 2-Input AND Gate)

Pin Name Logic function Connection in this case
1 1A Input A Connected to Operator Button (S1)
2 1B Input B Connected to Optical Sensor (S2)
3 1Y Output Connected to Transistor Base Resistor (R3)
7 GND Ground Connected to 0V (GND)
14 VCC Power Connected to +5V (VCC)

Note: Pins 4-6 and 8-13 are unused in this single-gate application and should technically be tied to GND in a permanent noise-sensitive environment, but are left open for this basic prototype.

Wiring guide

Use the following nodes for your connections: VCC, 0 (Ground), OP_SIGNAL, LOAD_SIGNAL, LOGIC_OUT.

  • Power: Connect VCC to the positive rail of V1 and 0 to the negative rail.
  • Input S1 (Operator): Connect one side of S1 to VCC. Connect the other side to node OP_SIGNAL.
  • Pull-down R1: Connect R1 between OP_SIGNAL and 0.
  • Input S2 (Sensor): Connect one side of S2 to VCC. Connect the other side to node LOAD_SIGNAL.
  • Pull-down R2: Connect R2 between LOAD_SIGNAL and 0.
  • Logic U1:
    • Connect U1 Pin 14 to VCC and Pin 7 to 0.
    • Connect C1 between VCC and 0 near U1.
    • Connect OP_SIGNAL to U1 Pin 1 (Input 1A).
    • Connect LOAD_SIGNAL to U1 Pin 2 (Input 1B).
    • Connect U1 Pin 3 (Output 1Y) to node LOGIC_OUT.
  • Driver Stage:
    • Connect R3 between LOGIC_OUT and the Base of Q1.
    • Connect the Emitter of Q1 to 0.
    • Connect the Collector of Q1 to the Relay coil (K1 pin 1).
  • Relay & Motor:
    • Connect the other side of the Relay coil (K1 pin 2) to VCC.
    • Connect D1 across the Relay coil (Cathode to VCC, Anode to Q1 Collector).
    • Connect Relay Common (COM) to VCC.
    • Connect Relay Normally Open (NO) to the positive terminal of M1.
    • Connect the negative terminal of M1 to 0.

Conceptual block diagram

Conceptual block diagram — 74HC08 AND gate

Schematic

[ INPUTS ]                       [ LOGIC ]                        [ OUTPUT STAGE ]

    (VCC)                                                                    (VCC)
      |                                                                        |
    [ S1: Operator ]--(OP_SIGNAL)-->+-------------+                       +----+----+
      |                             |  Pin 1 (A)  |                       | K1 Coil | (Parallel D1)
    [ R1: 10k ]                     |             |                       +----+----+
      |                             |   74HC08    |                            ^
    (GND)                           |     U1      |                            |
                                    |             |--(Pin 3)-->[ R3: 1k ]-->[ Q1: NPN ]
    (VCC)                           |             |          (LOGIC_OUT)       |
      |                             |             |                            v
    [ S2: Sensor ]--(LOAD_SIGNAL)-->|  Pin 2 (B)  |                          (GND)
      |                             |             |
    [ R2: 10k ]                     +-------------+                          (VCC)
      |                                    |                                   |
    (GND)                               [ C1 ]                           [ K1 Switch ]
                                           |                                   |
                                         (GND)                                 v
                                                                         [ M1: Motor ]
                                                                               |
                                                                             (GND)
Schematic (ASCII)

Truth table

This table represents the logic states required to start the motor.

Operator (S1) Load Detected (S2) U1 Output (Pin 3) Transistor Q1 Motor State
Low (0) Low (0) Low (0) OFF (Cut-off) STOP
Low (0) High (1) Low (0) OFF (Cut-off) STOP
High (1) Low (0) Low (0) OFF (Cut-off) STOP
High (1) High (1) High (1) ON (Sat) RUN

Measurements and tests

Validate the circuit operation using a multimeter:

  1. Input Verification: Measure voltage at OP_SIGNAL relative to GND. It should be 0V when S1 is open and 5V when pressed. Repeat for LOAD_SIGNAL (S2).
  2. Logic Output: With S1 and S2 active, measure voltage at LOGIC_OUT. It should be approximately equal to VCC (Logic High). If either is released, it should drop to ~0V.
  3. Base Current (I_b): Set your multimeter to Ammeter mode. Place it in series with R3. When logic is High, you should measure approximately 4.3mA (calculated as $(5V – 0.7V) / 1000\Omega$). This confirms the transistor is being driven hard enough to saturate.
  4. Relay Actuation: Listen for the «click» of the relay when both inputs are active. Measure voltage across the Motor terminals; it should read 5V.

SPICE netlist and simulation

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

* Title: Practical case: Conveyor belt start system

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

* --- Input S1: Operator Presence ---
* Component: Push button (NO) modeled as Voltage-Controlled Switch
* Wiring: VCC -> S1 -> OP_SIGNAL -> R1 -> 0
S1 VCC OP_SIGNAL CTRL_OP 0 SW_BTN
R1 OP_SIGNAL 0 10k
* Stimulus: Simulate button press (High) from t=1ms to t=4ms
V_ACT_S1 CTRL_OP 0 PULSE(0 5 1m 10u 10u 3m 10m)

* --- Input S2: Optical Load Sensor ---
* Component: Switch/Sensor modeled as Voltage-Controlled Switch
* Wiring: VCC -> S2 -> LOAD_SIGNAL -> R2 -> 0
S2 VCC LOAD_SIGNAL CTRL_LOAD 0 SW_BTN
R2 LOAD_SIGNAL 0 10k
* Stimulus: Simulate sensor active (High) from t=2ms to t=5ms
V_ACT_S2 CTRL_LOAD 0 PULSE(0 5 2m 10u 10u 3m 10m)

* --- Logic U1: 74HC08 Quad AND Gate ---
* Wiring: Pin 14=VCC, Pin 7=0, Pin 1=OP_SIGNAL, Pin 2=LOAD_SIGNAL, Pin 3=LOGIC_OUT
* Decoupling Capacitor C1
C1 VCC 0 100n
* Instantiation of Logic Gate Subcircuit
XU1 OP_SIGNAL LOAD_SIGNAL LOGIC_OUT VCC 0 74HC08_GATE

* --- Driver Stage ---
* ... (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.

* Title: Practical case: Conveyor belt start system

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

* --- Input S1: Operator Presence ---
* Component: Push button (NO) modeled as Voltage-Controlled Switch
* Wiring: VCC -> S1 -> OP_SIGNAL -> R1 -> 0
S1 VCC OP_SIGNAL CTRL_OP 0 SW_BTN
R1 OP_SIGNAL 0 10k
* Stimulus: Simulate button press (High) from t=1ms to t=4ms
V_ACT_S1 CTRL_OP 0 PULSE(0 5 1m 10u 10u 3m 10m)

* --- Input S2: Optical Load Sensor ---
* Component: Switch/Sensor modeled as Voltage-Controlled Switch
* Wiring: VCC -> S2 -> LOAD_SIGNAL -> R2 -> 0
S2 VCC LOAD_SIGNAL CTRL_LOAD 0 SW_BTN
R2 LOAD_SIGNAL 0 10k
* Stimulus: Simulate sensor active (High) from t=2ms to t=5ms
V_ACT_S2 CTRL_LOAD 0 PULSE(0 5 2m 10u 10u 3m 10m)

* --- Logic U1: 74HC08 Quad AND Gate ---
* Wiring: Pin 14=VCC, Pin 7=0, Pin 1=OP_SIGNAL, Pin 2=LOAD_SIGNAL, Pin 3=LOGIC_OUT
* Decoupling Capacitor C1
C1 VCC 0 100n
* Instantiation of Logic Gate Subcircuit
XU1 OP_SIGNAL LOAD_SIGNAL LOGIC_OUT VCC 0 74HC08_GATE

* --- Driver Stage ---
* Wiring: LOGIC_OUT -> R3 -> Q1 Base
R3 LOGIC_OUT Q1_BASE 1k
* Wiring: Q1 Collector -> Relay Coil, Emitter -> 0
Q1 RELAY_COIL_LOW Q1_BASE 0 2N2222MOD

* --- Relay K1 ---
* Wiring: VCC -> Coil -> Q1 Collector (RELAY_COIL_LOW)
* Coil modeled as Inductance + Resistance
L_K1 VCC K1_INT 10m
R_K1 K1_INT RELAY_COIL_LOW 100

* Flyback Diode D1
* Wiring: Cathode to VCC, Anode to Q1 Collector
D1 RELAY_COIL_LOW VCC 1N4007MOD

* Relay Contact (Switch)
* Wiring: COM (VCC) -> NO (MOTOR_POS)
* Controlled by voltage across the coil: V(VCC) - V(RELAY_COIL_LOW)
* FIXED: Connected negative control node to Ground (0) to fix Singular Matrix error
E_K1_SENSE K1_CTRL_P 0 VOL = 'V(VCC) - V(RELAY_COIL_LOW)'
S_K1 VCC MOTOR_POS K1_CTRL_P 0 SW_RELAY

* --- Motor M1 ---
* Wiring: MOTOR_POS -> Motor -> 0
* Modeled as an inductive load
R_M1 MOTOR_POS M1_INT 10
L_M1 M1_INT 0 1m

* --- Models & Subcircuits ---

* Button/Sensor Switch Model
.model SW_BTN SW(Vt=2.5 Vh=0.1 Ron=0.1 Roff=10Meg)

* Relay Contact Switch Model (Activates when coil voltage > 3.5V)
.model SW_RELAY SW(Vt=3.5 Vh=0.5 Ron=0.05 Roff=100Meg)

* Transistor Model
.model 2N2222MOD NPN(IS=1E-14 BF=200 VAF=100 IKF=0.3 XTB=1.5 BR=3 CJC=8p CJE=25p)

* Diode Model
.model 1N4007MOD D(IS=7n RS=0.03 N=1.2 BV=1000 IBV=5u CJO=10p TT=100n)

* 74HC08 AND Gate Behavioral Model
* Pins: A B Y VCC GND
.subckt 74HC08_GATE A B Y VCC GND
* Continuous Sigmoid function for convergence: 5V * sigmoid(A) * sigmoid(B)
B_AND Y GND V = V(VCC) * (1 / (1 + exp(-50*(V(A)-2.5)))) * (1 / (1 + exp(-50*(V(B)-2.5))))
.ends

* --- Simulation Directives ---
.op
* Transient analysis: 10us step, 8ms total time
.tran 10u 8m
* Print required voltages
.print tran V(OP_SIGNAL) V(LOAD_SIGNAL) V(LOGIC_OUT) V(RELAY_COIL_LOW) V(MOTOR_POS)

.end

Simulation Results (Transient Analysis)

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

Common mistakes and how to avoid them

  • Directly driving the motor: Students often connect the motor directly to the 74HC08 output. The chip can only source ~20mA, while a motor needs hundreds of mA. Solution: Always use a transistor (Q1) and relay interface.
  • Floating Inputs: Forgetting resistors R1 and R2 causes the inputs to «float,» leading to erratic motor behavior triggered by static electricity. Solution: Ensure pull-down resistors are firmly connected to Ground.
  • Missing Flyback Diode: Omitting D1 allows high-voltage spikes from the relay coil to destroy the transistor Q1 when it turns off. Solution: Install D1 in parallel with the coil, cathode pointing to VCC.

Troubleshooting

  • Motor does not run: Check if the relay clicks. If no click, check voltage at U1 Pin 3 (Logic Out). If Logic Out is 5V but relay doesn’t click, check Q1 orientation.
  • Logic Output always High: Check if R1 or R2 are disconnected (floating inputs often read as High in some logic families, though 74HC usually floats random). Verify S1/S2 wiring.
  • Chip gets hot: Check if U1 is wired backwards (Pin 14 must be VCC, Pin 7 GND). Ensure outputs are not shorted to ground.

Possible improvements and extensions

  1. Self-Latching Circuit: Replace the logic with a latch or add a feedback loop so the operator can press a «Start» button once, and the belt keeps running until «Stop» is pressed or the load is removed.
  2. Emergency Stop: Add a 74HC04 NOT gate or use a NAND configuration to include a «Normally Closed» Emergency Stop button that immediately cuts power to the relay regardless of other inputs.

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 74HC08 integrated circuit in this project?




Question 2: Which two conditions must be met simultaneously for the conveyor belt to activate?




Question 3: What component is typically used to simulate the 'Operator Presence' in this type of circuit?




Question 4: What is the specific purpose of the transistor (e.g., 2N2222) in this circuit?




Question 5: What logic level does the 74HC08 output pin produce when both inputs are HIGH?




Question 6: Why are pull-down resistors typically used on the logic gate inputs in this circuit?




Question 7: What is the function of the base resistor connected to the transistor?




Question 8: Which real-world application is explicitly mentioned for this safety interlock circuit?




Question 9: How does this circuit contribute to machine protection?




Question 10: What component would likely simulate the 'Optical Load Sensor' in a basic prototype of this circuit?




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: Temperature and Pressure Monitoring

Temperature and Pressure Monitoring prototype (Maker Style)

Level: Medium. Implement an industrial safety circuit that activates an alarm only when both temperature and pressure sensors exceed critical safety limits.

Objective and use case

In this session, you will build a conditional logic circuit using an LM393 comparator to digitize analog sensor signals and a 74HC08 AND gate to process the safety logic.

  • Industrial Boiler Safety: Prevents catastrophic failure by detecting when a boiler is both overheating and over-pressurized.
  • Hydraulic Systems: Monitors fluid states to prevent pump damage or pipe bursts during high-stress operations.
  • Chemical Reactor Monitoring: Ensures reaction conditions remain within safe zones, triggering emergency cooling only when multiple critical variables spike.

Expected outcome:
* Safe State: LED remains OFF if only one or neither variable exceeds the limit.
* Critical State: Red LED turns ON (Logic High) only when Temp > Limit AND Pressure > Limit.
* Logic Level: The 74HC08 output shifts from ~0V to ~5V.
* Target Audience: Engineering students and hobbyists familiar with operational amplifiers/comparators and basic digital logic.

Materials

  • V1: 5 V DC supply
  • U1: 74HC08, function: Quad 2-Input AND Gate
  • U2: LM393, function: Dual Differential Comparator
  • RT1: 10 kΩ NTC thermistor, function: Temperature sensor
  • R1: 10 kΩ resistor, function: Voltage divider bottom for NTC
  • RP1: 10 kΩ linear potentiometer, function: Pressure sensor simulator
  • RP2: 10 kΩ potentiometer, function: Temperature reference threshold (V_REF_T)
  • RP3: 10 kΩ potentiometer, function: Pressure reference threshold (V_REF_P)
  • R2: 4.7 kΩ resistor, function: Pull-up for Comparator A output (required for LM393)
  • R3: 4.7 kΩ resistor, function: Pull-up for Comparator B output (required for LM393)
  • R4: 330 Ω resistor, function: LED current limiting
  • D1: Red LED, function: Critical Alert indicator

Pin-out of the IC used

Selected Chip: 74HC08 (Quad 2-Input AND Gate)

Pin Name Logic function Connection in this case
1 1A Input A Connected to Temperature Comparator Output
2 1B Input B Connected to Pressure Comparator Output
3 1Y Output Connected to LED (via R4)
7 GND Ground Connected to 0V supply rail
14 VCC Power Supply Connected to +5V supply rail

Note: The LM393 Comparator is also used but the logic decision happens in the 74HC08.

Wiring guide

Construct the circuit using the following node connections:

  • Power Rail: Connect V1 positive terminal to node VCC and negative terminal to node 0 (GND). Connect pin 14 of U1 and pin 8 of U2 to VCC. Connect pin 7 of U1 and pin 4 of U2 to 0.
  • Temperature Sensor Input (V_TEMP): Connect RT1 between VCC and V_TEMP. Connect R1 between V_TEMP and 0. (As Temp rises, resistance drops, V_TEMP rises).
  • Pressure Sensor Input (V_PRESS): Connect the wiper of RP1 to node V_PRESS. Connect the outer legs of RP1 to VCC and 0.
  • Reference Thresholds: Connect the wiper of RP2 to node V_REF_T (Temp Limit). Connect the wiper of RP3 to node V_REF_P (Pressure Limit).
  • Comparator Stage (Digitization):
    • Connect V_TEMP to U2 pin 3 (Non-inverting input A).
    • Connect V_REF_T to U2 pin 2 (Inverting input A).
    • Connect V_PRESS to U2 pin 5 (Non-inverting input B).
    • Connect V_REF_P to U2 pin 6 (Inverting input B).
  • Comparator Outputs (LOGIC_T and LOGIC_P):
    • Connect U2 pin 1 (Output A) to node LOGIC_T. Connect pull-up resistor R2 between LOGIC_T and VCC.
    • Connect U2 pin 7 (Output B) to node LOGIC_P. Connect pull-up resistor R3 between LOGIC_P and VCC.
  • Logic Gate:
    • Connect LOGIC_T to U1 pin 1 (Input 1A).
    • Connect LOGIC_P to U1 pin 2 (Input 1B).
    • Connect U1 pin 3 (Output 1Y) to node ALERT.
  • Indicator: Connect R4 between ALERT and the anode of D1. Connect the cathode of D1 to 0.

Conceptual block diagram

Conceptual block diagram — 74HC08 AND gate

Schematic

[ ANALOG INPUTS ]                  [ COMPARATORS ]                  [ LOGIC GATE ]               [ OUTPUT ]

[ Temp Sensor (RT1/R1) ] --(V_TEMP)---->+------------------+
                                        | U2: Comparator A |
                                        | (LM393)          |--(LOGIC_T)-->+
[ Temp Ref Pot (RP2)   ] --(V_REF_T)--->| w/ Pull-up R2    |              |
                                        +------------------+              |
                                                                          v
                                                                   +----------------+
                                                                   | U1: AND Gate   |
                                                                   | (74HC08)       |--(ALERT)--> [ Resistor R4 ] --> [ LED D1 ] --> GND
                                                                   +----------------+
                                                                          ^
                                        +------------------+              |
[ Press Sensor (RP1)   ] --(V_PRESS)--->| U2: Comparator B |              |
                                        | (LM393)          |--(LOGIC_P)-->+
[ Press Ref Pot (RP3)  ] --(V_REF_P)--->| w/ Pull-up R3    |
                                        +------------------+
Schematic (ASCII)

Truth table

This table represents the logic states at the inputs of the 74HC08 (after the comparator stage) and the final output.

Sensor: Temperature Sensor: Pressure Input 1A (Temp Alert) Input 1B (Press Alert) Output 1Y (System Alarm) LED State
Low (< Ref) Low (< Ref) 0 0 0 OFF
Low (< Ref) High (> Ref) 0 1 0 OFF
High (> Ref) Low (< Ref) 1 0 0 OFF
High (> Ref) High (> Ref) 1 1 1 ON

Measurements and tests

  1. Calibrate Thresholds: Use a voltmeter to set V_REF_T (at RP2 wiper) to 3.0V and V_REF_P (at RP3 wiper) to 3.0V.
  2. Test Temperature Logic: Heat RT1 (or simulate by shorting R1 slightly) until V_TEMP > 3.0V. Measure LOGIC_T; it should be High (~5V). Verify LED is OFF (since Pressure is Low).
  3. Test Pressure Logic: Turn RP1 until V_PRESS > 3.0V. Measure LOGIC_P; it should be High (~5V).
  4. System Alert Test: Create a condition where V_TEMP > 3.0V AND V_PRESS > 3.0V simultaneously.
    • Measure Voltage at ALERT (U1 Pin 3): Expected ~5V.
    • Visual: The Red LED D1 must turn ON.

SPICE netlist and simulation

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

* Practical case: Temperature and Pressure Monitoring

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

* --- Sensors and Inputs ---
* Temperature Sensor (RT1 NTC + R1 Divider)
* RT1: 10 kΩ NTC thermistor (Modeled as R_RT1)
* Connected between VCC and V_TEMP
R_RT1 VCC V_TEMP 10k
* R1: 10 kΩ resistor (Voltage divider bottom)
* Connected between V_TEMP and 0 (GND)
R1 V_TEMP 0 10k

* Pressure Sensor (RP1 Potentiometer)
* RP1: 10 kΩ linear potentiometer
* Modeled as two resistors (Top/Bot) representing the wiper position.
* Outer legs to VCC and 0, wiper to V_PRESS.
R_RP1_TOP VCC V_PRESS 5k
R_RP1_BOT V_PRESS 0 5k

* --- Dynamic Stimuli (Simulation) ---
* These voltage sources drive the sensor nodes to simulate physical changes
* over time, verifying the logic thresholds (sweeping 1V to 4V).
* They effectively override the static resistor dividers for transient analysis.
V_TEMP_STIM V_TEMP 0 PULSE(1 4 0.5m 100u 100u 1m 3m)
V_PRESS_STIM V_PRESS 0 PULSE(1 4 1m 100u 100u 1.5m 4m)

* --- Reference Thresholds ---
* ... (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: Temperature and Pressure Monitoring

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

* --- Sensors and Inputs ---
* Temperature Sensor (RT1 NTC + R1 Divider)
* RT1: 10 kΩ NTC thermistor (Modeled as R_RT1)
* Connected between VCC and V_TEMP
R_RT1 VCC V_TEMP 10k
* R1: 10 kΩ resistor (Voltage divider bottom)
* Connected between V_TEMP and 0 (GND)
R1 V_TEMP 0 10k

* Pressure Sensor (RP1 Potentiometer)
* RP1: 10 kΩ linear potentiometer
* Modeled as two resistors (Top/Bot) representing the wiper position.
* Outer legs to VCC and 0, wiper to V_PRESS.
R_RP1_TOP VCC V_PRESS 5k
R_RP1_BOT V_PRESS 0 5k

* --- Dynamic Stimuli (Simulation) ---
* These voltage sources drive the sensor nodes to simulate physical changes
* over time, verifying the logic thresholds (sweeping 1V to 4V).
* They effectively override the static resistor dividers for transient analysis.
V_TEMP_STIM V_TEMP 0 PULSE(1 4 0.5m 100u 100u 1m 3m)
V_PRESS_STIM V_PRESS 0 PULSE(1 4 1m 100u 100u 1.5m 4m)

* --- Reference Thresholds ---
* RP2: 10 kΩ potentiometer (Temperature Reference)
* Configured as divider, wiper to V_REF_T. Set to ~2.5V.
R_RP2_TOP VCC V_REF_T 5k
R_RP2_BOT V_REF_T 0 5k

* RP3: 10 kΩ potentiometer (Pressure Reference)
* Configured as divider, wiper to V_REF_P. Set to ~2.5V.
R_RP3_TOP VCC V_REF_P 5k
R_RP3_BOT V_REF_P 0 5k

* --- Comparator Stage (U2: LM393) ---
* U2: Dual Differential Comparator
* Connections based on Wiring Guide:
*   Comp A (Temp): In+ (3)=V_TEMP, In- (2)=V_REF_T, Out (1)=LOGIC_T
*   Comp B (Press): In+ (5)=V_PRESS, In- (6)=V_REF_P, Out (7)=LOGIC_P
*   Power: VCC (8), GND (4)
XU2 LOGIC_T V_REF_T V_TEMP 0 V_PRESS V_REF_P LOGIC_P VCC LM393

* Pull-up resistors (Required for Open Collector Outputs)
* R2: 4.7 kΩ pull-up for Comparator A
R2 VCC LOGIC_T 4.7k
* R3: 4.7 kΩ pull-up for Comparator B
R3 VCC LOGIC_P 4.7k

* --- Logic Stage (U1: 74HC08) ---
* U1: Quad 2-Input AND Gate
* Connections:
*   Gate 1: Input 1A (1)=LOGIC_T, Input 1B (2)=LOGIC_P, Output 1Y (3)=ALERT
*   Power: VCC (14), GND (7)
*   Unused inputs (4,5,9,10,12,13) connected to 0 (GND) to prevent floating.
XU1 LOGIC_T LOGIC_P ALERT 0 0 0 0 0 0 0 0 0 0 VCC 74HC08

* --- Indicator ---
* R4: 330 Ω resistor (LED current limiting)
R4 ALERT LED_A 330
* D1: Red LED (Cathode to GND)
D1 LED_A 0 DLED

* --- Models and Subcircuits ---

* LED Model
.model DLED D(IS=1e-14 N=1.7 RS=10)

* LM393 Subcircuit (Behavioral Open Collector)
.subckt LM393 1 2 3 4 5 6 7 8
* Pinout: 1=OutA, 2=InA-, 3=InA+, 4=GND, 5=InB+, 6=InB-, 7=OutB, 8=VCC
* Logic: If In+ > In-, Output is High-Z (Pull-up High).
*        If In+ < In-, Output is Low (GND).
* Implementation uses Voltage Controlled Switch to GND.
* Control V = In(-) - In(+). If V > 0 (In- > In+), Switch Closed (Low).
B_A_CTRL 10 0 V = V(2) - V(3)
S_A 1 4 10 0 SW_OC
B_B_CTRL 20 0 V = V(6) - V(5)
S_B 7 4 20 0 SW_OC
.model SW_OC SW(Vt=0 Vh=1m Ron=10 Roff=100Meg)
.ends LM393

* 74HC08 Subcircuit (Behavioral AND Gate)
.subckt 74HC08 1 2 3 4 5 6 7 8 9 10 11 12 13 14
* Pinout: 1=1A, 2=1B, 3=1Y, 7=GND, 14=VCC ...
* Gate 1 Logic: Output High (VCC) if V(1)>2.5 and V(2)>2.5
B_Y1 3 7 V = V(14) * (1 / (1 + exp(-50*(V(1)-2.5)))) * (1 / (1 + exp(-50*(V(2)-2.5))))
.ends 74HC08

* --- Simulation Directives ---
.tran 10u 5ms
.print tran V(V_TEMP) V(V_PRESS) V(LOGIC_T) V(LOGIC_P) V(ALERT)

.end

Simulation Results (Transient Analysis)

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

Common mistakes and how to avoid them

  1. Missing Pull-up Resistors on Comparators: The LM393 has open-collector outputs. If you omit R2 and R3, the inputs to the 74HC08 will float or remain low, preventing the circuit from working. Solution: Always install pull-ups (4.7kΩ to 10kΩ) from the output pin to VCC.
  2. Incorrect NTC Wiring: Connecting the NTC to ground and the fixed resistor to VCC creates a voltage that drops as temperature rises. Solution: Connect the NTC to VCC and the fixed resistor to Ground to ensure voltage increases with temperature, matching the non-inverting comparator logic.
  3. Floating Inputs on 74HC08: Leaving unused inputs on the logic chip connected to nothing can cause noise and higher power consumption. Solution: Connect unused inputs (e.g., pins 4, 5, 9, 10, 12, 13) to GND.

Troubleshooting

  • LED never turns ON: Check if R2 or R3 are missing. Without them, the AND gate inputs see Logic 0. Verify the orientation of the LED.
  • LED is always ON: Check RP2 and RP3. If the reference voltage is set to 0V, the sensors will always appear «High» relative to the reference.
  • Erratic/Flickering LED: The voltage at the comparator inputs might be hovering exactly at the threshold. This creates noise. Adding a hysteresis feedback resistor can solve this, but ensuring clean power connections usually suffices for basic tests.

Possible improvements and extensions

  1. Add Hysteresis: Connect a high-value resistor (e.g., 100kΩ) between the comparator output and the non-inverting input. This prevents the «chattering» effect when sensor values hover near the threshold.
  2. Audible Alarm: Connect a buzzer with a transistor driver (like a 2N2222) to the output of the 74HC08 alongside the LED for an audible warning in a noisy industrial environment.

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 LM393 component in this circuit?




Question 2: Which logic gate is used to process the safety logic ensuring both conditions must be met?




Question 3: Under what condition will the Red LED turn ON (Critical State)?




Question 4: What is the expected voltage level of the 74HC08 output in the 'Critical State'?




Question 5: Which of the following is listed as a specific use case for this circuit?




Question 6: What state is the LED in if only the temperature exceeds the critical limit but pressure does not?




Question 7: What is the primary purpose of this industrial safety circuit?




Question 8: In the context of Hydraulic Systems, what does this circuit help prevent?




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




Question 10: What logic level represents the 'Critical State' at the 74HC08 output?




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: Vehicle access control with barrier

Vehicle access control with barrier prototype (Maker Style)

Level: Medium — Design a safety logic circuit that lifts a barrier only when vehicle presence and valid ticket verification occur simultaneously.

Objective and use case

In this practical case, you will build a digital control circuit using a 74HC08 AND gate to simulate the logic of an automated parking barrier. The barrier (represented by an LED) will only activate when a vehicle presence sensor and a ticket validation system trigger simultaneously.

Why it is useful:
* Parking lots: Ensures the gate does not open for pedestrians or if a ticket is invalid.
* Toll booths: Synchronizes payment confirmation with physical vehicle presence.
* Industrial safety: Prevents machinery operation unless a guard is in place and a start command is issued.
* Secure access: Requires dual authentication factors in physical security systems.

Expected outcome:
* State 0 (Rest): LED remains OFF when no buttons are pressed (0 V output).
* State 1 (Partial): LED remains OFF if only the vehicle is detected or only the ticket is validated.
* State 2 (Active): LED turns ON (approx. 5 V / High logic) ONLY when both inputs are active simultaneously.
* Logic Verification: Confirmation of the standard Boolean AND operation ($Y = A \cdot B$).

Target audience and level: Electronics students and hobbyists / Medium.

Materials

  • V1: 5 V DC power supply, function: Main circuit power
  • U1: 74HC08, function: Quad 2-Input AND Gate IC
  • S1: Push-button (NO), function: Simulates «Vehicle Presence Sensor»
  • S2: Push-button (NO), function: Simulates «Ticket Validation Signal»
  • R1: 10 kΩ resistor, function: Pull-down for Vehicle input
  • R2: 10 kΩ resistor, function: Pull-down for Ticket input
  • R3: 330 Ω resistor, function: LED current limiting
  • D1: Green LED, function: Simulates «Barrier Motor/Open Signal»
  • Breadboard and jumper wires

Pin-out of the IC used

Chip: 74HC08 (Quad 2-Input AND Gate)

Pin Name Logic function Connection in this case
1 1A Input A Connected to Vehicle Sensor (S1)
2 1B Input B Connected to Ticket Validator (S2)
3 1Y Output Connected to Barrier Indicator (LED)
7 GND Ground Connected to Supply Ground (0 V)
14 VCC Power Supply Connected to +5 V Supply

Note: Pins 4, 5, 6, 8, 9, 10, 11, 12, and 13 are unused in this specific circuit.

Wiring guide

  • Power Supply:
    • V1 (+) connects to node VCC.
    • V1 (-) connects to node 0 (GND).
  • IC Power:
    • U1 Pin 14 connects to node VCC.
    • U1 Pin 7 connects to node 0.
  • Input Stage (Vehicle Sensor):
    • S1 connects between node VCC and node VEHICLE_IN.
    • R1 connects between node VEHICLE_IN and node 0 (active-high configuration).
    • U1 Pin 1 connects to node VEHICLE_IN.
  • Input Stage (Ticket Validator):
    • S2 connects between node VCC and node TICKET_IN.
    • R2 connects between node TICKET_IN and node 0 (active-high configuration).
    • U1 Pin 2 connects to node TICKET_IN.
  • Output Stage (Barrier Actuator):
    • U1 Pin 3 connects to node LOGIC_OUT.
    • R3 connects between node LOGIC_OUT and node LED_ANODE.
    • D1 (Anode) connects to node LED_ANODE.
    • D1 (Cathode) connects to node 0.

Conceptual block diagram

Conceptual block diagram — 74HC08 AND gate

Schematic

[ INPUT SENSORS ]                     [ LOGIC PROCESSING ]                  [ ACTUATOR OUTPUT ]

 [ VCC ]
    |
 [ S1: Vehicle ]
    |
    +----(Node: VEHICLE_IN)----(Pin 1)-->+----------------------+
    |                                    |                      |
 [ R1: 10k ]                             |      U1: 74HC08      |
    |                                    |      (AND Gate)      |
 [ GND ]                                 |                      |--(Pin 3)--> [ R3: 330 ] --> [ D1: Green LED ] --> [ GND ]
                                         |  (Pin 14: VCC)       |
 [ VCC ]                                 |  (Pin 7:  GND)       |
    |                                    |                      |
 [ S2: Ticket ]                          |                      |
    |                                    |                      |
    +----(Node: TICKET_IN)-----(Pin 2)-->+----------------------+
    |
 [ R2: 10k ]
    |
 [ GND ]
Schematic (ASCII)

Truth table

The 74HC08 follows the standard AND logic verification:

Vehicle Detected (S1) Ticket Validated (S2) Output Voltage (Pin 3) Barrier State (LED)
Low (0) Low (0) ~0 V Closed (OFF)
Low (0) High (1) ~0 V Closed (OFF)
High (1) Low (0) ~0 V Closed (OFF)
High (1) High (1) ~5 V Open (ON)

Measurements and tests

  1. Idle Check: Ensure neither S1 nor S2 is pressed. Measure voltage at U1 Pin 1 and Pin 2 relative to GND. It should read 0 V (Logic Low). The LED must be OFF.
  2. Single Input Test: Press S1 (Vehicle) only. Measure voltage at Pin 1 (5 V) and Pin 3 (0 V). LED must remain OFF. Repeat for S2 (Ticket).
  3. Activation Test: Press both S1 and S2 simultaneously. Measure voltage at U1 Pin 3. It should read close to 5 V (Logic High).
  4. Load Check: Observe the LED turning ON brightly when both buttons are held. This confirms the barrier would lift.

SPICE netlist and simulation

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

* TITLE: Practical case: Vehicle access control with barrier
* Ngspice Netlist
* Implements a 74HC08 AND gate circuit with push-button inputs and LED output

* --- Component Models ---
* Switch Model: Voltage Controlled Switch for Push-buttons
* Vt=2.5V (Threshold), Ron=1 ohm (Closed), Roff=100Meg (Open)
.model SW_PUSH SW(Vt=2.5 Ron=1 Roff=100Meg)

* LED Model: Generic Green LED
.model D_GREEN D(Is=1e-22 Rs=5 N=1.5 Cjo=10p BV=5)

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

* --- Dynamic Stimuli (User Button Presses) ---
* These sources actuate the switches S1 and S2 to simulate user interaction.
* They are not part of the physical circuit but provide the mechanical "push".
* Sequence designed to test Truth Table: 00 -> 10 -> 01 -> 11
* Time unit: microseconds (us)

* S1 Actuator (Vehicle Sensor): Toggles every 200us (starts at 100us)
V_ACT_S1 S1_CTRL 0 PULSE(0 5 100u 1u 1u 100u 200u)

* S2 Actuator (Ticket Validator): Toggles every 400us (starts at 200us)
V_ACT_S2 S2_CTRL 0 PULSE(0 5 200u 1u 1u 200u 400u)

* --- Input Stage: Vehicle Sensor ---
* S1: Push-button connecting VCC to VEHICLE_IN when pressed
* ... (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.

* TITLE: Practical case: Vehicle access control with barrier
* Ngspice Netlist
* Implements a 74HC08 AND gate circuit with push-button inputs and LED output

* --- Component Models ---
* Switch Model: Voltage Controlled Switch for Push-buttons
* Vt=2.5V (Threshold), Ron=1 ohm (Closed), Roff=100Meg (Open)
.model SW_PUSH SW(Vt=2.5 Ron=1 Roff=100Meg)

* LED Model: Generic Green LED
.model D_GREEN D(Is=1e-22 Rs=5 N=1.5 Cjo=10p BV=5)

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

* --- Dynamic Stimuli (User Button Presses) ---
* These sources actuate the switches S1 and S2 to simulate user interaction.
* They are not part of the physical circuit but provide the mechanical "push".
* Sequence designed to test Truth Table: 00 -> 10 -> 01 -> 11
* Time unit: microseconds (us)

* S1 Actuator (Vehicle Sensor): Toggles every 200us (starts at 100us)
V_ACT_S1 S1_CTRL 0 PULSE(0 5 100u 1u 1u 100u 200u)

* S2 Actuator (Ticket Validator): Toggles every 400us (starts at 200us)
V_ACT_S2 S2_CTRL 0 PULSE(0 5 200u 1u 1u 200u 400u)

* --- Input Stage: Vehicle Sensor ---
* S1: Push-button connecting VCC to VEHICLE_IN when pressed
S1 VCC VEHICLE_IN S1_CTRL 0 SW_PUSH
* R1: 10k Pull-down resistor for Vehicle input
R1 VEHICLE_IN 0 10k

* --- Input Stage: Ticket Validator ---
* S2: Push-button connecting VCC to TICKET_IN when pressed
S2 VCC TICKET_IN S2_CTRL 0 SW_PUSH
* R2: 10k Pull-down resistor for Ticket input
R2 TICKET_IN 0 10k

* --- Logic Stage: U1 (74HC08 Quad 2-Input AND Gate) ---
* Subcircuit representing one gate of the 74HC08 IC
* Pins mapped: 1(A), 2(B), 3(Y), 7(GND), 14(VCC)
.subckt 74HC08_GATE PIN1 PIN2 PIN3 PIN7 PIN14
    * Behavioral AND logic using continuous sigmoid functions for convergence
    * Y = VCC if (A > 2.5V) AND (B > 2.5V)
    B_LOGIC PIN3 PIN7 V = V(PIN14) * (1 / (1 + exp(-50*(V(PIN1)-2.5)))) * (1 / (1 + exp(-50*(V(PIN2)-2.5))))
.ends

* Instantiate U1 connected according to Wiring Guide
* Pin 1->VEHICLE_IN, Pin 2->TICKET_IN, Pin 3->LOGIC_OUT, Pin 7->0, Pin 14->VCC
XU1 VEHICLE_IN TICKET_IN LOGIC_OUT 0 VCC 74HC08_GATE

* --- Output Stage: Barrier Actuator ---
* R3: 330 ohm current limiting resistor
R3 LOGIC_OUT LED_ANODE 330
* D1: Green LED (Anode to R3, Cathode to GND)
D1 LED_ANODE 0 D_GREEN

* --- Simulation Directives ---
* Transient analysis for 500us to capture full sequence
.tran 1u 500u
.op

* Print signals to verify logic: 
* Expect LOGIC_OUT to be High (~5V) only when both Inputs are High (300us-400us)
.print tran V(VEHICLE_IN) V(TICKET_IN) V(LOGIC_OUT) V(LED_ANODE)

.end

Simulation Results (Transient Analysis)

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

Common mistakes and how to avoid them

  1. Floating Inputs: Failing to include resistors R1 and R2 causes the inputs to «float,» leading to erratic LED flickering even when buttons are not pressed. Always use pull-down resistors with 74HC series logic.
  2. Missing Power Connections: Forgetting to connect Pin 14 (VCC) and Pin 7 (GND) is a classic error. Logic chips will not function without power, even if inputs are wired correctly.
  3. LED Without Resistor: Connecting the LED directly to the logic output (Pin 3) without R3 can damage the LED or the 74HC08 output stage due to excessive current.

Troubleshooting

  • Symptom: The LED is always ON, even when buttons are released.
    • Cause: Missing pull-down resistors or inputs connected directly to VCC.
    • Fix: Ensure R1 and R2 are installed correctly between the inputs and GND.
  • Symptom: The LED does not light up when both buttons are pressed.
    • Cause: LED polarity reversed or IC not powered.
    • Fix: Check D1 orientation (flat side is cathode/GND) and measure 5 V across Pins 14 and 7.
  • Symptom: LED is very dim when active.
    • Cause: Current limiting resistor (R3) value is too high.
    • Fix: Ensure R3 is 330 Ω (orange-orange-brown). If it is 10 kΩ or higher, the LED will be barely visible.

Possible improvements and extensions

  1. Emergency Stop: Introduce a third input using a 3-input AND gate (74HC11) or cascading another 74HC08 gate, connected to a «Stop» switch that overrides the open command.
  2. Motor Driver Interface: Replace the LED with an NPN transistor (e.g., 2N2222) and a relay to drive a real DC motor or solenoid, simulating a heavy-duty barrier mechanism.

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 specific logic gate IC is utilized to control the barrier's logic?




Question 3: Under which specific condition will the LED (representing the barrier) turn ON?




Question 4: What is the role of the pull-down resistors (typically 10 kΩ) connected to the inputs?




Question 5: What voltage level corresponds to the 'Active' state (State 2) where the LED is ON?




Question 6: Which Boolean logic expression represents the operation of this circuit?




Question 7: Which component is typically used in this simulation to represent the 'Vehicle Presence Sensor'?




Question 8: How does this logic apply to industrial safety scenarios?




Question 9: What is the status of the LED during 'State 1 (Partial)'?




Question 10: What is the purpose of the current-limiting resistor (e.g., 330 Ω) connected to the LED?




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: Conditional automatic irrigation system

Conditional automatic irrigation system prototype (Maker Style)

Level: Basic – Build a logic circuit to activate a pump only when soil is dry and water is available.

Objective and use case

In this practical case, you will build a safety interlock circuit using a 74HC08 AND gate. The circuit simulates a smart irrigation controller that decides whether to turn on a water pump based on two environmental conditions.

Why this is useful:
* Equipment Protection: Prevents pumps from running «dry» (without water input), which often causes mechanical failure.
* Resource Conservation: Ensures water is only dispensed when the soil actually needs moisture.
* Industrial Logic: Demonstrates the fundamental «safety interlock» concept used in heavy machinery (e.g., machine runs ONLY if guard is closed AND operator presses button).
* Digital Logic Basics: Provides a clear physical representation of the Boolean AND function ($Y = A \cdot B$).

Expected outcome:
* The Output LED (Pump) turns ON only when Switch A (Soil Sensor) is HIGH AND Switch B (Tank Sensor) is HIGH.
* If the Tank is Empty (Switch B = LOW), the pump remains OFF even if the soil is dry.
* Logic 0: Voltage $\approx$ 0 V. Logic 1: Voltage $\approx$ 5 V.

Target audience: Electronic students and hobbyists at a basic level.

Materials

  • U1: 74HC08, function: Quad 2-Input AND Gate IC.
  • S1: SPST Switch, function: Soil Moisture Sensor simulation (Closed = Dry/Logic 1).
  • S2: SPST Switch, function: Water Tank Level simulation (Closed = Water Present/Logic 1).
  • R1: 10 kΩ resistor, function: pull-down for Input A.
  • R2: 10 kΩ resistor, function: pull-down for Input B.
  • R3: 330 Ω resistor, function: LED current limiting.
  • D1: Green LED, function: Water Pump active indicator.
  • V1: 5 V DC supply, function: Main power source.

Pin-out of the IC: 74HC08

The 74HC08 contains four independent AND gates. We will use only one of them for this experiment.

Pin Name Logic Function Connection in this case
1 1A Input A Connected to S1 (Soil Status)
2 1B Input B Connected to S2 (Tank Status)
3 1Y Output Y Connected to LED (Pump indicator)
7 GND Ground Connected to Power Supply Ground (0V)
14 VCC Power Supply Connected to +5V Source

Wiring guide

Follow these connections carefully. The node names correspond to the function of the wire in the circuit.

  • V1 connects between node VCC and node 0 (GND).
  • U1 (Pin 14) connects to node VCC.
  • U1 (Pin 7) connects to node 0 (GND).
  • S1 connects between node VCC and node SOIL_Status.
  • R1 connects between node SOIL_Status and node 0 (GND) (Keeps input Low when switch is open).
  • S2 connects between node VCC and node TANK_Status.
  • R2 connects between node TANK_Status and node 0 (GND) (Keeps input Low when switch is open).
  • U1 (Pin 1, Input A) connects to node SOIL_Status.
  • U1 (Pin 2, Input B) connects to node TANK_Status.
  • U1 (Pin 3, Output Y) connects to node PUMP_Cmd.
  • R3 connects between node PUMP_Cmd and node LED_Anode.
  • D1 connects between node LED_Anode (Anode) and node 0 (GND) (Cathode).

Conceptual block diagram

Conceptual block diagram — 74HC08 AND gate

Schematic

[ INPUTS ]                                  [ LOGIC ]                             [ OUTPUT ]

[ S1: Soil Sensor ]
[ (Switch to VCC) ] --(Node: SOIL_Status)-->+---------------------+
[ (R1: 10k to GND)]                         |      U1: 74HC08     |
                                            |      (AND Gate)     |
                                            |                     |--(Node: PUMP_Cmd)--> [ R3: 330 Ohm ] --> [ D1: Green LED ] --> GND
                                            |   Pin 1 (Input A)   |                      (Current Lim.)      (Pump Active)
                                            |                     |
                                            |   Pin 2 (Input B)   |
[ S2: Tank Level  ] --(Node: TANK_Status)-->|                     |
[ (Switch to VCC) ]                         +---------------------+
[ (R2: 10k to GND)]
Schematic (ASCII)

Truth table

This table defines the logic states.
0 = Switch Open / 0V / Wet Soil / Empty Tank / Pump OFF
1 = Switch Closed / 5V / Dry Soil / Full Tank / Pump ON

Soil Status (A) Tank Status (B) Output Pump (Y) Real-world State
0 0 0 Soil wet, Tank empty -> Standby
0 1 0 Soil wet, Tank full -> Standby
1 0 0 Soil dry, Tank empty -> Safety Cutoff (Protect Pump)
1 1 1 Soil dry, Tank full -> Irrigation Active

Measurements and tests

Validate your circuit using a multimeter set to DC Voltage (20V range).

  1. Standby Check: Ensure both S1 and S2 are Open (OFF). Measure voltage at Pin 3 of U1.
    • Expected: ~0 V. D1 is OFF.
  2. Dry Run Protection Test: Close S1 (Soil is Dry) but leave S2 Open (Tank Empty).
    • Expected: Pin 1 reads 5 V, Pin 2 reads 0 V. Output Pin 3 must remain at 0 V. D1 is OFF.
  3. No Demand Test: Open S1 (Soil Wet) and Close S2 (Tank Full).
    • Expected: Pin 1 reads 0 V, Pin 2 reads 5 V. Output Pin 3 must remain at 0 V. D1 is OFF.
  4. Active Irrigation Test: Close both S1 and S2.
    • Expected: Pin 1 reads 5 V, Pin 2 reads 5 V. Output Pin 3 should read ~5 V (Logic High). D1 lights up Green.

SPICE netlist and simulation

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

* Title: Practical case: Conditional automatic irrigation system

* -----------------------------------------------------------------------------
* POWER SUPPLY
* -----------------------------------------------------------------------------
* V1: 5V DC supply, function: Main power source.
V1 VCC 0 DC 5

* -----------------------------------------------------------------------------
* STIMULI GENERATION (Simulating User Interaction)
* -----------------------------------------------------------------------------
* These voltage sources drive the control pins of the ideal switches (S1, S2)
* to simulate the physical sensors changing state over time.
* They are not part of the BOM but are necessary for dynamic simulation.

* Control signal for S1 (Soil Sensor): Period 200us
* Logic: 0 -> 1 -> 0 -> 1
V_CTRL_S1 N_CTRL_S1 0 PULSE(0 5 10u 1u 1u 100u 200u)

* Control signal for S2 (Tank Sensor): Period 400us
* Logic: 0 -> 0 -> 1 -> 1
V_CTRL_S2 N_CTRL_S2 0 PULSE(0 5 10u 1u 1u 200u 400u)

* -----------------------------------------------------------------------------
* INPUT STAGE (Sensors and Pull-downs)
* -----------------------------------------------------------------------------
* S1: SPST Switch, function: Soil Moisture Sensor simulation.
* Wiring: Connects between node VCC and node SOIL_Status.
* Logic: Closed (Controlled by V_CTRL_S1 High) = Dry/Logic 1.
S1 VCC SOIL_Status N_CTRL_S1 0 SW_IDEAL
* ... (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.

* Title: Practical case: Conditional automatic irrigation system

* -----------------------------------------------------------------------------
* POWER SUPPLY
* -----------------------------------------------------------------------------
* V1: 5V DC supply, function: Main power source.
V1 VCC 0 DC 5

* -----------------------------------------------------------------------------
* STIMULI GENERATION (Simulating User Interaction)
* -----------------------------------------------------------------------------
* These voltage sources drive the control pins of the ideal switches (S1, S2)
* to simulate the physical sensors changing state over time.
* They are not part of the BOM but are necessary for dynamic simulation.

* Control signal for S1 (Soil Sensor): Period 200us
* Logic: 0 -> 1 -> 0 -> 1
V_CTRL_S1 N_CTRL_S1 0 PULSE(0 5 10u 1u 1u 100u 200u)

* Control signal for S2 (Tank Sensor): Period 400us
* Logic: 0 -> 0 -> 1 -> 1
V_CTRL_S2 N_CTRL_S2 0 PULSE(0 5 10u 1u 1u 200u 400u)

* -----------------------------------------------------------------------------
* INPUT STAGE (Sensors and Pull-downs)
* -----------------------------------------------------------------------------
* S1: SPST Switch, function: Soil Moisture Sensor simulation.
* Wiring: Connects between node VCC and node SOIL_Status.
* Logic: Closed (Controlled by V_CTRL_S1 High) = Dry/Logic 1.
S1 VCC SOIL_Status N_CTRL_S1 0 SW_IDEAL

* R1: 10 kΩ resistor, function: pull-down for Input A.
* Wiring: Connects between node SOIL_Status and node 0 (GND).
R1 SOIL_Status 0 10k

* S2: SPST Switch, function: Water Tank Level simulation.
* Wiring: Connects between node VCC and node TANK_Status.
* Logic: Closed (Controlled by V_CTRL_S2 High) = Water Present/Logic 1.
S2 VCC TANK_Status N_CTRL_S2 0 SW_IDEAL

* R2: 10 kΩ resistor, function: pull-down for Input B.
* Wiring: Connects between node TANK_Status and node 0 (GND).
R2 TANK_Status 0 10k

* -----------------------------------------------------------------------------
* LOGIC STAGE (74HC08 Quad 2-Input AND Gate)
* -----------------------------------------------------------------------------
* U1: 74HC08
* Wiring Guide:
* - Pin 1 (Input A) -> SOIL_Status
* - Pin 2 (Input B) -> TANK_Status
* - Pin 3 (Output Y) -> PUMP_Cmd
* - Pin 7 -> GND (0)
* - Pin 14 -> VCC
* Implemented as a subcircuit to strictly expose pins as nodes.
XU1 SOIL_Status TANK_Status PUMP_Cmd 0 VCC 74HC08_Behavioral

* -----------------------------------------------------------------------------
* OUTPUT STAGE (Indicator)
* -----------------------------------------------------------------------------
* R3: 330 Ω resistor, function: LED current limiting.
* Wiring: Connects between node PUMP_Cmd and node LED_Anode.
R3 PUMP_Cmd LED_Anode 330

* D1: Green LED, function: Water Pump active indicator.
* Wiring: Connects between node LED_Anode (Anode) and node 0 (GND).
D1 LED_Anode 0 LED_Green

* -----------------------------------------------------------------------------
* MODELS & SUBCIRCUITS
* -----------------------------------------------------------------------------
* Switch Model: Low On-Resistance, High Off-Resistance, Threshold 2.5V
.model SW_IDEAL SW(Vt=2.5 Ron=0.1 Roff=100Meg)

* LED Model: Generic Green LED approximation
.model LED_Green D(IS=1e-22 N=1.5 RS=5 BV=5 IBV=10u)

* 74HC08 Subcircuit (Behavioral Implementation)
* Pinout: 1=A, 2=B, 3=Y, 7=GND, 14=VCC
.subckt 74HC08_Behavioral 1 2 3 7 14
* Logic Y = A AND B
* Implementation: Continuous sigmoid function for robust convergence.
* Output voltage swings to V(14) (VCC) when both inputs > 2.5V.
B_AND 3 7 V = V(14,7) * (1 / (1 + exp(-40 * (V(1,7) - 2.5)))) * (1 / (1 + exp(-40 * (V(2,7) - 2.5))))
.ends

* -----------------------------------------------------------------------------
* ANALYSIS COMMANDS
* -----------------------------------------------------------------------------
* Transient analysis: 500us duration to capture all logic states (00, 10, 01, 11)
.tran 1u 500u

* Print critical nodes for verification
.print tran V(SOIL_Status) V(TANK_Status) V(PUMP_Cmd) V(LED_Anode)

* Calculate DC operating point
.op

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (1202 rows)
Index   time            v(soil_status)  v(tank_status)  v(pump_cmd)
0	0.000000e+00	4.999500e-04	4.999500e-04	7.201843e-87
1	1.000000e-08	4.999500e-04	4.999500e-04	7.201843e-87
2	2.000000e-08	4.999500e-04	4.999500e-04	7.201843e-87
3	4.000000e-08	4.999500e-04	4.999500e-04	7.201843e-87
4	8.000000e-08	4.999500e-04	4.999500e-04	7.201843e-87
5	1.600000e-07	4.999500e-04	4.999500e-04	7.201843e-87
6	3.200000e-07	4.999500e-04	4.999500e-04	7.201843e-87
7	6.400000e-07	4.999500e-04	4.999500e-04	7.201843e-87
8	1.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
9	2.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
10	3.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
11	4.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
12	5.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
13	6.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
14	7.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
15	8.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
16	9.280000e-06	4.999500e-04	4.999500e-04	7.201843e-87
17	1.000000e-05	4.999500e-04	4.999500e-04	7.201843e-87
18	1.010000e-05	4.999500e-04	4.999500e-04	7.201843e-87
19	1.026000e-05	4.999500e-04	4.999500e-04	7.201843e-87
20	1.030750e-05	4.999500e-04	4.999500e-04	7.201843e-87
21	1.039062e-05	4.999500e-04	4.999500e-04	7.201843e-87
22	1.041363e-05	4.999500e-04	4.999500e-04	7.201843e-87
23	1.045390e-05	4.999500e-04	4.999500e-04	7.201843e-87
... (1178 more rows) ...

Common mistakes and how to avoid them

  • Floating Inputs: Forgetting R1 or R2 causes the inputs to «float,» making the LED flicker or turn on randomly when switches are open. Solution: Always verify pull-down resistors are connected to Ground.
  • LED Orientation: Placing the LED backwards prevents it from lighting up even when logic is correct. Solution: Ensure the longer leg (Anode) faces the resistor and the IC.
  • Confusing Chips: Using a 74HC32 (OR gate) instead of 74HC08 (AND gate). Solution: Read the text printed on the top of the IC before insertion. If it behaves like «Pump on if EITHER condition is met,» you have the wrong chip.

Troubleshooting

  • Symptom: LED is always ON, regardless of switches.
    • Cause: Inputs might be shorted directly to VCC, or the IC is damaged.
    • Fix: Check wiring at Pin 1 and 2. Ensure R1 and R2 go to Ground, not VCC.
  • Symptom: LED is very dim when active.
    • Cause: R3 value is too high.
    • Fix: Replace R3 with a value between 220 Ω and 470 Ω.
  • Symptom: Circuit works inversely (LED off when switches are closed).
    • Cause: You might be using a NAND gate (like 74HC00) or connected the LED to VCC instead of Ground (sourcing vs sinking).
    • Fix: Verify part number is 74HC08 and LED Cathode is at Ground.

Possible improvements and extensions

  1. High Power Interface: Replace the LED with an NPN transistor (e.g., 2N2222) and a relay to control a real 12V water pump.
  2. Manual Override: Add a third switch connected to an OR gate after the AND gate output, allowing a user to force the pump ON regardless of sensors.

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 74HC08 IC used in this circuit?




Question 2: What real-world device does the circuit simulate?




Question 3: Under what specific condition will the Output LED (Pump) turn ON?




Question 4: What is the main purpose of the 'safety interlock' concept demonstrated here?




Question 5: What does Switch A (Soil Sensor) represent in the logic of this project?




Question 6: What is the function of the 10 kΩ resistors (R1 and R2) connected to the switches?




Question 7: If the Water Tank is Empty (Switch B = LOW), what is the state of the pump?




Question 8: What voltage level corresponds to Logic 1 in this circuit?




Question 9: What does the Output LED visually indicate when it is lit?




Question 10: Which Boolean algebraic expression represents the logic of this circuit?




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: Dual sensor alarm activation

Dual sensor alarm activation prototype (Maker Style)

Level: Basic. Implement a logic circuit where an alarm sounds only if two distinct sensors are activated simultaneously.

Objective and use case

In this tutorial, you will build a security logic circuit using a 74HC08 (AND gate) integrated circuit. The circuit processes signals from two independent switches (simulating a door and a window sensor) and activates an output LED only when both switches are closed at the same time.

Why it is useful:
* Safety Interlocks: Ensures machinery operates only when an operator presses two buttons simultaneously, keeping both hands away from danger.
* Security Systems: Triggers a specific high-priority alarm only when multiple zones are breached simultaneously.
* Data Validation: Logic gates are fundamental for validating that two necessary conditions (e.g., «System Ready» AND «Start Command») are met before executing an action.

Expected outcome:
* Input A (Low) + Input B (Low): LED remains OFF (0 V output).
* Input A (High) + Input B (Low): LED remains OFF (0 V output).
* Input A (Low) + Input B (High): LED remains OFF (0 V output).
* Input A (High) + Input B (High): LED turns ON (~5 V output).
* Target audience: Electronics students and hobbyists getting started with digital logic.

Materials

  • V1: 5 V DC supply, function: Main power source.
  • S1: SPST Switch, function: Sensor A (Door).
  • S2: SPST Switch, function: Sensor B (Window).
  • R1: 10 kΩ resistor, function: Pull-down for Sensor A (prevents floating state).
  • R2: 10 kΩ resistor, function: Pull-down for Sensor B.
  • U1: 74HC08 Quad 2-Input AND Gate, function: Logic decision core.
  • R3: 330 Ω resistor, function: LED current limiting.
  • D1: Red LED, function: Alarm visual indicator.

Pin-out of the IC used

Selected Chip: 74HC08 (Quad 2-Input AND Gate).
Note: This chip contains four independent gates. We will use only one.

Pin Name Logic function Connection in this case
1 1A Input A Connect to Node SENSOR_A
2 1B Input B Connect to Node SENSOR_B
3 1Y Output Connect to Node ALARM_OUT
7 GND Ground Connect to Node 0 (GND)
14 VCC Power Supply Connect to Node VCC (+5 V)

Wiring guide

Construct the circuit following these connections using specific node names:

  • V1: Connect positive terminal to node VCC and negative terminal to node 0.
  • U1 Power: Connect Pin 14 to VCC and Pin 7 to 0.
  • S1: Connect one side to VCC and the other side to node SENSOR_A.
  • R1: Connect between node SENSOR_A and node 0.
  • S2: Connect one side to VCC and the other side to node SENSOR_B.
  • R2: Connect between node SENSOR_B and node 0.
  • U1 Logic:
    • Connect Pin 1 to node SENSOR_A.
    • Connect Pin 2 to node SENSOR_B.
    • Connect Pin 3 to node ALARM_OUT.
  • Output Stage:
    • R3: Connect between node ALARM_OUT and node LED_ANODE.
    • D1: Connect Anode to node LED_ANODE and Cathode to node 0.

Conceptual block diagram

Conceptual block diagram — 74HC08 AND gate

Schematic

[ INPUT SENSORS ]                          [ LOGIC CORE ]                       [ OUTPUT ALARM ]

                                                   +--------------+
    [ VCC ] --> [ S1: Door ] --(SENSOR_A)--------->| Pin 1        |
                                   |               |              |
                                   +-> [ R1: 10k ] |              |
                                          |        |  U1: 74HC08  |
                                       [ GND ]     |  (AND Gate)  |--(ALARM_OUT)--> [ R3: 330 Ω ] --> [ D1: LED ] --> [ GND ]
                                                   |              |
                                                   |              |
    [ VCC ] --> [ S2: Window ] --(SENSOR_B)------->| Pin 2        |
                                   |               |              |
                                   +-> [ R2: 10k ] | Power:       |
                                          |        | 14(VCC), 7(0)|
                                       [ GND ]     +--------------+
Schematic (ASCII)

Truth table

The 74HC08 output is High (1) only if both inputs are High (1).

Sensor A (S1) Sensor B (S2) Output (Pin 3) LED State
0 (Open) 0 (Open) 0 (Low) OFF
0 (Open) 1 (Closed) 0 (Low) OFF
1 (Closed) 0 (Open) 0 (Low) OFF
1 (Closed) 1 (Closed) 1 (High) ON

Measurements and tests

  1. Power Verification: Measure voltage between VCC and 0. It should be stable at 5 V.
  2. Idle State: Ensure both S1 and S2 are open. Measure voltage at Pin 1 and Pin 2 of U1. Both should be 0 V (Logic 0). The LED should be OFF.
  3. Single Trigger Test: Close S1 only. Pin 1 should read 5 V, Pin 2 should read 0 V. Measure Pin 3 (Output); it should remain 0 V. Repeat for S2 only.
  4. Alarm Activation: Close both S1 and S2. Measure Pin 1 and Pin 2; both must be 5 V. Measure Pin 3; it should jump to ~5 V (Logic 1).
  5. Output Current: Check that D1 lights up brightly. The voltage drop across R3 should be approximately 3 V (depending on LED color).

SPICE netlist and simulation

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

* Title: Practical case: Dual sensor alarm activation

* ==============================================================================
* Models
* ==============================================================================
* Generic Red LED Model
* IS: Saturation current, N: Emission coefficient, RS: Series resistance
.model DLED D(IS=1e-14 N=1.5 RS=5 BV=5 IBV=10u CJO=10p TT=10n)

* Voltage Controlled Switch Model (for S1, S2)
* Simulates a physical SPST switch
* Vt: Threshold voltage (2.5V), Ron: On resistance (1 ohm), Roff: Off resistance (100Meg)
.model SW_SENSOR SW(Vt=2.5 Ron=1 Roff=100Meg)

* ==============================================================================
* Subcircuits
* ==============================================================================
* U1: 74HC08 Quad 2-Input AND Gate (Single Gate Implementation)
* Pins: 1=A, 2=B, 3=Y, 7=GND, 14=VCC
.subckt 74HC08_GATE 1 2 3 7 14
* Behavioral implementation using continuous sigmoid functions for convergence robustness.
* Logic: V_out = VCC * sigmoid(A) * sigmoid(B)
* The slope factor (50) ensures a sharp transition near the 2.5V threshold.
B_LOGIC 3 7 V = V(14) * (1 / (1 + exp(-50 * (V(1) - 2.5)))) * (1 / (1 + exp(-50 * (V(2) - 2.5))))
.ends

* ==============================================================================
* Main Circuit
* ==============================================================================

* ... (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.

* Title: Practical case: Dual sensor alarm activation

* ==============================================================================
* Models
* ==============================================================================
* Generic Red LED Model
* IS: Saturation current, N: Emission coefficient, RS: Series resistance
.model DLED D(IS=1e-14 N=1.5 RS=5 BV=5 IBV=10u CJO=10p TT=10n)

* Voltage Controlled Switch Model (for S1, S2)
* Simulates a physical SPST switch
* Vt: Threshold voltage (2.5V), Ron: On resistance (1 ohm), Roff: Off resistance (100Meg)
.model SW_SENSOR SW(Vt=2.5 Ron=1 Roff=100Meg)

* ==============================================================================
* Subcircuits
* ==============================================================================
* U1: 74HC08 Quad 2-Input AND Gate (Single Gate Implementation)
* Pins: 1=A, 2=B, 3=Y, 7=GND, 14=VCC
.subckt 74HC08_GATE 1 2 3 7 14
* Behavioral implementation using continuous sigmoid functions for convergence robustness.
* Logic: V_out = VCC * sigmoid(A) * sigmoid(B)
* The slope factor (50) ensures a sharp transition near the 2.5V threshold.
B_LOGIC 3 7 V = V(14) * (1 / (1 + exp(-50 * (V(1) - 2.5)))) * (1 / (1 + exp(-50 * (V(2) - 2.5))))
.ends

* ==============================================================================
* Main Circuit
* ==============================================================================

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

* --- Actuation Control Signals (Simulation Stimuli) ---
* These voltage sources act as the "hand" pressing the switches.
* They define the timing for the Truth Table test.
* ACT_A: Period 200us (High 0-100us)
V_ACT_A ACT_A 0 PULSE(0 5 0 1u 1u 100u 200u)
* ACT_B: Period 400us (High 0-200us)
V_ACT_B ACT_B 0 PULSE(0 5 0 1u 1u 200u 400u)

* --- Input A: Door Sensor ---
* S1: SPST Switch. Connects VCC to SENSOR_A when ACT_A is High (>2.5V).
S1 VCC SENSOR_A ACT_A 0 SW_SENSOR
* R1: 10 kΩ resistor. Pull-down for Sensor A.
R1 SENSOR_A 0 10k

* --- Input B: Window Sensor ---
* S2: SPST Switch. Connects VCC to SENSOR_B when ACT_B is High (>2.5V).
S2 VCC SENSOR_B ACT_B 0 SW_SENSOR
* R2: 10 kΩ resistor. Pull-down for Sensor B.
R2 SENSOR_B 0 10k

* --- Logic Core: U1 (74HC08) ---
* Instantiating the logic gate subcircuit.
* Mapping: Pin 1->SENSOR_A, Pin 2->SENSOR_B, Pin 3->ALARM_OUT, Pin 7->0, Pin 14->VCC
XU1 SENSOR_A SENSOR_B ALARM_OUT 0 VCC 74HC08_GATE

* --- Output Stage ---
* R3: 330 Ω resistor (Current limiting)
R3 ALARM_OUT LED_ANODE 330
* D1: Red LED (Visual indicator)
D1 LED_ANODE 0 DLED

* ==============================================================================
* Analysis Directives
* ==============================================================================
* Transient analysis: Step 1us, Stop 500us
* This duration covers all combinations of the input pulses (00, 01, 10, 11).
.tran 1u 500u

* Print required nodes for log output
.print tran V(SENSOR_A) V(SENSOR_B) V(ALARM_OUT) V(LED_ANODE)

* Calculate DC operating point
.op

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (1294 rows)
Index   time            v(sensor_a)     v(sensor_b)     v(alarm_out)
0	0.000000e+00	4.999500e-04	4.999500e-04	1.403014e-108
1	1.000000e-08	4.999500e-04	4.999500e-04	1.403014e-108
2	2.000000e-08	4.999500e-04	4.999500e-04	1.403014e-108
3	4.000000e-08	4.999500e-04	4.999500e-04	1.403014e-108
4	8.000000e-08	4.999500e-04	4.999500e-04	1.403014e-108
5	1.600000e-07	4.999500e-04	4.999500e-04	1.403014e-108
6	3.200000e-07	4.999500e-04	4.999500e-04	1.403014e-108
7	3.562500e-07	4.999500e-04	4.999500e-04	1.403014e-108
8	4.196875e-07	4.999500e-04	4.999500e-04	1.403014e-108
9	4.372461e-07	4.999500e-04	4.999500e-04	1.403014e-108
10	4.679736e-07	4.999500e-04	4.999500e-04	1.403014e-108
11	4.795524e-07	4.999500e-04	4.999500e-04	1.403014e-108
12	4.902290e-07	4.999500e-04	4.999500e-04	1.403014e-108
13	5.023412e-07	4.999500e+00	4.999500e+00	5.000000e+00
14	5.138119e-07	4.999500e+00	4.999500e+00	5.000000e+00
15	5.256739e-07	4.999500e+00	4.999500e+00	5.000000e+00
16	5.378128e-07	4.999500e+00	4.999500e+00	5.000000e+00
17	5.539238e-07	4.999500e+00	4.999500e+00	5.000000e+00
18	5.828205e-07	4.999500e+00	4.999500e+00	5.000000e+00
19	6.384927e-07	4.999500e+00	4.999500e+00	5.000000e+00
20	7.166884e-07	4.999500e+00	4.999500e+00	5.000000e+00
21	8.730798e-07	4.999500e+00	4.999500e+00	5.000000e+00
22	1.000000e-06	4.999500e+00	4.999500e+00	5.000000e+00
23	1.031278e-06	4.999500e+00	4.999500e+00	5.000000e+00
... (1270 more rows) ...

Common mistakes and how to avoid them

  1. Floating Inputs: Omitting R1 or R2 causes the inputs to «float» when switches are open. The 74HC08 may pick up noise and trigger erratically. Solution: Always use pull-down resistors (10 kΩ) connected to ground.
  2. Missing Power to IC: Students often wire the logic pins but forget Pins 14 (VCC) and 7 (GND). Solution: Always wire power rails first.
  3. No Current Limiting: Connecting the LED directly to the IC output without R3 will damage the LED or the 74HC08. Solution: Ensure a 220 Ω to 470 Ω resistor is in series with the LED.

Troubleshooting

  • LED never turns ON:
    • Check if the LED polarity is correct (Anode to resistor, Cathode to ground).
    • Verify the 74HC08 has power on Pin 14.
    • Ensure both switches are making good contact.
  • LED acts erratically or turns ON when switches are OFF:
    • Check for missing pull-down resistors R1 and R2.
    • Verify that you are using a 74HC08 (AND) and not a 74HC32 (OR) or 74HC00 (NAND).
  • LED is very dim:
    • R3 value might be too high (e.g., 100 kΩ instead of 330 Ω).
    • Source voltage V1 might be too low (< 3 V).

Possible improvements and extensions

  1. Audible Alarm: Connect a 5 V active buzzer in parallel with the LED (and its resistor) or use a transistor driver to sound a noise when the alarm triggers.
  2. Memory Latch: Feed the output into a Set-Reset (SR) Latch or Flip-Flop so that once the alarm is triggered, it stays ON even if the sensors are closed again, requiring a manual reset button.

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: Which integrated circuit is used as the core logic component in this tutorial?




Question 2: What condition must be met for the output LED to turn ON?




Question 3: What is the primary purpose of using an AND gate in a safety interlock system?




Question 4: If Input A is Low and Input B is High, what is the expected state of the LED?




Question 5: What does the tutorial list as a use case for 'Data Validation'?




Question 6: What is the voltage output when the LED is OFF according to the expected outcome?




Question 7: Which components are used to simulate the door and window sensors?




Question 8: How does the circuit behave if both Input A and Input B are Low?




Question 9: What is the difficulty level of this logic circuit implementation?




Question 10: In the context of security systems, when does this circuit trigger a high-priority alarm?




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

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

Follow me: