Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use TGS822 Gas Sensor: Examples, Pinouts, and Specs

Image of TGS822 Gas SensorDesign with TGS822 Gas Sensor in Cirkit Designer

Introduction

The TGS822 is a gas sensor designed to detect various combustible gases, including methane, propane, and other hydrocarbons. It operates on the principle of resistive change, where the sensor's resistance varies in the presence of target gases. This makes it an ideal choice for applications such as gas leak detection, air quality monitoring, and industrial safety systems. Its compact design and high sensitivity make it suitable for both consumer and industrial use.

Explore Projects Built with TGS822 Gas Sensor

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of ESP32-Based Environmental Monitoring System with Multiple Sensors and OLED Display: A project utilizing TGS822 Gas Sensor in a practical application
ESP32-Based Environmental Monitoring System with Multiple Sensors and OLED Display

This circuit is an environmental monitoring system that uses an ESP32 microcontroller to collect data from various sensors, including gas sensors (MQ-135, MQ-136), a humidity and temperature sensor (DHT11), a VOC and NOx sensor (SGP41), and a color sensor (TCS230). The collected data is displayed on an OLED screen and can be transmitted via Bluetooth, with the ESP32 also handling RF signal decoding and transmission.

Open Project in Cirkit Designer
Image of ESP32-Based Multi-Gas Detection System: A project utilizing TGS822 Gas Sensor in a practical application
ESP32-Based Multi-Gas Detection System

This circuit is designed for environmental sensing, featuring an ESP32 microcontroller connected to various gas sensors (MQ-7 for carbon monoxide, MQ-135 for air quality, MQ-131 for ozone) and a particulate matter sensor (GP2Y1010AU0F). Additionally, it includes a DHT22 sensor for measuring temperature and humidity. The ESP32 reads analog outputs from the gas sensors and the particulate matter sensor, and a digital signal from the DHT22, to monitor and analyze environmental conditions.

Open Project in Cirkit Designer

Common Applications:

Technical Specifications

Key Technical Details:

Parameter Value
Target Gases Methane, Propane, Combustible Gases
Operating Voltage 5V DC
Heater Voltage (VH) 5V DC
Heater Resistance (RH) 33Ω ± 5Ω
Heater Power Consumption ~350mW
Sensing Resistance (RS) 10kΩ to 100kΩ (in clean air)
Operating Temperature -10°C to 50°C
Humidity Range 30% to 95% RH (non-condensing)
Response Time ≤ 30 seconds
Dimensions 16mm diameter, 17mm height

Pin Configuration and Descriptions:

The TGS822 gas sensor has six pins, as described in the table below:

Pin Number Label Description
1 H1 Heater pin 1 (connect to 5V DC)
2 A Sensing element pin (connect to load resistor)
3 B Sensing element pin (connect to load resistor)
4 H2 Heater pin 2 (connect to ground)
5, 6 NC Not connected (leave unconnected)

Usage Instructions

How to Use the TGS822 in a Circuit:

  1. Power the Heater: Connect pin H1 to a 5V DC power supply and pin H2 to ground. This powers the internal heater, which is necessary for the sensor to operate.
  2. Connect the Sensing Element:
    • Connect a load resistor (typically 10kΩ) between pin A and ground.
    • Connect pin B to the positive terminal of the power supply (5V DC).
    • The voltage across the load resistor will vary depending on the concentration of the target gas.
  3. Read the Output: Measure the voltage across the load resistor using an analog input pin of a microcontroller or an ADC (Analog-to-Digital Converter). This voltage corresponds to the gas concentration.

Important Considerations:

Example Code for Arduino UNO:

// TGS822 Gas Sensor Example Code for Arduino UNO
// This code reads the analog voltage from the sensor and prints it to the Serial Monitor.

const int sensorPin = A0; // Analog pin connected to the sensor's output
const int heaterPin = 9;  // Digital pin to control the heater (optional)

void setup() {
  Serial.begin(9600);       // Initialize serial communication at 9600 baud
  pinMode(heaterPin, OUTPUT); // Set heater pin as output
  digitalWrite(heaterPin, HIGH); // Turn on the heater
}

void loop() {
  int sensorValue = analogRead(sensorPin); // Read the analog value from the sensor
  float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage (5V reference)
  
  // Print the sensor value and voltage to the Serial Monitor
  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");
  
  delay(1000); // Wait for 1 second before the next reading
}

Notes:

Troubleshooting and FAQs

Common Issues and Solutions:

  1. No Output or Constant Readings:

    • Cause: The heater is not powered or improperly connected.
    • Solution: Verify the connections to pins H1 and H2. Ensure the heater is receiving 5V DC.
  2. Inconsistent Readings:

    • Cause: Insufficient preheating time or unstable power supply.
    • Solution: Allow the sensor to preheat for at least 24 hours. Use a stable 5V DC power source.
  3. High Baseline Resistance:

    • Cause: Contaminants on the sensor or improper calibration.
    • Solution: Clean the sensor environment and recalibrate in clean air.
  4. Sensor Saturation:

    • Cause: Exposure to high concentrations of gas for extended periods.
    • Solution: Remove the sensor from the high-gas environment and allow it to recover in clean air.

FAQs:

By following the guidelines and best practices outlined in this documentation, you can effectively integrate the TGS822 gas sensor into your projects for reliable gas detection.