Skip to main content


Sensors and actuators are a vital part of automation; they define the performance of the entire wireless system. To perform automation without human interference, sensors and actuators need to be interfaced with microcontrollers (MCUs for short). To understand how this interfacing works, sensors, actuators & microcontrollers first need to be studied individually.

What are Sensors

As the term suggests, sensors are devices that sense or monitor the conditions in the environment and convert them into electrical signals. These signals are such that they can be provided in either analogue or digital signals. The sensors are designed to measure or sense one or multiple parameters, like temperature, moisture, humidity, smoke, light intensity, level, touch, etc. On an industrial level, sensors are used in encoders, spectrometers, container scanners, baggage scanners, radiation detectors, etc. Sensors can communicate with MCU over various protocols like CAN, I2C, SPI, and MODBUS.

What are MCUs

The basic function of an MCU is to perform specific tasks & control actions. It includes a Microprocessor, RAM, ROM & I/O ports. The selection of microcontrollers as per the project is a very crucial task. MCUs have various categories based on bit configuration, memory, instruction set, architecture etc. Intel 8031/8051, PIC1x, and Motorola MC68HC11 families are a few examples of microcontrollers.

To incorporate the idea of it, an MCU with built-in WiFi or Bluetooth like ESP32 or a separate WiFi or Bluetooth module like HC05 is needed to connect with the IoT platform.

Nowadays, MCUs are designed for specific purposes like power monitoring, liquid flow measurement, etc. and come as a System On Chip (SoC).

What are Actuators

Actuators are the devices that perform the actions once they receive the signal from the MCU. The acts can include alerting the people in the vicinity of the user in control about irregular levels of the thing being monitored, opening and/or closing doors, windows, etc, and turning on and turning off devices and appliances. They typically convert electrical signals into mechanical energy. There are different types of actuators like hydraulic, pneumatic, electrical, mechanical, thermal, magnetic, etc. Some examples of actuators are motors, stepper motors, and relays. These are used to perform the desired actions at the end, i.e. opening the door/window, turning on the lights, etc.

Interfacing Sensors and Actuators with MCUs

Essentially, interfacing sensors and actuators with MCUs means that communication is created between the sensor and actuator. The sensor sends the data collected from the surroundings to the MCU. The MCU then analyzes the data and instructs the actuator to perform or not perform the needed task.

For example, in smoke detectors with MQ2 smoke sensor modules, the buzzer is the actuator and ESP32 is the microcontroller. When the smoke present in the room is beyond the threshold value, the buzzer should buzz to send an alert to the surroundings and/or the user. MQ2 is a smoke sensor module that, when interfaced with the microcontroller, can send the smoke data in digital or analogue format. As per the application, users can set the threshold with the potentiometer present on the sensor or through software.

In digital format, the MQ2 sends data to the MCU based on this threshold, 0 when the smoke level is below the threshold, and 1 when the smoke goes beyond the threshold. On the other hand, if the sensor sends the data in analogue format, it will send the data to the ADC of the ESP32 which will then convert the analogue data to digital. As per the data received from the smoke sensor, the ESP32 will actuate the buzzer.

In the example of automatic doors used in malls and other commercial places, the type of sensor used is a motion sensor that detects the movement of the person and sends a signal to the microcontroller. Then the microcontroller processes the information and sends the signal to the actuator to open the door.


Sensors are devices that monitor, measure, or detect environmental conditions or changes. They collect and send this data to the microcontrollers to analyze and send instructions to the actuators. The actuators then perform the function or action they are set to do.

The proper interfacing of sensors and actuators with MCUs facilitates the accurate functioning of the system. As devices that support IoT are gaining popularity, so are sensor-based devices. This is because they promote functionality in a way non-sensor-based devices don’t. With the help of IoT technology, one can control the actuators & monitor the data from sensors in real-time from anywhere in the world.