Course Content
IoT Engineering Course using ESP32 with 12 Real-World Projects

πŸ“˜Sensor & Circuit (ESP32 + MQ3 )

🎯 Objective of This Lesson

In this lesson, students will learn:

  • How to connect MQ3 gas sensor to ESP32

  • How to use Analog Output (AO)

  • How ESP32 reads gas concentration

  • Basic hardware setup and safety precautions

This is the foundation before writing code.


πŸ§ͺ Components Required

  • ESP32 Development Board

  • MQ3 Gas Sensor Module

  • Breadboard

  • Jumper wires

  • USB cable

No buzzer.
No LED.
Only sensor and microcontroller.


🧠 About MQ3 Sensor (Quick Revision)

MQ3 is mainly used to detect:

  • Alcohol vapor

  • Ethanol gas

  • Smoke (moderate sensitivity)

It provides:

  • Analog output (continuous value)

  • Digital output (HIGH/LOW threshold)

For this project, we will use:

πŸ‘‰ Analog Output (AO)

Because ESP32 has built-in ADC (Analog to Digital Converter).


πŸ”Œ MQ3 Pin Description

Most MQ3 modules have 4 pins:

Pin Function
VCC 5V power
GND Ground
AO Analog Output
DO Digital Output

In this lesson, we use only:

  • VCC

  • GND

  • AO


πŸ”Œ Circuit Connections (ESP32 + MQ3)

πŸ“ Connection Table

MQ3 Pin ESP32 Pin
VCC 5V
GND GND
AO GPIO 34

🧠 Why GPIO 34?

  • GPIO 34 is input-only

  • Supports analog reading

  • Perfect for sensor input

  • ADC range: 0 – 4095


⚑ Power Considerations

Important points for students:

1️⃣ MQ3 must be powered with 5V
2️⃣ ESP32 analog pins work at 3.3V logic
3️⃣ MQ3 module AO output is safe for ESP32
4️⃣ Do NOT connect MQ3 VCC to 3.3V


πŸ”¬ How the Circuit Works

1️⃣ MQ3 sensor heats its internal element
2️⃣ Gas interacts with sensing material
3️⃣ Sensor resistance changes
4️⃣ Output voltage changes
5️⃣ ESP32 reads analog value from GPIO 34
6️⃣ Higher gas concentration β†’ Higher ADC value

So internally:

Gas ↑ β†’ Voltage ↑ β†’ ADC value ↑


πŸ“Š What ESP32 Will Read

ESP32 ADC gives values between:

0 to 4095

Example readings:

Condition Approx ADC Value
Clean Air 200–400
Mild Gas 800–1200
High Gas 2000+

(Values may vary depending on environment.)


⏳ Warm-Up Requirement

Before taking readings:

  • Wait 30–60 seconds after power ON

  • Sensor needs heating time

  • For best stability β†’ 24-hour initial burn-in

Explain this clearly to students.


⚠ Safety Instructions

When testing:

  • Use small alcohol vapor

  • Do not pour liquid directly on sensor

  • Keep room ventilated

  • Avoid high flame near sensor


πŸŽ“ Learning Outcomes

After completing this lesson, students will understand:

  • Analog sensor interfacing

  • ESP32 ADC concept

  • Gas sensing basics

  • Hardware connection principles

  • Importance of power stability

Scroll to Top