Usage of Sensors in an Embedded Systems

Usage of Sensors in an Embedded Systems

Sensors are fundamental to the functionality of embedded systems. These components enable embedded systems to interact with the physical world, providing the necessary inputs and outputs to perform specific tasks. In this blog, we will delve into the importance of sensors, the process of integrating them into embedded systems, and the challenges and future trends in this field.

Understanding Sensors

Sensors: Capturing the Physical World

Sensors are devices that detect and measure physical properties such as temperature, pressure, light, and motion, converting these measurements into electrical signals that can be processed by an embedded system. Common types of sensors include:

Temperature Sensors:

Measure temperature to monitor and control environmental conditions. These sensors provide an analog output equivalent to the ambient temperature. This should be connected to an analog input of the microcontroller in order to read an analog value and convert it to temperature.
Examples – Thermostats, Weather stations
Some of the temperature sensors available in the market:

  • LM 35 series

Example C code to read temperature from a temperature sensor

 

Output
We will see the temperature display on the serial port monitor, which is updated every second.

    • Pressure Sensors:

      It’s a device that detects and measures the force exerted by a liquid or gas (pressure) and converts that information into an electrical signal, allowing for monitoring and regulation of the applied pressure. The pressure sensor is connected to the microcontroller using the serial clock SCL and serial data SDA and reads the pressure information.

      Examples

      • In a car, pressure sensors are primarily used within the seat belt system to detect if a passenger is seated and properly buckled in, triggering a warning signal if the seat belt is not fastened. This acts as a “seat occupancy sensor” that alerts the driver when someone is sitting in a seat without wearing their seat belt. This is achieved by measuring the pressure exerted on the seat when someone sits down.

      Some of the pressure sensors available in the market:

      • Seat belt gauge, Bourdon tube pressure gauge

      Example C code to read pressure using a pressure sensor

Output
Read the pressure value on the serial monitor

 

    • Light Sensors:

      It measures light intensity and converts it into electrical signals.

      Examples:

      • Photoresistor used in automatic street lights, also called a Light Dependent Resistor (LDR). The photoresistors work similarly to regular resistors, but the resistance change depends on the amount of light intensity it is exposed to.
      • High light intensity will cause lower resistance, while low light intensity results in higher resistance. This working principle can be seen in applications such as street lamps, wherein during the day, the high light intensity results in lower resistance, and thus they are not lit up when the sun is still shining brightly. During the night, as there is no sunlight, the LDR will result in high resistance, and thus they light up the street light.
      • UV light sensor used in ultraviolet exposure monitoring in the sunlight.

      Some of the light sensors available in the market:

      • LDR made from cadmium sulphide

      Example C code to use LDR to turn on/off light

Output
We will check the LED status being controlled by the LDR.

 

    • Motion Sensors:

      These are used to detect movement within a specific area, triggering actions like turning on lights when someone enters a room, activating security alarms when unauthorized movement is detected, or collecting data on activity levels, essentially allowing the system to interact with its environment based on changes in motion. A motion sensor detects movement by measuring changes in the environment, like infrared radiation or microwave reflections. The sensor sends this data to an embedded microcontroller, which processes the information and triggers a corresponding action.

      Examples:

      • Security systems: Triggering alarms when movement is detected in restricted areas
      • Industrial automation: Monitoring machinery for abnormal movement
      • Energy efficiency: Switching off lights when no motion is detected

      Some of the motion sensors available in the market:

      • Passive Infrared (PIR) sensor, which detects changes in infrared radiation emitted by warm objects like humans

      Example C code to use motion sensor to detect motion

Output
We will control the LED status using the motion sensor status.

Conclusion

The usage of sensors is pivotal in harnessing the full potential of embedded systems. It has enabled embedded systems to interact intelligently with their environment, providing real-time monitoring, control, and data collection capabilities. Despite challenges like compatibility issues and power management, advancements in technology are paving the way for more efficient and sophisticated integrations. As IoT, edge computing, and smart technologies continue to evolve, the role of sensors  in embedded systems will become even more significant, driving innovation and expanding the horizons of what embedded systems can achieve.