1

I've a MQ 4 (smoke etc) sensor module, as listed here.

It has these inputs/outputs:

  • VCC = +5V
  • DOUT = digital out
  • AOUT = analogue out
  • GND

When I connect it to a voltmeter it outputs (DOUT) 3.1V when it's not detecting anything and 0.17V when it detects something (e.g. lighter gas).

What's bugging me is why Raspberry Pi does not detect the digital 1? but it only reads the GPIO pin value as 0, regardless of sensor detecting anything or not.

My first idea was that the digital 1 voltage is too low for the pin logic to detect it as such, but this specification says differently (if I understood correctly that the input high voltage should be at least 2V to register as digital 1).

Ideas?

FYI. the pin (header pin 13 = BCM GPIO 27 = GPIO/wiringPi 2) is setup as input & the wiring is triple-checked.

3
  • can you try to connect your header pin 13 to the 3.3V POWER (not directly, of course, but through a 10k resistor), and see if you get any reading? if there's nothing, you might have fried that particular pin during your experiments, and would be better off choosing another pin you haven't used before =)
    – lenik
    Dec 8, 2013 at 23:49
  • Interresting. Will check the pin and try another one. Thanks @lenik.
    – Saran
    Dec 9, 2013 at 7:39
  • @lenik You were right. Seems I was careless in my previour endeavours with GPIO and have burned the PIN 13. Please, post your comment as answer so I can accept it!
    – Saran
    Dec 9, 2013 at 15:42

2 Answers 2

1

can you try to connect your header pin 13 to the 3.3V POWER (not directly, of course, but through a 10k resistor), and see if you get any reading? if there's nothing, you might have fried that particular pin during your experiments, and would be better off choosing another pin you haven't used before =)

-1

I have same sensor too, MQ-2 with 4 pins AO, DO, GND and VCC:

  • D0=Digital Output;
  • A0=Analog Output;
  • GND=Ground;
  • VCC="connect to 5V".

I checked the sensor, and under the chip there is PWR-LED and D0-LED.

I tested it with wiringPi commands and if gas detected signal is 0, but if no detection signal is 1. I don't know why the signal is inverted, but I used Python to invert 1 and 0 and it works.

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