Arduino Sensor Modules Explained: Ultrasonic, PIR, Gas, Flame, Sound, Soil Moisture and More
What each popular Arduino sensor module does and where it is used: HC-SR04 ultrasonic, HC-SR501 PIR motion, MQ-2 gas, KY-026 flame, KY-038 sound, soil moisture, water level, IR obstacle and touch sensors.
2 min readBy the module.pk teamاردو میں پڑھیں ↓
Browse all 11 Sensor Modules
Sensors are how an Arduino or ESP32 project knows what is happening around it. A sensor module puts the sensor together with the small circuit it needs on one board with labelled pins, so you connect three or four wires and read it in code. No extra components, no guesswork.
This guide explains the sensor modules students and makers use most, what each one detects and the projects it suits. You can see all of them on our sensor modules page.
Digital and analog outputs
Many modules give two outputs. The digital output (DO) switches high or low when the reading crosses a threshold you set with the small blue potentiometer on the board. The analog output (AO) gives the actual level, which you read with analogRead() for finer control. Most work on 3.3V to 5V, so they suit Arduino, ESP8266 and ESP32 alike.
The most popular sensor modules and what they do
| Sensor | Detects | Used in |
|---|---|---|
| HC-SR04 ultrasonic | Distance, about 2cm to 4m | Obstacle avoiding robots, parking sensors, water tank level |
| HC-SR501 PIR | Human movement | Security alarms, automatic lights |
| MQ-2 gas and smoke | LPG, methane, smoke | Gas leak alarms in kitchens |
| KY-026 flame | Infrared light from a flame | Fire alarms, fire fighting robots |
| KY-038 sound | Sound level | Clap switches, noise monitors |
| Soil moisture | Water in soil | Automatic plant watering |
| Water level | Water depth on its pads | Overflow and rain alarms |
| HW-201 IR | Nearby objects and black lines | Line following robots |
| KY-036 metal touch | A touch on its metal pin | Touch switches |
| Vibration LM393 | Shaking and knocks | Anti theft alarms |

Tips for reliable sensor readings
- Preheat gas sensors: an MQ-2 needs a few minutes of warm up before its readings settle.
- Avoid soil sensor corrosion: power the soil moisture sensor only when reading it, to make the probe last longer.
- Adjust the potentiometer: set the threshold for the digital output in the real place the sensor will be used.
- Keep PIR sensors away from heaters and sunlight, which cause false triggers.

Filter sensors by what you need on module.pk
On our sensor modules page you can type a model like HC-SR04 or simply a word like gas or motion, and tap a quick pick tile for the sensor type: PIR motion, ultrasonic distance, gas, flame, sound or soil moisture.
The filters narrow it further by output type (digital, analog or both), operating voltage and adjustable sensitivity, so a 3.3V ESP32 project only shows sensors that work at 3.3V.
Frequently asked questions
Which sensor is used for an obstacle avoiding robot?
The HC-SR04 ultrasonic sensor for distance, or the HW-201 IR sensor for close range detection.
Do these sensors work with ESP32?
Most work from 3.3V to 5V. Use the operating voltage filter on our sensor modules page to check.
What does the potentiometer on a sensor module do?
It sets the threshold at which the digital output switches.
اردو میں
Arduino سینسر ماڈیول کی پوری سمجھ: الٹراسونک، PIR، گیس، آگ، آواز، مٹی کی نمی اور مزید
سینسر سے ہی Arduino یا ESP32 پراجیکٹ کو پتا چلتا ہے کہ آس پاس کیا ہو رہا ہے۔ سینسر ماڈیول میں سینسر اور اس کا چھوٹا سرکٹ ایک بورڈ پر ہوتا ہے، پنوں پر نام لکھے ہوتے ہیں، تو آپ تین چار تاریں جوڑ کر کوڈ میں پڑھ لیتے ہیں۔ نہ اضافی پارٹس، نہ اندازے۔
اس گائیڈ میں وہ سینسر ماڈیول ہیں جو طالب علم اور شوقین سب سے زیادہ استعمال کرتے ہیں، ہر ایک کیا پکڑتا ہے اور کس پراجیکٹ میں کام آتا ہے۔ سب ہمارے سینسر ماڈیول پیج پر ہیں۔
ڈیجیٹل اور اینالاگ آؤٹ پٹ
بہت سے ماڈیول دو آؤٹ پٹ دیتے ہیں۔ ڈیجیٹل آؤٹ پٹ (DO) تب ہائی یا لو ہوتا ہے جب ریڈنگ اس حد سے گزرے جو آپ بورڈ پر نیلے پوٹینشیومیٹر سے سیٹ کرتے ہیں۔ اینالاگ آؤٹ پٹ (AO) اصل لیول دیتا ہے، جسے analogRead() سے باریکی سے پڑھا جاتا ہے۔ زیادہ تر 3.3V سے 5V پر چلتے ہیں، اس لیے Arduino، ESP8266 اور ESP32 سب کے ساتھ لگتے ہیں۔
سب سے مشہور سینسر ماڈیول اور ان کا کام
| سینسر | کیا پکڑتا ہے | کہاں استعمال |
|---|---|---|
| HC-SR04 الٹراسونک | فاصلہ، تقریباً 2cm سے 4m | رکاوٹ سے بچنے والے روبوٹ، پارکنگ سینسر، ٹینکی کا لیول |
| HC-SR501 PIR | انسان کی حرکت | سیکیورٹی الارم، خودکار لائٹ |
| MQ-2 گیس اور دھواں | LPG، میتھین، دھواں | کچن میں گیس لیک الارم |
| KY-026 آگ | شعلے کی انفرا ریڈ روشنی | فائر الارم، آگ بجھانے والے روبوٹ |
| KY-038 آواز | آواز کا لیول | تالی سے چلنے والا سوئچ، شور ناپنا |
| مٹی کی نمی | مٹی میں پانی | پودوں کو خود پانی دینا |
| پانی کا لیول | اس کی پٹیوں پر پانی کی گہرائی | اوور فلو اور بارش کا الارم |
| HW-201 IR | قریب کی چیزیں اور کالی لکیر | لائن پر چلنے والے روبوٹ |
| KY-036 میٹل ٹچ | دھات کی پن کو چھونا | ٹچ سوئچ |
| وائبریشن LM393 | ہلنا اور ٹھوکر | چوری کا الارم |

پکی ریڈنگ کے لیے مشورے
- گیس سینسر کو گرم ہونے دیں: MQ-2 کی ریڈنگ چند منٹ گرم ہونے کے بعد ٹھیک ہوتی ہے۔
- مٹی کے سینسر کو زنگ سے بچائیں: صرف ریڈنگ کے وقت بجلی دیں تاکہ پروب زیادہ چلے۔
- پوٹینشیومیٹر سیٹ کریں: ڈیجیٹل آؤٹ پٹ کی حد اسی جگہ سیٹ کریں جہاں سینسر لگنا ہے۔
- PIR سینسر کو ہیٹر اور دھوپ سے دور رکھیں، ورنہ غلط الارم بجتا ہے۔

module.pk پر اپنی ضرورت کے سینسر فلٹر کریں
ہمارے سینسر ماڈیول پیج پر HC-SR04 جیسا ماڈل یا صرف gas یا motion جیسا لفظ لکھیں، اور سینسر کی قسم کا فوری ٹائل دبائیں: PIR حرکت، الٹراسونک فاصلہ، گیس، آگ، آواز یا مٹی کی نمی۔
فلٹر مزید آؤٹ پٹ کی قسم (ڈیجیٹل، اینالاگ یا دونوں)، وولٹیج اور حساسیت کم زیادہ ہو سکتی ہے یا نہیں سے لسٹ چھوٹی کرتے ہیں، تاکہ 3.3V کے ESP32 پراجیکٹ میں صرف 3.3V پر چلنے والے سینسر دکھیں۔
اکثر پوچھے جانے والے سوال
رکاوٹ سے بچنے والے روبوٹ میں کون سا سینسر لگتا ہے؟
فاصلے کے لیے HC-SR04 الٹراسونک سینسر، یا قریب کی چیزوں کے لیے HW-201 IR سینسر۔
کیا یہ سینسر ESP32 کے ساتھ چلتے ہیں؟
زیادہ تر 3.3V سے 5V پر چلتے ہیں۔ ہمارے سینسر ماڈیول پیج پر وولٹیج فلٹر سے چیک کریں۔
سینسر ماڈیول پر پوٹینشیومیٹر کیا کرتا ہے؟
یہ وہ حد سیٹ کرتا ہے جس پر ڈیجیٹل آؤٹ پٹ بدلتا ہے۔






