0

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 Answers1

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.

goobering
  • 10,750
  • 4
  • 40
  • 64