Sampling and Conversion Ideas
students, in mechatronics, many useful signals begin as changing real-world quantities such as temperature, light, position, speed, or pressure. 🌡️🔧 To use these signals in computers, controllers, and robots, we often need to sample them and convert them into a form that digital systems can understand. This lesson explains how sampling works, why conversion is needed, and how the choices made during sampling affect the quality of the information.
Introduction: Why Sampling Matters
A sensor usually produces an analogue signal, which changes smoothly over time. For example, a microphone output varies continuously as sound waves arrive, and a temperature sensor may produce a voltage that changes with heat. A microcontroller, however, works with digital signals, which are represented using numbers, often as binary values such as $0$ and $1$.
To move from the analogue world to the digital world, the signal must be sampled and then converted by an analogue-to-digital converter or $\text{ADC}$. This process is central to signal processing and electronics because it allows sensors to be read, measured, stored, displayed, and controlled by digital systems. ✅
Learning goals
By the end of this lesson, students, you should be able to:
- explain the main ideas and vocabulary of sampling and conversion,
- apply basic mechatronics reasoning to choose a suitable sampling rate,
- connect sampling to signal conditioning, noise, and filtering,
- summarize how sampling fits into the wider signal processing chain,
- use examples to show how sampling affects measurement quality.
1. Analogue Signals, Digital Signals, and Conversion
An analogue signal can take any value within a range. A voltage from a light sensor might be $1.83\,\text{V}$ at one moment and $1.87\,\text{V}$ a little later. The key idea is that the change is continuous.
A digital signal uses a limited set of values. In a measurement system, these values are usually numbers produced by a computer or microcontroller. Instead of every possible voltage, the system stores a number that represents the voltage.
The conversion from analogue to digital has two main steps:
- Sampling: measuring the signal at regular time intervals.
- Quantization: rounding each measured value to the nearest level that the digital system can represent.
A good way to picture this is to imagine taking photos of a moving cyclist 🚴. Each photo captures the position at one instant. The photos are like samples, while the exact time between photos matters a lot. If the photos are too far apart, the movement can be missed or look strange.
In electronics, the $\text{ADC}$ does the conversion. It receives an input voltage and outputs a digital number. For example, a $10$-bit $\text{ADC}$ can represent $2^{10} = 1024$ levels. If the input range is from $0\,\text{V}$ to $5\,\text{V}$, each step is about
$$\frac{5\,\text{V}}{1024} \approx 4.88\,\text{mV}$$
This means that a measured voltage is rounded to the nearest $4.88\,\text{mV}$ level.
2. Sampling: Taking Measurements at Fixed Times
Sampling means recording the value of a signal at specific moments. If the signal is $x(t)$, then the sampled values might be written as $x[n] = x(nT_s)$, where $T_s$ is the sampling period. The sampling frequency is
$$f_s = \frac{1}{T_s}$$
This means that if $f_s = 1000\,\text{Hz}$, then the system takes $1000$ samples every second.
Sampling is not the same as continuously watching the signal. Instead, it is like checking a water level in a tank every second rather than every moment. If the level changes slowly, this works well. If it changes quickly, important information may be missed.
Example: Temperature monitoring
Suppose a temperature sensor in a machine room changes slowly. Sampling once every second may be enough, because temperature does not usually jump very fast. If the goal is to detect a very sudden rise caused by a fault, a faster sampling rate may be needed so the change is not overlooked.
Example: Vibration sensing
A motor vibration signal may change much faster than temperature. If the motor rotates rapidly, the vibration waveform can include high-frequency components. Sampling too slowly can make the signal look wrong or hide important details. This is why the needed sampling rate depends on the signal.
3. The Sampling Theorem and Aliasing
A very important idea in sampling is the sampling theorem. In simple terms, to capture a signal properly, the sampling frequency must be at least twice the highest frequency present in the signal.
If the highest frequency is $f_{max}$, then a safe minimum is
$$f_s \geq 2f_{max}$$
This is often called the Nyquist criterion. The value $\frac{f_s}{2}$ is called the Nyquist frequency.
Why does this matter? If the sampling rate is too low, aliasing happens. Aliasing means a high-frequency signal is misrepresented as a lower-frequency signal after sampling. In other words, the digital system sees the wrong pattern.
Real-world example of aliasing
Imagine looking at the spokes of a rotating bicycle wheel through a camera or under flashing light. Sometimes the wheel appears to move slowly backward even though it is actually moving forward. This is similar to aliasing. The sampling process creates a misleading result because the measurements are too far apart in time. 📷
In electronics, aliasing can make a fast vibration seem like a slower one, which could lead to incorrect diagnosis in a mechatronic system. A machine condition monitor might think a motor is vibrating at a safe low frequency when the real vibration is much higher.
Anti-aliasing filtering
To reduce aliasing, systems often use a low-pass filter before the $\text{ADC}$. This is called an anti-aliasing filter. Its job is to remove frequency components above the Nyquist frequency before sampling. This is an important part of signal conditioning.
4. Quantization: Turning Measured Values into Numbers
After sampling, the analogue value still has to be converted into a digital number. This step is quantization. Since the digital system can only store certain values, the measurement is rounded to the nearest available level.
This creates quantization error, which is the difference between the true input value and the stored digital value. The error is usually small, but it is never exactly zero.
For a converter with $N$ bits and input range $V_{ref}$, the number of levels is $2^N$. The step size, often called the resolution, is approximately
$$\Delta = \frac{V_{ref}}{2^N}$$
If $V_{ref} = 5\,\text{V}$ and $N = 8$, then
$$\Delta = \frac{5}{256} \approx 0.0195\,\text{V}$$
So the system cannot distinguish voltages that differ by much less than $19.5\,\text{mV}$. A $12$-bit converter would have much finer resolution.
Why resolution matters
In a robot joint sensor, small position changes may be important. If the resolution is too coarse, the controller may not notice tiny movements. In a medical or industrial measurement system, low resolution can reduce accuracy and make control less smooth.
5. Signal Conditioning Before Sampling
Sampling does not happen in isolation. The signal usually passes through signal conditioning first. Signal conditioning means preparing the sensor output so that it is suitable for the $\text{ADC}$.
Common conditioning tasks include:
- amplifying small signals,
- removing unwanted offsets,
- filtering noise,
- protecting the input from overvoltage,
- matching signal ranges to the converter.
For example, a sensor might produce a very small voltage, such as a few millivolts. The $\text{ADC}$ may need a larger input range to measure this accurately. An amplifier can scale the signal upward. If the signal includes electrical noise from motors or switching devices, a filter may clean it before conversion.
Example: Load cell measurement
A load cell used to measure force often produces a tiny voltage change. Before it reaches the $\text{ADC}$, the signal is usually amplified and filtered. Without conditioning, the converter may struggle to detect the useful signal among noise. This is common in mechatronic measurement systems.
6. How Sampling Fits into the Full Mechatronics Chain
Sampling and conversion are part of a larger chain in a mechatronic system:
- Physical quantity changes, such as speed, force, or temperature.
- A sensor converts that quantity into an electrical signal.
- Signal conditioning prepares the signal.
- The ADC samples and converts it into digital data.
- A microcontroller or computer processes the data.
- The system uses the result for display, logging, or control.
This chain is common in automatic systems. For example, a thermostat senses room temperature, samples it periodically, and then decides whether to turn heating on or off. A robot arm senses joint position, converts it to a digital value, and uses that value to correct movement. 🤖
students, this is why sampling is not just a mathematical idea. It is a practical step that connects sensors to intelligent control.
Conclusion
Sampling and conversion ideas are essential in signal processing and electronics because they allow analogue sensor outputs to be used by digital systems. Sampling measures a signal at regular time intervals, and quantization turns each sample into a digital number. The sampling rate must be high enough to avoid aliasing, and filtering is often used before conversion to remove unwanted high-frequency content. The number of bits in the $\text{ADC}$ affects resolution and measurement accuracy.
In mechatronics, these ideas appear in robot sensors, machine monitoring, environmental measurement, and control systems. Understanding sampling helps you choose suitable sensors, set proper measurement rates, and interpret data correctly. ✅
Study Notes
- An analogue signal changes continuously, while a digital signal uses discrete numbers.
- Sampling means measuring a signal at regular time intervals.
- The sampling frequency is $f_s = \frac{1}{T_s}$.
- To avoid aliasing, a signal is usually sampled at least at twice its highest frequency: $f_s \geq 2f_{max}$.
- Aliasing happens when a signal is sampled too slowly, causing high frequencies to look like lower ones.
- An anti-aliasing filter is usually a low-pass filter placed before the $\text{ADC}$.
- Quantization is the rounding of sampled values to the nearest digital level.
- The resolution of an $N$-bit converter is approximately $\Delta = \frac{V_{ref}}{2^N}$.
- More bits give finer resolution and smaller quantization error.
- Signal conditioning can include amplification, filtering, offset removal, and protection.
- Sampling and conversion link sensors to microcontrollers, computers, and control systems in mechatronics.
