We are getting the gas sensors and wants to connect to raspberry pi. Need help in this work. We need the code to communicate with the sensor from Raspberry pi. Also we might need a diagram to connect multiple gas sensors to a single raspberry pi. We got one in the web of sparkfun. And also few more questions to ask. Since this is my first time working in these system and hardwares, i might bother the supportive community time and again.
Those sensors are analog, pi’s are digital only. You will need one or more analog to digital converters between the sensors and pi to be able to read the sensors.
This might work:
https://www.sparkfun.com/products/15334
But you will need to figure out how to code it as sparkfun doesn’t have any examples for the pi.
According to your information, let me summarize what I understood and could you tell me if I am right or wrong. Thank you for the help.
-
We can connect MQ-2 sensor in Raspberry Pi correct. I could see 5V, GND and an analog Input Pin. Can you tell me guide me where in the Raspberry pi extension pin would the “Analog Input Pin” should be connected to. Wiring Link: http://wiring.org.co/learning/basics/ai … mq135.html
-
Would I be able to at get the readings of gas produced and could I display them on screen? What would be the steps to do so?
-
Do I need one or more analog to digital converters between the sensors and pi from the start itself? Is MQ-2 sensor useless without ADC?
I just want to know a general steps for guidance to connect sensors to Raspberry Pi, and read real-time values which we want to use later for analysis.
You help means a lot thank you.
- We can connect MQ-2 sensor in Raspberry Pi correct. I could see 5V, GND and an analog Input Pin. Can you tell me guide me where in the Raspberry pi extension pin would the “Analog Input Pin” should be connected to.
Not directly, your sensors require an analog Input. The pi does not have any analog inputs.
- Would I be able to at get the readings of gas produced and could I display them on screen? What would be the steps to do so?
Yes but you will need to write software to do that. I cannot list the steps needed to do that.
- Do I need one or more analog to digital converters between the sensors and pi from the start itself? Is MQ-2 sensor useless without ADC?
Correct.
Thank you for your support.
I have one quick question. The ADC https://www.sparkfun.com/products/15334 seems to be expensive and is useful to connect a single device, correct?
Can we use this ADC to connect and use the MQ2 sensors? ADC Link: https://www.digikey.com/en/products/det … gTEALw_wcB
The Sparkfun board is a quad (4-channel) ADC so it should measure 4 sensors. It is also a fully assembled board while the MCP3008 chip is just a chip. To use it, you would need to wire it up on a board (either a perf board, whiteblock, or a custom PCB that you would make) along with appropriate bypass capacitors.