OR Gate Alarm System
Multi-sensor alarm using OR gates. Any sensor activation triggers the alarm. Learn how OR gates enable multiple trigger sources.
您将学到什么
- Recognise OR as the gate of choice for "any of these" trigger logic.
- Read the 3-input OR truth table — only the all-zeros row produces 0.
- Compare OR-based and AND-based security systems and pick the right one for the use case.
- See OR gates aggregating multiple sensor or alarm signals in real systems.
- Understand why adding another sensor to an OR-based alarm is just one more input.
工作原理
Real alarm systems work on a simple rule: if any sensor detects something, sound the alarm. This circuit wires three sensor switches — Window, Motion, Glass-break — into an OR gate that drives an alarm output. The output is high whenever at least one sensor is active.
With three inputs, OR has 2³ = 8 possible input combinations. Of these, exactly one (all zeros) keeps the alarm silent; the other seven trigger it. This is the inverse pattern from AND, which fires only on the all-ones row.
The educational insight: OR encodes the security policy "trigger if any of these conditions are met," while AND encodes "trigger only when all conditions are met." The same three sensor switches feeding an AND gate would mean "alarm only when all three sensors agree something is wrong" — useful in some applications (false-alarm reduction by requiring corroboration) but the wrong choice for an intrusion alarm where missing one sensor due to a single trigger event would be catastrophic.
Notice that OR is commutative and associative — sensor order doesn't matter, and a 3-input OR is equivalent to chaining two 2-input ORs.
真值表
Three sensors feeding an OR gate: 8 combinations, 7 of which trigger the alarm. Only the all-quiet state (0,0,0) keeps the alarm silent.
| 输入 | 输出 | |||
|---|---|---|---|---|
| Window | Motion | Glass | Alarm | |
| 0 | 0 | 0 | 0 | All quiet — alarm silent |
| 0 | 0 | 1 | 1 | Glass-break alone fires alarm |
| 0 | 1 | 0 | 1 | |
| 0 | 1 | 1 | 1 | |
| 1 | 0 | 0 | 1 | |
| 1 | 0 | 1 | 1 | |
| 1 | 1 | 0 | 1 | |
| 1 | 1 | 1 | 1 | All sensors firing — alarm active |
布尔表达式
OR with three inputs — output is 1 if any of A, B, C is 1.
Same expression in formal-logic notation.
De Morgan equivalent — OR of the inputs equals NOT of the AND of inverted inputs.
逐步尝试
在上方嵌入式电路中设置输入,然后阅读预期结果并验证。
- 1Window = 0 Motion = 0 Glass = 0预期:
Alarm = 0您将看到: All sensors quiet — alarm light is dark. This is the only combination that keeps the alarm silent. - 2Window = 1 Motion = 0 Glass = 0预期:
Alarm = 1您将看到: Single sensor activates and the alarm fires immediately. OR doesn't wait for corroboration. - 3Window = 0 Motion = 1 Glass = 1预期:
Alarm = 1您将看到: Two sensors both active — alarm stays on. Once on, additional sensors don't change the output. - 4Window = 1 Motion = 1 Glass = 1预期:
Alarm = 1您将看到: All three sensors active. OR continues to output 1 — there's no "more high" than 1.
使用的组件
实际应用
Home security systems. Window switches, motion detectors, glass-break sensors, and door contacts all OR together to drive a single alarm output. Add another sensor: just OR it in.
Industrial e-stop chains. Emergency-stop buttons throughout a factory feed an OR gate that cuts machine power. Any single button press shuts down the line — exactly what's needed for safety.
Smoke and fire detection. Multiple smoke detectors in a building OR together to trigger sprinklers and the central alarm. One detector is enough to activate the response.
CPU interrupt aggregation. Every peripheral that can request CPU attention — keyboard, network card, disk, timer — drives an interrupt line. Those lines OR together to a single CPU input. The CPU then reads a separate "who interrupted" register to identify the source.
Multi-fault detection. Power-supply over-voltage, over-current, and over-temperature signals OR together to drive a single "fault" line that shuts the supply down.