Sensors in Electronics
1. Introduction
A sensor is an electronic device that detects changes in its surroundings and converts them into a signal that can be measured or processed by an electronic system.
Sensors can detect physical conditions such as temperature, light, sound, pressure, humidity, distance, motion, and gas concentration.
Sensors are important components in electronics, robotics, automation, and the Internet of Things (IoT). They allow electronic devices to collect information from the real world and respond automatically.
For example, a temperature sensor can measure room temperature, while a distance sensor can detect an object in front of a robot.
Mini Sensor Kit With Pir Ultrasonic Sensor Ir Sensor Ldr | Desertcart INDIA
Esp32 Air Monitor : 6 Steps - Instructables
11
2. Definition of a Sensor
A sensor is a device that detects a physical, chemical, or biological quantity and converts it into a corresponding output signal.
The output may be:
- Analog: A continuously varying voltage or current.
- Digital: A signal representing discrete states or digital data.
- Communication data: Measurements transmitted through protocols such as I²C, SPI, or UART.
Examples include an LDR that responds to light intensity, a DHT11 that measures temperature and humidity, and an ultrasonic sensor that estimates distance.
3. How Does a Sensor Work?
Most sensor systems follow a simple process.
1. Physical quantity
Heat, light, pressure, movement, or distance
2. Sensor element
Detects a change in the environment
3. Signal processing
Converts or processes the detected signal
4. Output or action
Display a reading or control another device
For example, in an automatic lighting system, a light sensor measures the brightness of a room. A microcontroller processes the measurement and switches on a lamp when the room becomes dark.
4. Types of Sensors
Sensors can be classified according to the quantity they detect, their output, and their operating principle.
4.1 Classification by Measured Quantity
Temperature and humidity sensors
Measure temperature and moisture in the air.
Examples: DHT11, DHT22, DS18B20
📝 Conocimientos teóricos. | EducaShield
Light sensors
Detect light intensity and changes in brightness.
Examples: LDR, BH1750, photodiode
HC-SR04 Ultrasonic Distance Sensor - Thingbits India
Distance sensors
Estimate the distance between a sensor and an object.
Examples: HC-SR04, VL53L0X
Sensor PIR de Movimento HC-SR501 100° 3 a 7m - Usinainfo
Motion sensors
Detect movement, often by sensing changes in infrared radiation.
Example: HC-SR501 PIR sensor
Gas and smoke sensors
Respond to certain gases or smoke-related conditions.
Example: MQ-2 sensor module
MPU 6050 3 Axis Digital Gyroscope Accelerometer Sensor Module - EPH
Motion and orientation sensors
Measure acceleration, rotation, tilt, or orientation.
Example: MPU6050
Other common types include pressure sensors, sound sensors, touch sensors, magnetic sensors, water-level sensors, rain sensors, soil-moisture sensors, and force sensors.
4.2 Classification by Output
| Type | Description | Example |
|---|---|---|
| Analog sensor | Produces a continuously varying signal | LDR voltage-divider circuit |
| Digital sensor | Produces digital states or digital data | DHT22 |
| Smart sensor | Includes processing or communication capabilities | BME280 module |
A sensor module may provide both analog and digital outputs, depending on its design.
4.3 Classification by Power Requirement
- Active sensors: Require an external power source to operate or generate their measurement signal. Many electronic sensor modules fall into this category.
- Passive sensors: Can generate an electrical response from the measured quantity without requiring external excitation for the sensing element itself. A thermocouple is a common example.
Note that the terms active and passive can have different meanings in different sensor classifications.
5. Common Sensors and Their Applications
| Sensor | What it detects | Common application |
|---|---|---|
| LDR | Light intensity | Automatic streetlights |
| DHT11 | Temperature and humidity | Basic weather monitoring |
| DS18B20 | Temperature | Liquid and equipment temperature measurement |
| HC-SR04 | Distance | Obstacle detection |
| PIR | Movement of warm bodies | Automatic security lighting |
| IR sensor | Infrared reflection or interruption | Line-following robots |
| MQ-2 | Response to smoke and certain gases | Experimental gas-monitoring projects |
| Soil-moisture sensor | Soil moisture level | Automatic irrigation |
| Rain sensor | Water droplets or wetness | Rain-alert systems |
| Flame sensor | Certain infrared radiation associated with flames | Educational fire-detection prototypes |
| Sound sensor | Sound level or acoustic activity | Sound-triggered systems |
| MPU6050 | Acceleration and angular velocity | Robot balancing and motion tracking |
| BMP280 | Atmospheric pressure and temperature | Weather stations |
| RFID reader | RFID tags | Access-control systems |
| Hall-effect sensor | Magnetic fields | Speed and position sensing |
The actual performance of a sensor depends on its model, circuit design, calibration, and operating environment.
6. Analog and Digital Sensors
Analog sensors
Analog sensors provide a continuously varying electrical output. A microcontroller with an analog-to-digital converter (ADC) can convert this voltage into a digital number.
For example, an LDR's resistance changes with light intensity. When connected in a voltage divider, it produces a voltage that can be measured by a microcontroller.
The voltage-divider equation is:
Here, and are the two resistances in the divider. The output depends on which resistor is connected to the supply and which is connected to ground.
Digital sensors
Digital sensors provide discrete signals or transmit measurement values digitally. Some produce a simple HIGH/LOW output, while others send numerical readings through a communication protocol.
Examples include a PIR module with a digital output and a DHT22 that sends temperature and humidity data through a digital interface.
7. Connecting Sensors to a Microcontroller
Sensors are frequently connected to Arduino, ESP32, and other microcontrollers.
Build an AI Smart Home Hub with ESP32 | WolfieWeb IoT Tutorial
A typical connection uses:
- VCC: Power supply for the sensor.
- GND: Electrical ground.
- Signal pin: Carries the measurement or output signal.
Some sensors need additional pins for interfaces such as I²C, SPI, or UART.
Before connecting a sensor, check its datasheet for supply voltage, pin configuration, current requirements, and signal levels. In particular, many ESP32 GPIO pins use 3.3 V logic and are not 5 V tolerant.
8. Applications of Sensors
Sensors are used across many fields of electronics and engineering.
- Home automation: Automatic lights, room-temperature monitoring, and security systems.
- IoT: Collecting and transmitting environmental data over a network.
- Robotics: Detecting obstacles, following lines, and balancing robots.
- Agriculture: Monitoring soil moisture and automating irrigation.
- Healthcare: Measuring physiological quantities using appropriate medical sensors.
- Automotive systems: Monitoring speed, temperature, pressure, and vehicle position.
- Industrial automation: Monitoring equipment conditions and controlling production processes.
- Weather monitoring: Measuring temperature, humidity, atmospheric pressure, and rainfall.
9. Advantages of Sensors
- Enable automatic monitoring and control.
- Reduce the need for continuous manual measurement.
- Provide real-time information.
- Improve system efficiency and responsiveness.
- Support data collection for analysis and decision-making.
- Make smart devices and IoT systems possible.
10. Limitations of Sensors
- Readings may contain noise or measurement errors.
- Some sensors require calibration.
- Environmental conditions can affect accuracy.
- Certain sensors have limited operating ranges.
- Some modules consume significant power or require warm-up time.
- Low-cost sensors may not be suitable for safety-critical applications.
11. Safety and Precautions
- Check the operating voltage before powering a sensor.
- Confirm the pinout before making connections.
- Use suitable level shifting when a signal exceeds the microcontroller's allowed voltage.
- Avoid short circuits and reverse-polarity connections.
- Calibrate sensors when accurate measurements are required.
- Do not rely on inexpensive hobby modules as certified fire, gas, or medical safety equipment.
- Disconnect power before changing circuit wiring.
12. Summary
A sensor detects a physical or environmental quantity and converts it into a signal that an electronic system can use. Sensors may measure temperature, light, distance, motion, gas, pressure, humidity, and many other quantities.
Understanding sensor types, outputs, wiring, and limitations is essential for designing electronic circuits, robotics projects, automation systems, and IoT applications.
Key point: Sensors collect information from the real world, while a microcontroller can process that information and control other devices based on it.