Connecting Gas Sensor Breakout to Enviro+

Hey folks,

I just got me one of these awesome [Sparkfun gas sensor breakouts]( with the MQ-7 carbon monoxide sensor) and I would love to connect it to my Enviro+ to give me an additional point of data for my “home weather station”.

It has four pins “H1, A1, GND and B1”

The enviro+ has 3V3, SDA, SCL, #4, GND, A3V3, GND, and 5V

obviously, I connect GND to GND, but I’m a little confused as to what I do with the other three pins.

Any suggestions? (also if anyone has any python example code on how to actually get the data from the sensor, I would really appreciate it). Cheers!

Have a look see here, “might” help you sort out how it works.

I’ve never used anything like that, I tend to stick to i2c devices when possible.

Yeah I took a look at that one but it’s super out of date and has tons of broken links (and most of it is focused on adding an analogue circuit to the dev board they used which wasn’t a pi). Guess I’m going to have to hit the Google’s hard at some point soon 😆

I only took a quick look, to be honest. =(
Been there done that to the Google it to death part. ;)

Hi Andy,

I’ve done some asking about and it looks like that sensor won’t work as the ADC pin on the Enviro+ is only 0-3v3. If you can find a sensor that works with 3v3 it should be fine connecting to the ADC on the Enviro+ :)

Hmmm… maybe I can hook it up to a separate device (ESP8266 or something and send the data over the network via MQTT or something). No biggy, it wasn’t expensive. Cheers for the reply Matt!

Alternatively, I guess I can just find a MQ- on an i2c breakout (PS… it could be great idea to create an MQ-* to I2C breakout board in your standard format if one doesn’t already exist)

Alternatively… would this work as a middle-man?

Would this be of any use? It says 3.3V or 5V compatible.

ooooooh. Errm. I don’t know :D

So I managed to find a wiring example for the MQ-7 on the sparkfun website and I think I’ve figured out the right way to wire this up. I need to order the ADC breakout first though (guess I’m getting from PImoroni direct as my local supplier doesn’t have it). Does this seem sane?

If your sensor needs +5V you’ll need to connect the 3-5V pin on the Enviro+ side to +5V instead of 3.3V. As far as I know (not 100% sure though?) this doesn’t affect the logic level going to i2c. It stays at 3.3V, you will get 5V out of the 3-5V pin going to the sensor though.
Or wire the Sensor H1 pin to the Enviro+ +5V instead of the ADS1015 3-5V pin. As long as they all have a common ground it “should” work.

Ah yes, good point on the 5V, should be trivial to run the 5v from the Enviro straight to the MQ-7! Cheers for the help!

I have 3 of the 0.96 breakout garden LCD’s wired up to one Pi. I started out using 3.3v but switched all three to 5V. Weird things were happening with the screens backlights etc. I think I was hitting the limit for current on the Pi’s 3.3V regulator. They have been running from 5V for many days now with no issues that I am aware of. SPI not i2c, even so, if the logic signals had switched to 5V I would have fried my Pi by now. ;)
Just a FYI post.

1 Like

So I asked a similar question on the Sparkfun Forum and they told me:

H1 and GND are the connections for the heater and that runs at 5 volts. These ONLY power the heater and don’t influence the other terminals on the board.

A1 and B1 are the two ends of the sensor and you can think of the sensor as a simple variable resistor. What you need to do is create a voltage divider with an external resistor and the “variable resistor” that’s inside the sensor and then measure the voltage at the connection between the two resistors.

As long as you have 5 volt and 3 volt power available, you can power the heater with 5 volts and connect 3 volts to your voltage divider. That will eliminate the need for an ADC that is 5 volt capable.

Which is awesome! It means I just need to do this:

Thanks for all the help everyone!

That’s awesome, and simplifies things. Also means you can start building it now. =)

so… the plan didn’t quite work, so I jumped over to the Sparkfun forums and asked there and they gave me a pretty solid answer complete with diagram:


A quick bodge job with the soldering iron later and we’re up and running!

Now I just need to figure out how to get the reading in volts from the ADC and convert it into PPM (and how to tidy up this horrible soldering job!)

PS, if anyone ever comes across this and finds they get a 0V reading from the ADC, pop the MQ-7 sensor off the breakout and put it on the other way around!

The way to do it is push the wire in so the insulation is touching the Enviro, then solder the bit that’s poking through the other side.
I usually try to strip off only what I need from the end of the wire, just long enough to poke through the hole. And if its stranded wire, I twist the end so all the wires are together, then tin it with a little bit of solder. I find it makes it easier to push it through for soldering with no stray strands to cause issues.

1 Like