// Triangulation using peak times and amplitudes
void loop() for (int i=0; i<3; i++) float val = analogRead(mqPins[i]); float ratio = val / baseline[i]; if (ratio > 1.15) // 15% rise Serial.print("Flying fish near sensor "); Serial.println(i); delay(500); // debounce mh mq sensor flying fish
| Sensor | Distance from path | Peak voltage (V) | Peak time (ms) | |--------|-------------------|----------------|----------------| | S1 | 10 cm | 2.8 | 120 | | S2 | 30 cm | 1.9 | 320 | | S3 | 50 cm | 0.9 | 510 | // Triangulation using peak times and amplitudes void
The flying fish passed closest to S1 at t≈120 ms. 7. Troubleshooting & False Positives | Symptom | Likely cause | Fix | |---------|--------------|-----| | Constant high readings | Sensor aging / contamination | Bake at 100°C for 1 hour (outside) | | No response to moving source | Load resistor too high | Reduce RL to 4.7 kΩ | | Slow recovery after peak | Enclosed space, no air flow | Add a small fan for ventilation | | False positives (no gas) | Temperature surge | Apply digital low‑pass filter (moving average n=5) | 8. Useful Code Snippet (Arduino) int mqPins[] = A0, A1, A2; float baseline[3]; void setup() Serial.begin(9600); for (int i=0; i<3; i++) baseline[i] = analogRead(mqPins[i]); delay(100); Useful Code Snippet (Arduino) int mqPins[] = A0,