How do common IoT input sensors (PIR motion, ultrasonic, photocell, potentiometer, soil moisture, door switch) turn the physical world into a signal?
Some give a simple on/off digital signal (PIR, door switch), some a varying voltage read by the ADC (photocell, potentiometer, soil moisture), and the ultrasonic sensor reports distance as the length of an echo pulse.
| Sensor | Senses | How | Signal |
|---|---|---|---|
| PIR motion | A warm body moving | Detects a change in infrared radiation across its field of view | Digital high/low |
| Magnetic door switch | Door open or closed | A reed switch closes when the magnet is near | Digital, like a button |
| Ultrasonic | Distance | Sends a 40 kHz ping and times the echo: distance = time × 343 m/s ÷ 2 | Pulse width |
| Photocell (LDR) | Light level | Resistance falls as light increases | Analog, via a voltage divider |
| Potentiometer | Knob position | A variable resistor used as a voltage divider | Analog |
| Soil moisture | Water in soil | Wet soil conducts better (resistive) or changes capacitance | Analog |
| Accelerometer | Acceleration, tilt | A MEMS mass on springs | Digital over I2C/SPI |
| GPS | Position, time | Satellite signals | Text sentences (NMEA) over UART |
The pattern to take away is that a microcontroller only ever sees voltages. A resistive sensor such as a photocell has to be turned into a voltage with a second resistor (a voltage divider) before the ADC can read it, and a digital sensor has already done that conversion for you.
The piezo speaker in the same group is the opposite case: an output (actuator) the board drives, not a sensor.
Go deeper:
Adafruit — PIR motion sensor — why a PIR sees only moving heat, and how its two halves compare readings.
SparkFun — Voltage Dividers — how a resistive sensor becomes a voltage the ADC can read.