TGS2444, as96-70 sensor unable reading value

const int TELEGRAM_BUTTON_PIN =32;
int TELEGRAM_BUTTON_PINReading = 0;
void setup() {
    Serial.begin(115200);
    pinMode(TELEGRAM_BUTTON_PIN, INPUT);
}

void loop() {
  TELEGRAM_BUTTON_PINReading = analogRead(TELEGRAM_BUTTON_PIN);    // take a reading from the optical sensor pin
  Serial.println(TELEGRAM_BUTTON_PINReading);                      // the analog reading of the optical sensor
}

above is my sample code , during i running this code my serial monitor keep printing about
"
1248
1242
1236
1239
1238
1245
1233
1248
1248"
The value wont be change. I am using esp32 board connection AN2 PIN to IO32 , 5V to VCC GND TO GND.

Connect the wiper point of a variable resistor at GPIO32 of ESP32 Board. Vary the pot and check that the display changes on the Serial Monitor. Insert this code delay(1000); before the closing brace (}) of the loop() function.
esp32Pot.png

esp32Pot.png

Mrtian2:

const int TELEGRAM_BUTTON_PIN =32;

int TELEGRAM_BUTTON_PINReading = 0;
void setup() {
    Serial.begin(115200);
    pinMode(TELEGRAM_BUTTON_PIN, INPUT);
}

void loop() {
  TELEGRAM_BUTTON_PINReading = analogRead(TELEGRAM_BUTTON_PIN);    // take a reading from the optical sensor pin
  Serial.println(TELEGRAM_BUTTON_PINReading);                      // the analog reading of the optical sensor
}



I am using esp32 board connection AN2 PIN to IO32 , 5V to VCC GND TO GND.

Is this the sensor you using?

If so, you code looks likes you have recycled it from somewhere else. The naming make no sense!

but looking at the datasheet, something like this may work (untested!):
NOTE: look at the datasheet wiring of the sensor!

const uint8_t SENSOR_HEATER_ENABLE = 30; //pin to enable heater. Change pin assignment as required!
const uint8_t SENSOR_ENABLE = 31; // pin to enable sensor reading Change pin assignment as required!
const uint8_t SENSOR_READ = 32; // analog pin to read sensor
const uint8_t CYCLE_TIME = 236; // 236ms as per datasheet (250ms -14ms)
const uint8_t HEATER_ON_TIME = 14; // 14ms as per datasheet

uint16_t Sensor_Reading = 0;
unsigned long oldtime;

//IMPORTANT NOTE: following code follows the TGS2444 datasheet timing and suggested wiring circuit!!!!

void setup() {
  Serial.begin(115200);
  pinMode(SENSOR_ENABLE, INPUT);
  pinMode(SENSOR_HEATER_ENABLE, INPUT);

  digitalWrite(SENSOR_ENABLE, LOW);
  digitalWrite(SENSOR_HEATER_ENABLE, HIGH);

}

void loop() {

  oldtime = millis();

  digitalWrite(SENSOR_HEATER_ENABLE, LOW); //enable sensor heater

  delay(2);                          //delay as per data sheet

  digitalWrite(SENSOR_ENABLE, HIGH); //enable sensor for readout

  delay(5);                          //delay as per data sheet

  Sensor_Reading = analogRead(SENSOR_READ);    //take a reading from the optical sensor pin

  digitalWrite(SENSOR_ENABLE, LOW);            //disable sensor

  while (oldtime - millis() < HEATER_ON_TIME); //14ms delay as per data sheet. using millis to compensate for other delays

  oldtime = millis();

  digitalWrite(SENSOR_HEATER_ENABLE, HIGH); //disable sensor heater

  Serial.println(Sensor_Reading);           // the analog reading of the optical sensor

  while (oldtime - millis() < CYCLE_TIME); //236ms delay as per data sheet. using millis to compensate for other delays

}

sherzaad:
Is this the sensor you using?

Gas Sensors / FIGARO Engineering inc. World leader in gassensing innovation

If so, you code looks likes you have recycled it from somewhere else. The naming make no sense!

but looking at the datasheet, something like this may work (untested!):
NOTE: look at the datasheet wiring of the sensor!

const uint8_t SENSOR_HEATER_ENABLE = 30; //pin to enable heater. Change pin assignment as required!

const uint8_t SENSOR_ENABLE = 31; // pin to enable sensor reading Change pin assignment as required!
const uint8_t SENSOR_READ = 32; // analog pin to read sensor
const uint8_t CYCLE_TIME = 236; // 236ms as per datasheet (250ms -14ms)
const uint8_t HEATER_ON_TIME = 14; // 14ms as per datasheet

uint16_t Sensor_Reading = 0;
unsigned long oldtime;

//IMPORTANT NOTE: following code follows the TGS2444 datasheet timing and suggested wiring circuit!!!!

void setup() {
  Serial.begin(115200);
  pinMode(SENSOR_ENABLE, INPUT);
  pinMode(SENSOR_HEATER_ENABLE, INPUT);

digitalWrite(SENSOR_ENABLE, LOW);
  digitalWrite(SENSOR_HEATER_ENABLE, HIGH);

}

void loop() {

oldtime = millis();

digitalWrite(SENSOR_HEATER_ENABLE, LOW); //enable sensor heater

delay(2);                          //delay as per data sheet

digitalWrite(SENSOR_ENABLE, HIGH); //enable sensor for readout

delay(5);                          //delay as per data sheet

Sensor_Reading = analogRead(SENSOR_READ);    //take a reading from the optical sensor pin

digitalWrite(SENSOR_ENABLE, LOW);            //disable sensor

while (oldtime - millis() < HEATER_ON_TIME); //14ms delay as per data sheet. using millis to compensate for other delays

oldtime = millis();

digitalWrite(SENSOR_HEATER_ENABLE, HIGH); //disable sensor heater

Serial.println(Sensor_Reading);          // the analog reading of the optical sensor

while (oldtime - millis() < CYCLE_TIME); //236ms delay as per data sheet. using millis to compensate for other delays

}

thanks i will try for it .

sherzaad:
Is this the sensor you using?

Gas Sensors / FIGARO Engineering inc. World leader in gassensing innovation

If so, you code looks likes you have recycled it from somewhere else. The naming make no sense!

but looking at the datasheet, something like this may work (untested!):
NOTE: look at the datasheet wiring of the sensor!

const uint8_t SENSOR_HEATER_ENABLE = 30; //pin to enable heater. Change pin assignment as required!

const uint8_t SENSOR_ENABLE = 31; // pin to enable sensor reading Change pin assignment as required!
const uint8_t SENSOR_READ = 32; // analog pin to read sensor
const uint8_t CYCLE_TIME = 236; // 236ms as per datasheet (250ms -14ms)
const uint8_t HEATER_ON_TIME = 14; // 14ms as per datasheet

uint16_t Sensor_Reading = 0;
unsigned long oldtime;

//IMPORTANT NOTE: following code follows the TGS2444 datasheet timing and suggested wiring circuit!!!!

void setup() {
  Serial.begin(115200);
  pinMode(SENSOR_ENABLE, INPUT);
  pinMode(SENSOR_HEATER_ENABLE, INPUT);

digitalWrite(SENSOR_ENABLE, LOW);
  digitalWrite(SENSOR_HEATER_ENABLE, HIGH);

}

void loop() {

oldtime = millis();

digitalWrite(SENSOR_HEATER_ENABLE, LOW); //enable sensor heater

delay(2);                          //delay as per data sheet

digitalWrite(SENSOR_ENABLE, HIGH); //enable sensor for readout

delay(5);                          //delay as per data sheet

Sensor_Reading = analogRead(SENSOR_READ);    //take a reading from the optical sensor pin

digitalWrite(SENSOR_ENABLE, LOW);            //disable sensor

while (oldtime - millis() < HEATER_ON_TIME); //14ms delay as per data sheet. using millis to compensate for other delays

oldtime = millis();

digitalWrite(SENSOR_HEATER_ENABLE, HIGH); //disable sensor heater

Serial.println(Sensor_Reading);          // the analog reading of the optical sensor

while (oldtime - millis() < CYCLE_TIME); //236ms delay as per data sheet. using millis to compensate for other delays

}

same things seems not work same value. TGS2603