Cooking Fumes Switch On a Fan | Arduino Nano, MQ-2 and Relay
An Arduino Nano uses an MQ-2 reading to switch a fan through a relay. Separate switching thresholds keep small fluctuations from repeatedly cycling the fan.
The key idea
The controller turns the fan on when the reading rises past the upper threshold. It keeps the fan running until the reading falls past the lower threshold. The MQ-2 signal responds to several gases and depends on its surroundings.
What to remember
- The gap between thresholds gives the controller hysteresis.
- An MQ-2 reading alone cannot identify a particular gas.
Check your understanding
What should happen when the reading falls just below the upper threshold after the fan starts?
Show the explanation
The fan should remain on until the reading crosses the lower threshold.