MQ-7 issue Arduino GIGA R1 WiFi

Hello,
I have an mq-7 connected to my Arduino GIGA R1 WiFi and a 10K resistor. I don't know where to connect my resistor because if I connect it between GND and A0, the green LED is off but I have “correct” values but when I connect it between VCC and A0, the green LED is on but the values become “incoherent ” and after checking around, I learned that the green LED must be on to detect CO. I've included my code below, along with images of my connections.
Thanks in advance for your help

#include "MQ7.h"
#include "mq.h"
#include "constante.h"
#include <Arduino.h>

MQ7 mq7(A2,5.0);

void setup_mq7() {
}

void get_mq7() {
  float ppm = mq7.getPPM();

  if (ppm < 0) {
    signalerErreur("MQ7", "Lecture du capteur échouée !");
    return;
  }

  Serial.print("💨 CO : ");
  Serial.print(ppm);
  Serial.println(" ppm");
}

Images of the resistor connected between GND and A0



Images of the resistor connected between VCC and A0



Images without resistor connected



If the purpose of your wiring was to drop the sensor output to 3.3V, you need two resistors to make voltage divider.
You can use other values but R2 needs to be 2x R1.

Thanks for your answer.
Honestly I searched on the internet (I can't find the link) and I was told that I had to connect in 5V and put a 10K resistor but I don't know where or why... Because if I have to connect the MQ-7 in 3.3V I can do it without a resistor because on my board I have 5V or 3.3V.
Could you please give me more information? Honestly, I'm not sure what I should do, and on top of that I can't really find any documentation on the sensor...
Thanks

Can't you make the voltage divider with two resistors like I suggested above??

The problem is that I don't have the right resistors. And will it really make a difference if I use your method rather than just plugging in 3.3V directly without a resistor?

If you power the sensor at 3.3V it probably works as well. The datasheet says it needs 5V but it doesn't hurt to try.
Even reputable vendor suggest that you can use 3.3V:

But if you prefer to make voltage divider and only have 10k resistors, you can put 2 in parallel to make 5k for R1.

I've just tried connecting it to 3.3V, but the sensor doesn't even light up.
I only have 1K or 10K resistors on hand.

Then do what I suggested above,
R2 =10k,
R1= two 10k in parallel.

I'm not very good at embedded systems or electronics in general, is that what you asked me?


The sensor is on but not the green LED.
Thanks

AO from sensor needs to go to the other end of parallel resistors.

OK, thanks for the clarification, although it doesn't change anything about the green LED. My sensor tells me ~3 ppm but it was the same before I corrected my error... Very strange, isn't it?

Good, because LED indicates a gas level above a set threshold.
Sensor needs some time to heat up. The analog voltage difference at 3ppm is so small that you can't see difference between with/without voltage divider.
Your wiring looks correct now. But please don't use red wire for GND, it's very confusing!

Is the set threshold internal to the sensor, or do I have to set it? Ok then, that's normal. Yes, sorry for the confusion, it was the only long enough wire I had on hand.
So you want me to keep it like that? Above I sent some screenshots where I had similar values. The idea is that if the CO level is too high, my GSM module sends me an alert SMS. So it's me who defines the limit values for which the GSM sends me a message. So my previous set-up may not be disturbing, given that I have control over the parameters...? The problem is that I can't calibrate my MQ-7 because I don't have a “real” CO sensor to hand.
If you can give me your opinion that would be great, thanks for everything.

It's not relevant since you are using analog output. Threshold is for digital output.

That's common problem with sensors, I can't help with that...

That's okay, no problem, thank you very much.

You're welcome.

In this case I think you only need one 10k resistor, between anologue out and ground.
The gas sensor has a current output, and a 4k7 resistor (MQ_R2) to convert that (~1mA?) current to a voltage. A 4k7 + 10k sense resistor (parallel) there drops output voltage to 2/3 of it's original voltage.
A 2*10k voltage divider (4k7+20k load) would drop it to ~1.9volt.
Leo..

You are right, my mistake not to dig in to the docs. But OP doesn't have Waveshare module, so the resistor has likely different value, probably 10k from reference design.
Best option would be rebuilding the whole sensor to have heater controlled like it supposed to be. Like here: