Sensors are devices that detect changes in the environment and convert these changes into electrical signals that can be processed by electronic circuits. They act as the "senses" of a mechatronic system, allowing it to perceive and respond to its surroundings.
In our everyday lives, we encounter sensors constantly:
The automatic doors at a supermarket use motion sensors.
Your phone's screen brightness adjusts based on ambient light sensors.
Thermostats in buildings use temperature sensors to control heating and cooling systems.
In mechatronics, sensors play a crucial role in gathering data about the system's state and its environment, enabling the system to make decisions and take actions based on this information.
Let's explore some common types of sensors used in mechatronic systems:
Accelerometers: Measure acceleration forces and can detect orientation.
Gyroscopes: Measure angular velocity and help determine orientation.
PIR (Passive Infrared) Sensors: Detect motion by measuring changes in infrared radiation.
Photoresistors: Change resistance based on light intensity.
Photodiodes: Generate current when exposed to light.
Phototransistors: Similar to photodiodes but with higher sensitivity.
Thermistors: Change resistance based on temperature.
Thermocouples: Generate voltage based on temperature difference.
RTDs (Resistance Temperature Detectors): Change resistance linearly with temperature.
Ultrasonic Sensors: Use sound waves to measure distance.
Infrared Sensors: Use infrared light to detect nearby objects.
Capacitive Sensors: Detect nearby objects by measuring changes in capacitance.
Piezoresistive Sensors: Change resistance when pressure is applied.
Capacitive Pressure Sensors: Change capacitance with pressure variations.
Strain Gauges: Measure deformation to determine applied force.
Piezoelectric Sensors: Generate voltage when force is applied.
The BBC micro:bit is equipped with several built-in sensors, making it an excellent platform for learning about sensor technology:
Accelerometer: Measures acceleration forces and can detect tilt, free fall etc
Magnetometer: Measures magnetic fields and can be used as a compass.
Light Sensor: Uses the LED display to measure ambient light levels.
Temperature Sensor: Measures the temperature of the micro:bit's processor.
Touch Sensors: The micro:bit's pins can be used as capacitive touch sensors.
Buttons: While not traditional sensors, the two buttons (A and B) can be considered simple input sensors.
Sensors can be categorised as either analogue or digital based on the type of output they produce:
Produce a continuous range of values.
Output is proportional to the measured quantity.
Examples: thermistors, photoresistors, potentiometers.
Produce discrete, binary outputs (usually 0 or 1).
Often used for detecting the presence or absence of something.
Examples: push buttons, reed switches, some infrared sensors.
Many sensors capture analogue data, but computers and microcontrollers work with digital data.
This is where Analogue-to-Digital Conversion (ADC) comes in:
The continuous analogue signal is sampled at regular intervals.
Each sample is quantized to a specific digital value.
ADCs have a fixed resolution, often expressed in bits.
Common resolutions are 8-bit (0-255) or 10-bit (0-1023).
8-bit ADC: 2^8 = 256 possible values (0-255)
10-bit ADC: 2^10 = 1024 possible values (0-1023)
If a temperature sensor's range is 0-100°C and we're using an 8-bit ADC:
0°C would be represented by 0
100°C would be represented by 255
50°C would be approximately 127 or 128