While microcontrollers are simply tiny computers, they possess one feature that standard computers don’t have, which is the ability to interface with the outside world. Through a microcontroller’s input/output pins, it’s easy to attach sensors that enable you to determine what is going on in the environment.
A sensor is an add-ons toa microcontroller that reports some kind of measurement from the environment. For example, a sensor might measure the temperature and humidity in the air. Some common sensors include: temperature and humidity, water level (or presence of water), light, motion, soil moisture, vibration, acceleration, position, sound, distance/proximity.
Some sensors provide digital data, such as some motion sensors. The sensor will usually indicate a “1” when motion is detected and “0” otherwise. Other sensors provide analog data, for example, a temperature sensor provides a number that you can convert into temperature and humidity. Many sensors are made specifically for a microcontroller such as the Arduino and they are designed to clip to the microcontroller to create a single device. You can build an even larger device by adding more sensors. Groups of sensors are sometimes provided on a single board, for example, to make prototyping easier. Makers who are new to the craft might purchase a “starter kit” that includes a sample of several different kinds of sensors to experiment with.
A program that you write for the microcontroller determines when a device reads a sensor’s setting and the action it takes to respond to the reading. You can also usually set the sensor to interrupt whatever the microcontroller is doing when it turns “on,” for example, to immediately react to a motion sensor.