i have problem in gas sensor
-
@Reza
there are two problems with MQ-2 sensors :
1 the sketch, at the bottom, uses log instead of log10
2 are you sure that RL_VALUE is 5 (kOhm) in your MQ-2 board? In my is 1, the one labeled 102 in the pic.Regards

-
1 look at the last line of the sketch:
return (pow(10, ( ((log(rs_ro_ratio) - pcurve[1]) / pcurve[2]) + pcurve[0]))); }``change to:
return (pow(10, ( ((log10(rs_ro_ratio) - pcurve[1]) / pcurve[2]) + pcurve[0]))); }``2 RL_VALUE in your MQ2 board should be 1 (kohm), R2 in the schematic.

-
1 look at the last line of the sketch:
return (pow(10, ( ((log(rs_ro_ratio) - pcurve[1]) / pcurve[2]) + pcurve[0]))); }``change to:
return (pow(10, ( ((log10(rs_ro_ratio) - pcurve[1]) / pcurve[2]) + pcurve[0]))); }``2 RL_VALUE in your MQ2 board should be 1 (kohm), R2 in the schematic.

-
yes, R2 is 1k. Change RL_VALUE from 5 to 1.

I suggest you use the MQ-2 sensor library https://github.com/xerlay11/MQ-2-sensor-library and obviously change log and RL_VALUE.
Regards -
yes, R2 is 1k. Change RL_VALUE from 5 to 1.

I suggest you use the MQ-2 sensor library https://github.com/xerlay11/MQ-2-sensor-library and obviously change log and RL_VALUE.
Regards -
@zampedro
hi friend after some day i have problem again with gas sensors mq2.
i use a air bag (full of gas) and put gas sensor in bag. some minutes i have 0ppm but after some minutes this is several report :

i change RL_VALUE to 1 and use log10 in sketch but.... -
@zampedro
hi friend after some day i have problem again with gas sensors mq2.
i use a air bag (full of gas) and put gas sensor in bag. some minutes i have 0ppm but after some minutes this is several report :

i change RL_VALUE to 1 and use log10 in sketch but.... -
i test again today. with a bag full of gas. but today gas sensor is 0 ppm and dont change :( what is problem ! thank you
-
@Reza
You are sending a 16 bits signed integer, so the maximum value is 32767.send(msg.set((int16_t)ceil(valMQ)));Try to send GAS_SMOKE instead of GAS_CO.
Pay attention to the power supply, the sensor need 5v 200mA ( i misured 130ma).@zampedro
so when must of 32767 so show me a - value ? but this is my problem yesterday.now i test again with a bag but dont any change and this is 0 ppm always . i dont use 5v pin in arduino for sensor. i use 5v from vcc power supply for vcc sensor .and power supply is 1.5A
for change to gas smoke this is enough change this line :uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO);to
uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_SMOKE);?
-
@zampedro
so when must of 32767 so show me a - value ? but this is my problem yesterday.now i test again with a bag but dont any change and this is 0 ppm always . i dont use 5v pin in arduino for sensor. i use 5v from vcc power supply for vcc sensor .and power supply is 1.5A
for change to gas smoke this is enough change this line :uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO);to
uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_SMOKE);?
@Reza
you can't convert 16 bits unsigned integers greater than 32767 into 16 bits signed integers because they're treated as negative numbers according to 2's complement math.
You must check with a multimeter VCC(for supply voltage sanity) and DOUT( for ppm reading) on the sensor board.I see two lines to be modified:
if (b == 0) { uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO); if (c == 0) { uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO); -
@Reza
you can't convert 16 bits unsigned integers greater than 32767 into 16 bits signed integers because they're treated as negative numbers according to 2's complement math.
You must check with a multimeter VCC(for supply voltage sanity) and DOUT( for ppm reading) on the sensor board.I see two lines to be modified:
if (b == 0) { uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO); if (c == 0) { uint16_t valMQ = MQGetGasPercentage(MQRead(MQ_SENSOR_ANALOG_PIN) / Ro, GAS_CO); -
@zampedro
i use AOUT in wiring !in the site and sketch told use AOUT.... do you sure i must use DOUT?

