The Dual-Sensor Consensus Arbiter
Press the pushbutton to test the interactive circuit in real time.
- Arduino Uno microcontroller board
- LED indicator (green)
- 220 ohm current-limiting resistor
- Tactile pushbutton switch
- Jumper wires (male-male)
🔧 Build Your Consensus Arbiter
const int SENSOR_A_PIN = A0;
const int SENSOR_B_PIN = A1;
const int STATUS_LED = 13;
const int FAULT_LED = 12;
const int DISAGREEMENT_THRESHOLD = 15; // Max allowable deviation
void setup() {
pinMode(STATUS_LED, OUTPUT);
pinMode(FAULT_LED, OUTPUT);
Serial.begin(115200);
Serial.println("Dual-Sensor Consensus Arbiter Initialized.");
}
void loop() {
int readA = analogRead(SENSOR_A_PIN);
int readB = analogRead(SENSOR_B_PIN);
int delta = abs(readA - readB);
if (delta <= DISAGREEMENT_THRESHOLD) {
digitalWrite(STATUS_LED, HIGH);
digitalWrite(FAULT_LED, LOW);
int consensus = (readA + readB) / 2;
Serial.print("Consensus OK: Value = ");
Serial.println(consensus);
} else {
digitalWrite(STATUS_LED, LOW);
digitalWrite(FAULT_LED, HIGH);
Serial.print("CRITICAL FAULT: Sensor Disagreement! Delta = ");
Serial.println(delta);
}
delay(500);
}
Dual modular redundancy detects sensor drift, broken wiring, and hardware divergence instantly.
⚗️ Test your model
| Test Condition / Action | Expected Result |
|---|---|
| Sensors Matched (A=500, B=505, delta=5) | Consensus confirmed; Green LED ON; outputs 502 average |
| Sensor Drift Induced (A=500, B=540, delta=40) | Disagreement asserted; Red Fault LED ON; logs error |
| Unplug Sensor A (A=0, B=500) | Immediate fail-safe shutdown; prevents blind operation |
Implement a Triple Modular Redundant (TMR) system with 3 sensors that isolates the faulty sensor and continues running on the majority 2!
📖 Our Story & Concepts
In aerospace avionics, medical ventilators, and nuclear reactors, a single sensor failing silently can cause loss of life. If a boiler thermostat fails by freezing at 20°C, the controller keeps running heaters until the tank explodes.
To eliminate single points of failure, safety-critical systems implement Dual Modular Redundancy (DMR). Two independent physical channels sample the exact same process. When their readings diverge beyond calibrated tolerance, the arbiter flags a safety violation and commands actuators into a safe fail-soft state.
</> Full Annotated Code Walkthrough
// Complete Dual Modular Redundancy Arbiter with Self-Test
const int SENSOR_A_PIN = A0;
const int SENSOR_B_PIN = A1;
const int OK_PIN = 13;
const int FAULT_PIN = 12;
const int MAX_TOLERANCE = 18;
void setup() {
pinMode(OK_PIN, OUTPUT);
pinMode(FAULT_PIN, OUTPUT);
Serial.begin(115200);
}
void loop() {
int a = analogRead(SENSOR_A_PIN);
int b = analogRead(SENSOR_B_PIN);
int diff = abs(a - b);
if (diff <= MAX_TOLERANCE) {
digitalWrite(OK_PIN, HIGH);
digitalWrite(FAULT_PIN, LOW);
int avg = (a + b) / 2;
Serial.print("CONFIRMED_DATA:"); Serial.println(avg);
} else {
digitalWrite(OK_PIN, LOW);
digitalWrite(FAULT_PIN, HIGH);
Serial.print("INTEGRITY_VIOLATION_DELTA:"); Serial.println(diff);
}
delay(300);
}
Dual modular redundancy detects sensor drift, broken wiring, and hardware divergence instantly.
▷ Expected Results & Troubleshooting
| Test Condition / Action | Expected Result |
|---|---|
| Sensors Matched (A=500, B=505, delta=5) | Consensus confirmed; Green LED ON; outputs 502 average |
| Sensor Drift Induced (A=500, B=540, delta=40) | Disagreement asserted; Red Fault LED ON; logs error |
| Unplug Sensor A (A=0, B=500) | Immediate fail-safe shutdown; prevents blind operation |
⚑ Extension Challenges & Blueprints
- Level 1: Add individual gain/offset compensation curves for both sensors before delta comparison.
- Level 2: Implement Triple Modular Redundancy (TMR) with majority voting logic.
- Level 3: Transmit failure diagnostic reports over an encrypted serial or CAN bus network.