Sensors convert physical phenomena (temperature, light, motion, pressure) into electrical signals that microcontrollers and circuits can process. Understanding sensor interfacing is crucial for building interactive systems and IoT devices.
Output continuous voltage/current proportional to measured quantity. Require ADC for microcontroller interfacing.
Output discrete ON/OFF or binary signals. Can connect directly to microcontroller GPIO.
Communicate via digital protocols (I2C, SPI, UART). Provide calibrated data with error checking.
Resistive sensors (thermistors, LDRs, FSRs) require a voltage divider to convert resistance to voltage.
Place sensor as R2 (bottom) for positive correlation, or R1 (top) for negative correlation.
Circuit: 5V → 10kΩ fixed resistor → Vout → NTC thermistor → GND
At 25°C, thermistor ≈ 10kΩ:
As temperature rises, resistance drops, Vout increases.
For 10-bit ADC with 5V reference measuring 2.5V: ADC = 512
I2C (Inter-Integrated Circuit) allows multiple sensors on a single 2-wire bus (SDA, SCL) using unique addresses.
Raw sensor signals often need conditioning before ADC sampling.
Use op-amp circuits to amplify weak signals (e.g., thermocouples, strain gauges).
Low-pass RC filters remove high-frequency noise. Cutoff frequency:
Example: R=10kΩ, C=1µF → fc = 16Hz
Convert 5V sensor signals to 3.3V microcontroller levels using voltage dividers or level shifters.