Introduction
The MQ series of sensors comprises a range of gas detectors used to detect multiple gases like CO2, LPG, CO, and more. These sensors find applications in various scenarios, from detecting fire-induced smoke in buildings to detecting gas leaks, making them crucial for mining and other industries.
In this example, we will interface an MQ sensor with Quarky to specifically detect the presence of alcohol. Our objective is to detect alcohol levels and trigger an alarm if they exceed a certain limit. Let’s embark on this exciting journey of gas detection with Quarky!
Circuit Diagram:
Code:
- Create the circuit as per the provided circuit diagram.
- Open Pictoblox and create a new file.
- Select Quarky from the Board menu.
- Drag the “if-then-else” block from the controls palette into the scripting area.
- From the operator palette, add the “greater than” operator into the “if” conditional part.
- Insert the “read analog sensor () at pin()” block from sensor palette Quarky into the space provided in the “greater than” operator block.
- As the sensor is connected to A1, set the condition to check if the value generated by the sensor is greater than 50. If it is, it indicates that the gas (alcohol) is above the desired level, and Quarky should trigger the LED connected to pin D1. Otherwise, the LED should remain off.
- Drag the “forever” block from the controls palette into the scripting area and place the above code block inside the “forever” block.
- Now your script is complete. Add an event to start the script by dragging the “when flag clicked” block from the events palette to the beginning of the script.
Script
Output
With this exciting project, you have learned how to interface an MQ sensor with Quarky to detect alcohol gas levels. Explore the diverse applications of MQ sensors, from detecting smoke in buildings to monitoring gas leaks in industrial settings. Create your own gas detection system with Quarky, and unleash the potential of gas sensing technology! Keep experimenting, and the world of robotics and AI will become your playground!
Output gifs are need to be updated.