miguel5612 / MQSensorsLib

We present a unified library for MQ sensors, this library allows to read MQ signals easily from Arduino, Genuino, ESP8266, ESP-32 boards whose references are MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, MQ131, MQ135, MQ136, MQ303A, MQ309A.
MIT License
169 stars 64 forks source link

Why 10k resistor is needed #58

Closed abattya closed 1 year ago

abattya commented 2 years ago

Hello, can you please explain why the 10k resistor is needed and why for that exact place? Thanks!

miguel5612 commented 1 year ago

Hello,

The 10k resistor you're referring to is likely a load resistor (RL). In the context of an MQ gas sensor, this load resistor is part of the voltage divider circuit which is used to measure the sensor's resistance (RS).

In operation, the sensor's resistance changes based on the concentration of the gas it is designed to detect. To measure this change in resistance, it is typically configured in a voltage divider arrangement. This is where the load resistor comes into play.

The output voltage of this voltage divider network is fed into the ADC (Analog to Digital Converter) of the microcontroller. This voltage is inversely proportional to the resistance of the sensor (RS). Hence, by measuring this voltage, we can derive the value of RS, and thus the gas concentration.

The value of RL (the load resistor) is often chosen based on the specific sensor and the range of gas concentration to be measured. It's a part of the sensor's design and its value is typically suggested by the sensor manufacturer in the sensor's datasheet. In the case of many MQ sensors, a 10k ohm resistor is often used.

The exact placement of the resistor in the circuit (i.e., whether it's placed in series with the sensor or in parallel) is also a part of the voltage divider design. The choice between a series or parallel arrangement will depend on the specific type of sensor and the desired characteristics of the voltage divider output.

In our library we have incorporated graphics and suggestions so that you don't have to decide between one design or another but start from a generic design.

I hope this explanation helps! If you have any further questions, feel free to ask.