There are different types of sensors, each working in a different way, but they all have the same purpose: to provide information about the environment.
Optical sensors can use light beams to measure sizes, distances, and object recognition such as color and brightness.
Thermal sensors measure temperatures.
Mechanical sensors are able to detect pressure or force.
Chemical sensors react to various substances in their environment.