Microcontrollers are used in home automation for controlling devices such as lights and door locks, and for monitoring environments through sensors like temperature and humidity sensors.