MQ-4 and MQ-7 sensor module (have outputs/Powered on) even left GND floating

The MQ-4 and MQ-7 sensor module(breakout board) are as the image shows:
MQ-4
MQ-7
They both have a "flying-fish" mark.

(Edited: My original application is as this post indicates. During debug, I have the following debug setting 1:)

===(edited: debug setting 1:)===

I connect the VCC terminal to 5V power source, AO(analog output) to a voltage divider upper resistor, and leave GND terminal floating.

VCC - 5V
AO - resistor - ESP32 GPIO pin
(edited: full: AO - voltage divider upper resistor - ESP32 GPIO pin - voltage divider lower resistor - GND)
GND - floating

(edited: First discovery from debug setting 1)
I find out that evan GND is not connected they still have the analog outputs from AO.

===(Edited: Another discovery:)===

I double-checked it by removing it from my application and connect it with 5v power adapter only, and connect its VCC to 5V and AO to 0V(GND), finding out it would also power the modules on, as the image shows:

(Edited: these image show that even with module GND terminal floating, the module could still be powered on. Pins are VCC,GND,Digital Out,Analog Out from top to bottom. Purple Wire is power adapter 5V. White wire is power adapter GND)


With this result, I cannot use transistors( n-BJT or n-MOSFET ) to control its on/off status.
(5V - VCC - GND - Collector of n-BJT - Emitter of n-BJT - GND)

What else could I do?
May I say there are wrong designs in these modules?

I connect the VCC terminal to 5V power source, AO(analog output) to a voltage divider upper resistor, and leave GND terminal floating.
AO - resistor - ESP32 GPIO pin

That is likely to destroy the ESP32 GPIO pin. Why did you do that?

The links to pictures are useless. Post a link to the product page.

There don't seem to be any correct tutorials for using the MQ4 and MQ7 sensors with Arduino, as they require a constantly varying heating cycle. You might find this forum thread useful: MQ-7 "flying fish" heating cycle

What's the purpose of your trial? If it's powering, it's sinking unknown current to gpio pin..

Supply or ground current finding it's way through an input or output pin is called phantom-powering, which is really bad for the chip on that board. Consider it unreliable from now on.
Leo..

1 Like

it won't destroy the pin because I've said it is a "voltage divider upper resistor".
it's:
AO - resistor - ESP32 GPIO pin - resistor - GND
I do it because the module would output a voltage higher than the maximum voltage an ESP32 GPIO pin would accept(3.3v).

can you explain why it would destroy the ESP32 GPIO pin?

The "voltage divider" phrase is meaningless, especially since you forgot to connect the sensor ground pin.

Please post a complete schematic diagram, with component values, pins and connections clearly labeled, and explain your failure to connect the ground pin. Hand drawn is fine.

What's the purpose of your trial?

The purpose of this trial is that,
with (

  • 5V - module VCC,
  • module GND - Collector of n-BJT,
  • module AO - voltage divider upper resistor - ESP32 GPIO Pin - voltage divider lower resistor - GND,
  • Emitter of n-BJT - GND

) and (

  • no current supplied to base of n-BJT (pulled-down)

), I find out that the ESP32 GPIO Pin still read an output>0 with ADC.
During debug I found out this setting (unpower, leave GND floating).

What are the resistor values?
If GND is not connected, you are reading a floating input pin, it could read anything.

So you try to "unpower" the sensor? Don't cut gnd with circuits that have data input/output. They can sink through that data line and misbehave/fry your board.

1 Like

SO, as the images above show, with or without MCU/ESP32 GPIO pin (please just treat the MCU/ESP32 as not existing), MQ-4 and MQ-7 sensor module have outputs even left its GND floating. The module uses its AO pin as the GND/low potential to make it a circuit.

What is the problem?

For Esp32 yes.
Gpios are not to complete a circuit.

Your limited understanding of electronic circuits, and failure to provide forum members with important details, like a schematic diagram, component values, etc.

the diagram of "flying-fish" module cannot be found on the internet simply with Google or Bing search Copilot or Perplexity, and therefore I'm here to post information for:

  1. letting other people know this fact exists, and the modules are wrongly designed products. I think it should be designed in a way that the module should not be powered on when module VCC is not connected to 5V and module GND is not connected to GND. But the fact is the module could use its AO terminal as GND to make it a circuit to power on itself.
  2. seek information or suggestion from community that has done reserches on these underdocumented-yet-wellsold modules.

Here is the internal diagram of MQ-2 module (not MQ-4 or MQ-7).
Reference for those in interest.

If the MQ-2 module diagram applies to MQ-4 module and MQ-7 module, then the poor isolation is due to this route:

A circuit is made even when the GND is floating.

MQ-7 module schematic diagram:

mq-sensor-schematic

then the poor isolation is due to this route

The "poor isolation" is a made-up term covering your lack of understanding of the actual circuit function, and failure to connect the grounds, not a design fault or problem.

As I said before, I found out this fact in a situation that I tried to control(switch on/off) the module with transistor, with (

  • 5V - module VCC,
  • module GND - Collector of n-BJT,
  • module AO - voltage divider upper resistor - ESP32 GPIO Pin - voltage divider lower resistor - GND,
  • Emitter of n-BJT - GND

) and (

  • no current supplied to base of n-BJT (pulled-down)

),
and with this setting(low side switch) I find out that MQ-4 and MQ-7 sensor module have outputs in this setting.
And after that I have the debug setting, which make the module GND floating.

Low side switch is not a typical application? The module is designed in a way that low side switching this module could not work as expected and continues to generate outputs if:

  1. keep base of the NPN BJT low (no current).
  2. keep the GPIO in read mode (not setting it high, which consumes more energy).

I think the modules are definitely wrongly designed.

It's very common design. It is just wrong practice to cut Gnd from sensors or any circuit that has data input/outputs.
If you want to experiment with this argument even more, take a 4-wire pwm controlled cooling fan, wire it to your board, make it run and remove gnd. Tadaa, it keeps on running... Sinking unknown current at unknown voltage to pwm gpio pin that has been configured as output. Even worst from MCU point of view.