I am an ABSOLUTE beginner at Raspberry Pi and my first project I've proposed to my teacher is as follows: an Mq-2 smoke sensor will sense smoke and if the level of smoke reaches a certain value (only because I want the smoke to accumulate for aesthetics purposes) then a video file in whatever directory opens and plays. It seemed plausible at first, but as I search for pertinent info., I am faced with content and hobbyists whose instructions and "knowledge" are way out of my depth.

Here are a few ideas I have adumbrated:

1.)Can the raspberry Pi read this voltage output by the sensor (sans ADC)? If so, is it possible for me to make a conditional statement so even the slightest output of voltage would open a video?

3.) Lastly, I've heard that you could "combine" the Raspberry Pi and Arduino Board into "one functional board?" If that is the case, is there a way for me to use the arduino to detect whatever the smoke sensor is giving and then have the Arduino relay a sort of message or something that could make the Raspberry Pi open a video?

  • 1
    Unfortunately you have quite a lot of questions here some of which, like the question about resistors are considered off-topic. To answer all of those questions would require a very long answer, especially given what I can infer about your technical knowledge. Please could you reduce the number of questions in this post, or ask a more specific question. As it stands this post is likely going to be closed unless you make some edits to reduce the length of your question.
    – Darth Vader
    Feb 28, 2017 at 14:28
  • We need to know the model of MQ-2 sensor you have bought or plan to buy. Have you a link?
    – joan
    Feb 28, 2017 at 16:22
  • CuriousHuman, as Darth Vader pointed out, your question is very broad, and not all aspects of it are on topic here. Your background and details are good, but each one of those needs to be asked as a separate question to work reasonably with our site's format. It's also worth noting that the StackExchange network as a whole isn't about writing custom tutorials, we can answer specific questions, but a tutorial of this scope may be better suited for the official forum.
    – Jacobm001
    Feb 28, 2017 at 17:43

1 Answer 1


There's no shortage of MQ-2 based modules which include a digital output that will work with the Pi (via a 5V to 3.3V logic level converter). The easiest route for you would be to make use of one of those, rather than adding lots of additional components and possible failure points to deal with an analogue device.

If your module only outputs analog values you need to do some extra work. The MQ-2 sensor (the component, without a supporting module) outputs analogue values, rather than digital values, which is why the Pi can't read it. The Pi (unusually for microcontrollers) has no Analogue to Digital Converter (ADC) built in, and can only directly interface with digital sensors. Sparkfun has a couple of helpful tutorials on analogue versus digital and analogue to digital conversion that should help you firm up your understanding of the problem. Basically, you just can't use analogue devices without an extra component such as an MCP3002 or MCP3008. Google (and, indeed, this board) is positively overflowing with resources on that topic.

You can, if you like, connect an Arduino to the Pi in order to make use of its ADC capabilities. To my mind this introduces quite a lot of complexity and potential failure points, and is perhaps overkill for your requirements (one analogue sensor input). I think I'd recommend sticking with just the Pi, and using one of the aforementioned ADC chips over its SPI interface using Python, as detailed in this Adafruit tutorial. Please remember that, as the sensor requires 5V and the Pi can only accept 3.3V, you'll need to power the ADC from the Pi's 5V rail and place a 5V to 3.3V logic level converter between it and the Pi. Failing to do so risks permanently damaging the Pi.

  • So the raspberry pi CAN read analogue values? I really don't need the digital values anyway, if it can be helped. I live outside US and shipment of the ADCs will come long after the deadline of this project. My end goal is to be able to use the sensor to detect the slightest gossamer of smoke and IMMEDIATELY trigger a set of codes that'll open a video in some directory. The other option I really have if I want to attain the digital values is by connecting the RasPi with the Arduino, Feb 28, 2017 at 18:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.