Scroll down for more guides

Part 5 · Advanced Home Automation 6 min read

A microcontroller board with Wi-Fi, wired to a temperature sensor and a light

Small, Inexpensive Computers That Connect Sensors and Switches

Inside almost every smart plug, sensor and switch there is a small computer called a microcontroller. It reads inputs, controls outputs and communicates with the network.

Microcontroller boards can also be bought on their own, inexpensively, and programmed to do exactly what you need: measure the temperature in the greenhouse, count the pulses from an electricity meter, open a garage door or control a pump.

The ESP32 family from Espressif has become one of the most popular choices for this kind of home automation. This guide explains what microcontrollers are, what makes the ESP32 so useful and how to get started.

1. What Is a Microcontroller?

A microcontroller is a complete small computer on one chip: a processor, memory and many input and output connections, called pins or GPIOs (general-purpose inputs and outputs).

Unlike a PC or a Raspberry Pi, a microcontroller does not run a full operating system. It runs one program, starts in a fraction of a second and uses very little power. That makes it ideal for dedicated tasks that must run reliably around the clock.

Microcontroller (e.g. ESP32)Single-board computer (e.g. Raspberry Pi)
RunsOne program, no full operating systemA full operating system such as Linux
Start-up timeUnder a secondTens of seconds
Power useVery low, can sleep on batteriesHigher, needs constant power
Typical roleSensor node, switch, controller for one taskHome automation server, cameras, many tasks

2. Why the ESP32 Is So Popular

The ESP32 combines several features that suit home automation well:

  • Built-in wireless – Wi-Fi and Bluetooth Low Energy on the chip, and on some newer variants also the radio used by Zigbee and Thread.
  • Many inputs and outputs – for buttons, relays, LEDs and sensors.
  • Useful peripherals – analogue inputs, PWM outputs for dimming, and standard interfaces such as I²C, SPI and UART for connecting sensors.
  • Low power modes – deep sleep allows battery-powered sensors.
  • Low cost and wide support – inexpensive development boards and a very large community with examples and libraries.

3. The ESP32 Family

There are several ESP32 variants. The right choice depends on what the device needs to do:

VariantMain FeaturesTypical Use
ESP32 (original)Dual-core, Wi-Fi, BluetoothGeneral-purpose projects, very widely documented
ESP32-S3Dual-core, Wi-Fi, Bluetooth LE, more processing powerDisplays, voice and camera projects
ESP32-C3Single-core, Wi-Fi, Bluetooth LE, low costSimple sensors and switches
ESP32-C6Wi-Fi 6, Bluetooth LE and an IEEE 802.15.4 radioDevices for Wi-Fi, Zigbee or Thread
ESP32-H2Bluetooth LE and an IEEE 802.15.4 radio, no Wi-FiLow-power Zigbee or Thread devices

Check the specifications of the exact variant and board you buy, as features and pin layouts differ.

4. Pins, Voltages and Limits

Working with the pins requires some care:

  • ESP32 pins work at 3.3 volts. Connecting 5 V or higher signals directly can damage the chip – use a level shifter or a voltage divider.
  • A pin can only supply a small current. Never power motors, relay coils or long LED strips directly from a pin; use a transistor, a MOSFET or a ready-made driver module (see Guide 24).
  • Some pins have special functions during start-up. Connecting the wrong component to them can prevent the board from starting or make outputs switch briefly at boot.
  • On some variants, certain pins can only be used as inputs, and some analogue inputs cannot be used while Wi-Fi is active.

Always look up the pin table for your exact board before wiring. The documentation from Espressif and the board maker shows which pins are safe to use.

5. Power Supply and Sleep

Most ESP32 development boards are powered through USB at 5 volts, and a regulator on the board provides 3.3 volts for the chip.

  • For permanent installations, use a good-quality power supply with enough capacity – Wi-Fi transmissions cause short peaks in current.
  • For battery-powered sensors, use deep sleep: the ESP32 wakes up, takes a measurement, sends it and goes back to sleep. Wi-Fi uses a lot of energy, so the time awake should be as short as possible.
  • Development boards often have components such as USB chips and power LEDs that use power even in sleep. For long battery life, choose a board designed for low power.

6. Ready-Made Firmware or Your Own Code

There are two main ways to give an ESP32 its function:

ApproachExamplesBest For
Configuration-based firmwareESPHome, TasmotaMost home automation projects; little or no programming needed
Your own programArduino framework, ESP-IDF, MicroPythonSpecial functions, unusual hardware, learning

ESPHome describes the device in a short configuration file – which sensors are connected to which pins – and builds the firmware automatically. It integrates closely with Home Assistant. Tasmota is widely used on smart plugs and relay boards and is configured through a web page; it communicates well with MQTT.

Writing your own program gives complete freedom but requires more knowledge. Guide 27 covers programming and custom automation logic.

7. Connecting to the Home Automation System

An ESP32 device can report to and receive commands from a controller in several ways:

  • Native integration – for example ESPHome devices are discovered by Home Assistant automatically.
  • MQTT – the device publishes values and subscribes to commands (see Guide 7).
  • HTTP or other local interfaces – the controller polls or calls the device over the network.
  • Zigbee, Thread or Matter – possible on variants with the right radio and suitable firmware.

8. Before You Start

  • Start with low-voltage projects – sensors, LEDs and buttons – before controlling anything connected to the mains.
  • Use a breadboard and a development board for experiments, and build permanent devices only when the design works.
  • Plan how the device will be updated: most firmware supports updates over Wi-Fi (OTA), so it does not need to be removed from its location.
  • Keep passwords and keys out of shared code and configuration files.
  • Remember that devices you build yourself have no manufacturer’s approval. For anything connected to the mains, follow the regulations where you live and get help from a qualified electrician.

Final Thoughts

Microcontrollers are small, inexpensive computers that read sensors, control outputs and communicate with the network. The ESP32 family combines built-in wireless, many pins and low power modes, which has made it a favourite for home automation projects.

Pay attention to voltages, pin functions and power supply, choose ready-made firmware such as ESPHome or Tasmota for most projects, and write your own code when you need something special.

Start small and safe, and microcontrollers can fill the gaps that ready-made products cannot.

MISOLIMA® – Technology Made Practical.

Practical knowledge for understanding, designing and building home automation.