← Back to Course
What Sensors Measure
🔍 What Sensors Measure - The "Eyes and Ears" of IoT
🔍 What You'll Learn:
- 📡 Understand what sensors are and how they work as the "eyes and ears" of IoT
- 🌾 Learn about common agricultural sensors: temperature, humidity, soil moisture, light
- 🔧 Discover how sensors connect to microcontrollers like ESP32
- 📐 Understand the critical difference between analog and digital sensors
Sensors are devices that detect and measure physical properties like temperature, moisture, light, or motion. They convert these measurements into electrical signals that computers can read. Without sensors, your IoT system would be blind and deaf - unable to know what's happening in your fields.
🌾 Common Agricultural Sensors
- 🌡️ Temperature Sensor (DS18B20, DHT22): Measures air, soil, or water temperature. Use for crop storage monitoring, planting timing, frost alerts, and heat stress detection.
- 💧 Humidity Sensor (DHT22, BME280): Measures moisture in the air. Use for disease prediction (high humidity = fungus risk), drying crops, and greenhouse climate control.
- 🌱 Soil Moisture Sensor (Capacitive): Measures water content in soil. Use for irrigation timing, water conservation, preventing over/under watering, and drought monitoring.
- ☀️ Light Sensor (LDR, BH1750): Measures sunlight intensity. Use for greenhouse automation (open/close shades), determining crop shade needs, and solar radiation tracking.
- 🌧️ Rain Sensor (FC-37): Detects rainfall. Use for skipping irrigation when raining, flood alerts, and weather monitoring.
- 📊 Barometric Pressure Sensor (BMP280): Measures atmospheric pressure. Use for weather forecasting (dropping pressure = rain coming).
- 💨 Anemometer (Wind Sensor): Measures wind speed. Use for spraying safety (don't spray in high wind), evapotranspiration calculations.
💡 Sensor Selection Guide - Start with These 3:
- 1️⃣ Soil Moisture Sensor ($8-12): Most important for irrigation decisions
- 2️⃣ DHT22 ($5-6): Measures temperature + humidity (covers 80% of needs)
- 3️⃣ Rain Sensor ($3): Prevents wasted water by skipping irrigation when raining
🔧 How Sensors Connect to Microcontrollers
Most agricultural sensors connect to a microcontroller like ESP32 or ESP8266. The microcontroller reads the sensor value and converts it to meaningful data.
- Wiring: Sensors typically have 3 wires: VCC (power), GND (ground), and Signal (data)
- Power requirements: Most sensors work with 3.3V or 5V - ESP32 provides both
- Reading process: Microcontroller reads sensor value (e.g., "234") and converts to meaningful data (e.g., "35% moisture")
- Communication protocols: Digital sensors use I2C, OneWire, or UART; analog sensors use ADC pins
- Multiple sensors: One ESP32 can connect to 10+ sensors simultaneously
📐 Important Concept: Analog vs Digital Sensors
- 📊 Analog Sensors: Give a range of values (0-4095 on ESP32). You need to convert these numbers to real units. Examples: Soil moisture sensor (capacitive), LDR light sensor, NTC thermistor.
- 💻 Digital Sensors: Give ready-to-use values directly (e.g., 25.5°C). No conversion needed. Examples: DHT22 (temperature/humidity), DS18B20, BMP280.
- Which to choose? Digital sensors are easier to code. Analog sensors are cheaper but need calibration.
📖 Case Study - Sensor Selection Saves Money:
A farmer wanted to monitor soil moisture across 5 zones. Two options:
- 💡 Option A (Resistive sensors): $2 each × 5 = $10 total
Problem: Corroded within 3 months, needed replacement - ✅ Option B (Capacitive sensors): $10 each × 5 = $50 total
Result: Still working after 2+ years, no corrosion
Spending $40 more upfront saved $100+ in replacement costs over 2 years. Choose quality sensors!
⚠️ Common Sensor Mistakes:
- ❌ Buying resistive soil moisture sensors: They corrode in months. Buy capacitive sensors (last years).
- ❌ Forgetting pull-up resistors: DHT22 and DS18B20 need 10kΩ pull-up resistors to work.
- ❌ Wrong voltage: Some sensors need 5V, some need 3.3V. Check specs!
- ❌ Not calibrating analog sensors: Every analog sensor is different. Always calibrate!
- ❌ Reading sensors too fast: DHT22 needs 2 seconds between readings. Reading faster gives errors.
💡 Sensor Connection Quick Reference:
- 🌡️ DHT22 (Temp/Humidity): 1-wire, needs 10kΩ pull-up, uses GPIO pin
- 💧 Soil Moisture (Capacitive): Analog output → ADC pin (GPIO32-39)
- 🌡️ DS18B20 (Soil Temp): 1-wire, needs 4.7kΩ pull-up, multiple sensors on one pin
- 📊 BMP280 (Pressure): I2C (SDA, SCL), multiple sensors on same pins
- 🌧️ Rain Sensor: Digital output (LOW = rain) + Analog for intensity
🎯 Key Takeaways:
- ✅ Sensors are the "eyes and ears" of IoT - they measure physical properties
- ✅ Start with 3 sensors: Soil moisture + DHT22 + Rain sensor (under $20 total)
- ✅ Digital sensors give ready-to-use values; analog sensors need calibration
- ✅ Capacitive soil moisture sensors last YEARS; resistive sensors fail in months
- ✅ One ESP32 can connect to 10+ sensors simultaneously
- ✅ Always check voltage requirements (3.3V vs 5V) before connecting
Next lesson: How Data Travels - From Sensor to Smartphone
💡 Key Takeaways:
- Apply these concepts directly to your farm or project.
- Take notes on important details for the quiz.
- Use the button below to track your progress.
×