1.
SAMPLING:
Sampling is the process of taking measurements of a continuous signal at discrete points in
time. This is done by an analog-to-digital converter (ADC), which converts an analog signal (like
a voltage or current) into a digital signal (a series of numbers).
Importance of sampling in embedded systems and real-time systems
Embedded systems and real-time systems often need to process information from the real
world, which is analog in nature.
By sampling these analog signals, we can convert them into a digital format that can be
processed by the system. This allows us to do things like:
Measure physical quantities like temperature, pressure, or acceleration.
Process audio and video signals for playback or recording.
Control motors and other actuators based on sensor feedback.
Key concepts in sampling
Sampling rate: The number of samples taken per second. A higher sampling rate gives a more
accurate representation of the original signal, but also requires more processing power.
Quantization: The process of converting an analog value to a digital value. This is done by
dividing the analog range into a number of discrete levels.
Aliasing: A phenomenon that occurs when a signal is sampled at a rate that is too low. This can
cause the sampled signal to appear to have a lower frequency than the original signal.
Challenges in sampling
Noise: Noise can be introduced into the sampling process from a variety of sources, such as the
ADC itself, the power supply, or the environment.
Timing jitter: Variations in the timing of the sampling clock can lead to errors in the sampled
data.
Limited bandwidth: ADCs have a limited bandwidth, which means they cannot accurately
sample signals with frequencies above a certain limit.
How to choose a sampling rate?
The sampling rate should be chosen based on the Nyquist-Shannon sampling theorem, which
states that the sampling rate must be at least twice the highest frequency component of the
signal. In practice, the sampling rate is often chosen to be several times higher than the Nyquist
rate to account for aliasing and other factors.
1. QUANTIZATION
It involves mapping a large set of continuous input values to a smaller set of discrete values.
It is crucial for digital signal processing and in embedded systems, as it allows analog signals
to be represented and manipulated digitally and helps in optimizing resources such as memory
and processing power.
Quantization is used in systems like microcontrollers with ADCs to measure physical quantities,
such as temperature or voltage levels, and convert them into digital values for processing or
control decisions.
Quantization in Analog-to-Digital conversion (ADC)
Analog signals from sensors in embedded systems e.g., temperature, light or pressure are
continuous and can take on any value within a range. To process these signals, they must be
digitized using an ADC.
Quantization in ADCs occurs when the continuous analog signal is sampled and each
sample is mapped to a discrete value i.e. quantization level.
The ADC converts the signal into a finite number of levels based on its bit resolution.
Example:
In an 8-bit ADC, the input range is divided into 28=256 discrete levels. If the voltage
input range is 0 to 5V, each quantization level would represent about 19.53 mV (5V /
256). This means that any analog input between 0V and 5V will be rounded to the
nearest multiple of 19.53 mV.
Quantization Error: This is the difference between the true analog signal and its quantized
digital representation.
This error introduces noise, but increasing the bit resolution reduces the quantization error,
improving the signal accuracy.
The Quantization Process
Sampling: The continuous signal is sampled at regular intervals to create a discrete-time
signal.
Amplitude Resolution: The amplitude of each sample is rounded to the nearest quantization
level.
Quantization Levels and Resolution
Number of Levels: The number of quantization levels determines the resolution of the digital
signal. More levels lead to higher accuracy but also require more storage and processing
resources.
Quantization Step: The difference between adjacent quantization levels is called the
quantization step.
Visual representation
The blue line represents the original continuous signal.
The dots represent the sampled values.
The lines represent the quantized signal
Quantization typically involves:
Reducing precision of floating-point numbers to fixed-point numbers.
Representing values with fewer bits, e.g. converting 32-bit floating-point numbers to 16-bit
or 8-bit integers.
TYPES OF QUANTIZATION
1. Uniform Quantization
In uniform quantization, the quantization levels are evenly spaced . This means that each step
size represents a constant amount of analog amplitude . It's simple to implement and is
commonly used in many applications .
Types of Uniform Quantization
a. Mid-Rise Quantization: The quantization levels are centered between the actual analog values,
resulting in a "rise" in the middle of each step.
b . Mid-Tread Quantization: The quantization levels are centered on the actual analog values,
resulting in a "tread" in the middle of each step .
2. Non-Uniform Quantization
In non-uniform quantization, the quantization levels are not evenly spaced. This type is often
used for signals with a wide dynamic range, such as audio signals, where smaller amplitude
values need finer resolution than larger ones.
3. Adaptive Quantization
It adjusts the quantization levels based on the characteristics of the signal. This type is useful for
signals with varying amplitude, as it can optimize the fidelity of the quantized signal.
4. Scalar Quantization
It quantizes each sample independently, without considering the relationship between samples.
It's straightforward but may not be as efficient as other methods for certain types of signals.
5. Vector Quantization
It quantizes blocks of samples together, considering the correlation between them.This method is
more complex but can achieve higher compression ratios and better signal quality for certain
applications.
Quantization Noise: The process of rounding the sample amplitudes introduces
quantization noise. This noise can be reduced by increasing the number of quantization levels.
Other applications of quantization in embedded systems include,
Digital Signal Processing (DSP):
DSP algorithms such as Low-pass filters, FIR filters, and other techniques in embedded
systems often involve quantization during intermediate stages of computation, especially when
handling fixed-point arithmetic.
Embedded systems often process audio, video, or other sensor data through digital signal
processing algorithms. Quantization is used to convert these signals into discrete values for
storage, transmission, and processing.
Image and Audio Processing: Quantization is used in compressing and processing images and
audio signals.
Quantization and Power Efficiency
Quantization can also improve the power efficiency of embedded systems.
By reducing the precision of data i.e. to fewer bits, processors can operate with less
memory bandwidth and fewer computations, saving power
Important in battery-powered devices like wearables or remote IoT sensors.
.
RESISTORS
A resistor is a passive electrical component with two terminals that are
used for either limiting or regulating the flow of electric current in
electrical circuits.
It works by converting electrical energy into heat. This occurs because
the material inside the resistor is typically carbon and impedes the flow
of electrons or current. The degree of opposition to the current flow is
the resistance measured in ohms (Ω).
RESISTOR TYPES
1. Fixed Resistors: These have a constant resistance value. The
common types include;
Carbon film resistors: These are inexpensive and widely
used.
Metal film resistors: These are more precise and stable.
2. Variable resistors: These can be adjusted to change the resistance
value. These can also be referred to as potentiometers.
3. Surface mount resistors (SMD): These are used in embedded
systems for space efficient designs.
RESISTOR MATERIALS
Their various material that can be used as resistor materials and below
are a few listed down
Carbon Film Resistors: These are a type of fixed value resistor and
are made by depositing a thin layer of carbon on a ceramic base.
The resistance is determined by the thickness of the carbon layer.
They are cheaper but less accurate.
Metal Film Resistors: These offer better precision and lower noise
than carbon film resistors. They are made by depositing a metal
layer, making them more stable across temperature ranges.
Wire-Wound Resistors: These are used in high-power applications
and consist of a metal wire wound around a ceramic core. They
have high accuracy and stability but are rarely used in small, low
power embedded systems.
Temperature coefficient: Under resistors we also talk about
temperature coefficient which refers to how much a resistor’s value
changes with temperature.
In embedded systems it is critical to select resistors with a low
temperature coefficient due to various reasons highlighted below;
Minimize resistance drift with temperature changes because if it is
high even slight changes in temperature can cause noticeable
variations in resistance which can alter the performance of the
circuit.
Improves performance in feedback loops
Increases long-term stability
RESISTOR COLOR CODING
Resistors use a color code system to represent their resistance value
and tolerance. This is done because printing numerical values on small
resistors would be impractical.
Resistors typically have 4 to 6 standard color bands used. The bands are
read from left to right, with the first two or three bands representing
digits, the next band representing the multiplier, and the last band
indicating the tolerance.
1. 1st Band and 2nd Band: These represent the first two digits of the
resistor’s resistance value.
Example: The color Red corresponds to the number 2 and
Violet corresponds to the number 7. This gives us the
digits 27.
2. 3rd Band (Multiplier): The third band is the multiplier, which
represents a power of 10.
Example: The color Orange corresponds to a multiplier of
10^3 (1000). So, from the above 27*1,000 (from the third
band) equals 27,000 ohms (27kΩ).
3. 4th Band (Tolerance): The fourth band represents the tolerance,
or how precise the resistor’s value is. This tells you how much the
actual resistance could vary from the stated value.
Example: Gold represents a ±5% tolerance. This means
the actual resistance could vary by 5% above or below the
nominal value (27kΩ in this case).
For N/A it means not applicable or not available Tolerance
is not applicable for some colors like Black, Orange,
Yellow, White meaning these colors are not used to
represent tolerance in resistors.
Color Code Chart
Color Digit Value Multiplier Tolerance
Black 0 10^0(1) N/A
Brown 1 10^1(10) ±1%
Red 2 10^2(100) ±2%
Orange 3 10^3(1000) N/A
Yellow 4 10^4(10000) N/A
Green 5 10^5(100000) ±0.5%
Blue 6 10^6(1000000) ±0.25%
Violet 7 10^7(10MΩ) ±0.1%
Grey 8 10^8(100MΩ) ±0.05%
White 9 10^9(1GΩ) N/A
Gold N/A 10^-1(0.1) ±5%
Silver N/A 10^-2(0.01) ±10%
Example
Color Bands: Red, Violet, Orange, Gold.
1st Band (Red) = 2.
2nd Band (Violet) = 7.
3rd Band (Orange) =10^3=1000.
4th Band (Gold) = Tolerance of ±5%.
The resistance value is:
27×1000=27000Ω=27KΩ
With a tolerance of ±5%, the actual resistance could vary between
27000Ω×0.95=25.65 KΩ and 27000Ω×1.05=28.35KΩ.
Types of resistors basing on the bands
5 band resistors: These are used for higher precision the
1st, 2nd, and 3rd bands represent digits, the 4th is the
multiplier and the 5th is the tolerance. They are common
in precision circuits where tolerances like ±1% or ±0.5%
are needed.
6 band resistors: These add a sixth band which represents
the temperature coefficient. These resistors are used in
very high-precision applications.
POWER RATINGS
The power rating of a resistor defines how much electrical energy in
the form of heat it can safely dissipate without being damaged. If the
power dissipation exceeds the rated capacity, the resistor can overheat,
fail or even cause damage to the circuit.
When current flows through a resistor, it converts electrical energy into
heat. The amount of power dissipated by the resistor is given by:
P=I^2×R or P=V^2/R or P=IV
Where:
P is the power dissipation in watts (W)
I is the current through the resistor in amperes (A)
V is the voltage across the resistor in volts (V)
R is the resistance in ohms (Ω)
Power rating is important because when the resistor’s power rating is
exceeded it can cause the following;
Overheat: This can lead to the resistor burning or even damaging
surrounding components.
Fail: The resistor might crack or physically break.
Change Resistance: Heat can permanently change the resistor's
resistance value, causing circuit malfunctions.
When designing a circuit, it’s crucial to ensure the resistor’s power
rating is higher than the calculated power dissipation to prevent failure.
Example:
You have a 5V power supply driving a 150Ω resistor. Calculate the
power dissipation and choose an appropriate resistor.
P=V^2/R
P=5V^2/150Ω=25/150=0.167W
In this case, the resistor will dissipate 0.167 watts. To ensure
reliability and longevity, you would typically choose a resistor with
a power rating higher than 0.167W, such as a ¼W (0.25W)
resistor.
PULL-UP AND PULL-DOWN RESISTORS
Pull-up and pull-down resistors are used to ensure that logic inputs to
microcontrollers or other integrated circuits are defined and stable
when no active signal is applied. Without these resistors, the input
could float between high and low states, leading to unpredictable
behavior.
1. Pull-Up Resistors
A pull-up resistor connects the input pin of a digital circuit to the
positive voltage supply. The purpose is to ensure that the input reads
as a logic high when no other component is driving the pin low.
How Pull-Up Resistors Work
When a switch or device connected to the pin is open or inactive
(not connected to ground), the pull-up resistor pulls the input to a
high state (VCC).
When the switch is closed, it connects the input directly to
ground, which forces the input to a low state.
These are places pull up resistors can be used;
Microcontroller Inputs
Open-Collector/Drain Outputs
2. Pull-Down Resistors
A pull-down resistor connects the input pin of a digital circuit to
ground (GND). The goal is to ensure that the input reads as a logic low
(0) when no other device is pulling it high.
How Pull-Down Resistors Work
When the switch or input is open or inactive (disconnected from
VCC), the pull-down resistor ensures that the input is pulled to
ground and reads as low (logic 0).
When the switch is closed, it connects the input to VCC which
forces the input to a high state (logic 1).
Below are some areas where pull-down resistors can be used;
Microcontroller Inputs
Certain Bus Systems
The difference between pull-up and pull-down resistors is that
Pull-Up Resistor: Connects to VCC and pulls the input high when
inactive.
Pull-Down Resistor: Connects to GND and pulls the input low
when inactive.
Internal Pull-Up Resistors
In many modern microcontrollers, internal pull-up resistors are
available for use on input pins. These resistors are integrated into the
chip and can be enabled via software, eliminating the need to add
external resistors.
How Internal Pull-Up Resistors Work
Internal pull-ups are essentially resistors built into the
microcontroller that can be connected between the input pin and
VCC.
When enabled, the microcontroller will automatically pull the
input to a high state (logic 1) when nothing is connected to the
pin, providing the same functionality as an external pull-up
resistor.
Advantages of Internal Pull-Up Resistors
1. No need for external resistors on input pins simplifying the circuit
and reducing the number of components.
2. Internal pull-ups can be enabled or disabled in the software by
setting the appropriate registers in the microcontroller.
3. Helps in reducing the physical size of the PCB by eliminating
external components.
Limitations of Internal Pull-Up Resistors
Internal pull-up resistors typically have higher resistance values
which might not be suitable for all applications. If you need
precise resistance, external resistors might still be necessary.
Most microcontrollers only offer internal pull-up resistors, so if
you need a pull-down resistor, you will likely have to use an
external one.
4. CAPACITORS
• A capacitor is a device that stores electric charge and consists of two conductors
separated by an insulator.
• In embedded systems, capacitors play an essential role in stabilizing, filtering, and
storing electrical energy.
• Capacitors have many applications:
- Computer RAM memory and keyboards.
- Electronic flashes for cameras.
- Electric power surge protectors.
- Radios and electronic circuits.
Roles of capacitors in embedded systems
Power Supply Decoupling (Bypass Capacitors):
o Capacitors are often placed near integrated circuits (ICs) to smooth out voltage spikes or
dips in the power supply.
o A common example is the use of ceramic capacitors (often 0.1 µF or 1 µF) to filter high-
frequency noise, ensuring that the microcontroller receives a stable voltage.
o Decoupling capacitors act like small energy reservoirs that can release charge when
needed to keep the voltage constant.
Filtering:
o Capacitors are often used in conjunction with resistors or inductors to form filters e.g.,
low-pass, high-pass in analog signal processing. These filters can clean up noisy signals
or extract specific frequency components.
o In analog-to-digital converters (ADC), capacitors help filter out high-frequency noise,
ensuring cleaner, more accurate readings.
Timing Circuits:
o In RC (resistor-capacitor) circuits, capacitors are used to create delays or control the
timing of oscillators and clocks.
o Embedded systems often rely on precise timing (like in PWM, clock generation, or
communication protocols), and capacitors help in achieving that.
Energy Storage:
o Capacitors can store energy and release it when required. For instance, in systems that
have a backup energy source, like battery-powered or supercapacitor-based systems,
capacitors can provide short-term energy storage.
Signal Coupling:
o Capacitors can be used for AC signal coupling, allowing the passage of alternating
current (AC) signals while blocking direct current (DC). This is essential in
communication circuits, where you might want to isolate DC bias from the signal line.
Reset Circuits:
o Capacitors are used in reset circuits to ensure that embedded devices start correctly. By
controlling the reset signal duration through a capacitor, the system avoids glitches during
power-up.
Nature of capacitors
Parallel-plate capacitor
• parallel-plate capacitor consists of two conducting plates of area A separated by a
distance d.
• Charge +Q is placed on one plate and –Q on the other plate.
• An electric field E is created between the plates.
Cylindrical Capacitor
Capacitor construction involves two metal plates separated by insulating material
Capacitance in Embedded Systems:
Capacitance is the ability of a capacitor to store an electrical charge. The value is measured in
Farads (F), though typical capacitors in embedded systems range from picofarads (pF) to
microfarads (µF). The formula for capacitance is:
Q
C= V
• C is the capacitance in Farads,
• Q is the charge in coulombs,
• V is the voltage across the capacitor.
Types of capacitors
1. Ceramic Capacitors
Typically from a few picofarads (pF) to several microfarads (µF).
Usually up to several hundred volts.
They are small, inexpensive, and available in a variety of capacitance values. They are
widely used for high-frequency applications, decoupling, and filtering.
Applications:
o Decoupling capacitors in embedded systems (placed near ICs).
o Filters in signal processing circuits.
Their advantages include Low cost, good for high-frequency operation, low equivalent
series resistance (ESR).
2. Electrolytic Capacitors
Typically range from 1 µF to thousands of microfarads.
Their voltage ranges from a few volts to hundreds of volts.
Electrolytic capacitors offer higher capacitance values in a relatively small package. They
are polarized, meaning they must be connected with the correct polarity.
Applications:
o Power supply filtering.
o Energy storage.
o Low-frequency decoupling in power circuits.
They have high capacitance in a small volume.
They have limited lifespan, especially at high temperatures; high ESR.
3. Tantalum Capacitors
Their capacitance typically ranges from 0.1 µF to several hundred microfarads.
They are known for their stability, reliability, and long lifespan. They are also polarized
and have a low leakage current.
They are used in situations requiring stable capacitance values, such as timing and
filtering in embedded systems.
They are of a small size, high stability, reliable in harsh environments.
They are sensitive to overvoltage and reverse polarity, which can cause catastrophic
failure.
5. Supercapacitors (Ultracapacitors)
Their capacitance ranges from farads (F) to thousands of farads.
They have low voltage, typically less than 5V per capacitor and higher voltage can be
achieved by using multiple capacitors in series.
Supercapacitors offer extremely high capacitance and can store large amounts of energy.
They are used in applications where short bursts of high power are needed.
Applications:
o Energy storage in backup power systems.
o Regenerative braking systems in electric vehicles.
o Short-term power backup in low-power embedded systems.
They have extremely high capacitance, rapid charging, and discharging cycles.
They have low voltage rating, and they typically require voltage balancing circuits in
series configurations.
8. Variable Capacitors
Their capacitance typically ranges from a few picofarads to several hundred picofarads.
They generally have low voltage.
The capacitance value of these capacitors can be adjusted mechanically or electronically.
Applications:
Tunable circuits in radios and communication equipment.
5. DIODES
A diode is a semiconductor device, made from a small piece of semiconductor
material, such as silicon, in which half is doped as a p region and half is doped as
an n region with a pn junction and depletion region in between. The p region is
called the anode and n region is called the cathode.
It conducts current in one direction and offers high resistance in other direction.
Forward Bias
Bias is the application of a dc voltage to a diode to make it either conduct or block
current. Forward bias is the condition that allows current through the pn junction.
This external bias voltage is designated as VBIAS. The resistor limits the forward
current to a value that will not damage the diode. In the forward bias, the negative
side of VBIAS is connected to the n region of the diode and the positive side is
connected to the p region. The bias voltage VBIAS, must be greater than the barrier
potential; bias must be greater than 0.3V for germanium or 0.7V for silicon diodes.
Reverse Bias
Reverse bias is the condition that essentially prevents current through the diode.
The figure below shows a dc voltage source connected across a diode in the
direction to produce reverse bias. The positive side of VBIAS is connected to the n
region of the diode and the negative side is connected to the p region. Also, note
that the depletion region is shown much wider than in forward bias or equilibrium.
The positive side of the bias-voltage source pulls the free electrons, (majority in n
region), away from the pn junction. As electrons move away from junction, more
positive ions are created. This results in a widening of the depletion region and a
depletion of majority carriers.
Types of diodes
We can distinguish the following types of diodes:
• Rectifier diodes are typically used for power supply applications. Within the
power
supply, you will see diodes as elements that convert AC power to DC power;
• Switching diodes have lower power ratings than rectifier diodes, but can function
better in high frequency application and in clipping and clamping operations that
deal with short-duration pulse waveforms;
• Zener diodes, a special kind of diode that can recover from breakdown caused
when the reverse-bias voltage exceeds the diode breakdown voltage. These diodes
are commonly used as voltage-level regulators and protectors against high voltage
surges;
• Optical diodes;
• Special diodes, such as varactors (diodes with variable capacity), tunnel diodes or
Schottky diodes.
Voltage-Current (V-I) Characteristic of A Diode
V-I Characteristic for Forward Bias
The current in forward biased called forward current and is designated If. At 0V
(Vbias) across the diode, there is no forward current. Figure below illustrates what
happens as the forward-bias voltage is increased positively from 0 V. The resistor
is used to limit the forward current to a value that will not overheat the diode and
cause damage. With gradual increase of Vbias, the forward voltage and forward
current increases. A portion of forward-bias voltage (Vf) drops across the limiting
resistor. Continuing increase of Vf causes rapid increase of forward current but the
voltage across the diode increases only gradually above 0.7V. The resistance of the
forward-biased diode is not constant but it changes over the entire curve.
Therefore, it is called dynamic resistance.
V-I Characteristic for Reverse Bias
With 0V reverse voltage there is no reverse current. There is only a small current
through the junction as the reverse voltage increases. At a point, reverse current
shoots up with the breakdown of diode. The voltage called breakdown voltage.
This is not normal mode of operation. After this point the reverse voltage remains
at approximately VBR but IR increase very rapidly. Break down voltage depends on
doping level, set by manufacturer.
Combine the curves for both forward bias and reverse bias, and you have the
complete V-I characteristic curve for a diode, as shown in Figure.
Applications of Diodes
Rectification: Diodes are widely used in rectifiers to convert AC to DC
power, such as in power supplies.
Clipping and Clamping: Used to limit voltage levels to prevent circuit
damage (clipping) or shift voltage levels (clamping).
Voltage Regulation: Zener diodes are used in voltage regulators to maintain
a steady output voltage in power supplies.
Signal Demodulation: Diodes are used to extract modulated information
from signals in radios and TVs.
Protection: Diodes can protect sensitive electronic circuits by blocking
excessive voltage (as in transient voltage suppression diodes).
LED Lighting: LEDs are used as indicators and for illumination in many
consumer electronics and automotive applications.
Important Parameters to Consider
Maximum Current Rating: Diodes have a maximum current limit
beyond which they can be damaged.
Power Dissipation: Diodes dissipate power as heat, especially at high
currents, so thermal management may be required.
Temperature Sensitivity: Diode characteristics, like forward voltage
drop, can change with temperature.Type equation here .
Diode Equation(Shockley Equation)
The current through a diode can be expressed by the Shockley diode
equation:
V
I= (eIs nVT
- 1)
where:
I S is the reverse saturation current,
V is the voltage across the diode
n is the ideality factor (typically close to 1 for silicon diodes),
V T is the thermal voltage.
Ideal vs. Real Diode
Ideal Diode: In theory, an ideal diode would have zero forward voltage drop,
infinite reverse resistance, and instant switching.
Real Diode: In practice, all diodes have a small forward voltage drop, some
leakage current when reverse biased, and finite switching speed.
6. STEPPER MOTORS
A stepper motor is an electric motor whose main feature is a shaft that rotates by performing
steps or discrete displacement in response to dc signals.
Calculating the step size can be done by:
360 ÷ 200 = 1.8 degrees (If the motor has 200 steps)
Working principle:
It contains:
1) Stator (stationary part) - contains teeth that
have stator windings.
2) Motor (moving part) - can either be a
permanent magnet or a variable reluctance iron core.
The stator phases are energized one or more and a magnetic field is created. (because of
current flowing through the coil). The rotor then aligns with the field.
By supplying different phases in sequence, the rotor is rotated by a specific amount.
Control:
Control of a stepper motor involves mainly 2 components:
1) An MCU e.g., an Arduino – It generates the signals for the driver
2) Driver – contains pre-driver and transistor bridge. The pre-driver receives control signals
from the MCU and provides the necessary voltage and current to activate transistors in
the bridge. It is also responsible for timing of signals. The transistor bridge contains
transistors that act as a switch to connect or disconnect the motor coils, therefore
controlling the motor.
Direction of current flow in a in a stepper motor is controlled using two methods:
Unipolar stepper motors: Typically have 5 or 6 wires. They have center tapped coils allowing
current to flow in one direction through each half of the coil.
Bipolar stepper motors: Typically have 4 wires. Have single windings per phase with current
flowing in both directions.
Types:
1) Permanent magnet rotor – Rotor is a permanent magnet. It guarantees a good torque
and also detent torque. It has a lower speed and lower resolution.
2) Variable reluctance rotor – Rotor is iron core. It has lower torque with high speed and
resolution. It has no detent torque.
3) Hybrid rotor – Rotor is a hybrid between permanent magnet and variable reluctance. It
has the advantages of both permanent magnet and variable reluctance.
Driving techniques:
Wave mode – Only one phase at a time is energized.
Full-step mode – 2 phases are energized at the same time.
Half step mode – Combination of wave mode and full mode
Microstepping – Enhancement of half- step that allows for further reduction in step size. This is
done by controlling the intensity of current flowing through each phase.
Advantages of stepper motors:
- High positioning accuracy.
- Do not require a sensor to detect motor position.
- Control is simple.
Disadvantages of stepper motors:
- Have low torque.
- High power consumption.
- If load is too high, it may miss some steps.
Applications of stepper motors:
-Printers, Motors, DSLR cameras, ATM Machines
7. Analog-to-Digital Converters (ADCs)
Many real-world signals (e.g., temperature, light, sound) are analog, meaning they can take any
value within a range. For microcontrollers to understand these signals, we need to convert them
into digital form using an Analog-to-Digital Converter (ADC).
Analog Signals
Analog signals vary continuously over a range, like voltage levels for example temperature can
vary between two values, say 0°C and 100°C, with each small change represented as a different
voltage.
Analog sensor devices:
o Potentiometer: Changes resistance when a knob is turned.
o Thermistor: Changes resistance based on temperature.
o Accelerometer: Measures acceleration in different directions.
o Light Sensor: Detects how bright or dark an environment is.
o Microphone: Converts sound into analog signals (vibrations).
Analog-to-Digital Converter (ADC)
An ADC converts the continuous analog signal (e.g., voltage) into a discrete digital value
that the microcontroller can process.
How it works:
o The ADC takes the input voltage and compares it to a reference voltage (let’s say
5V).
o It divides the range (e.g., 0 to 5V) into steps. With a 10-bit ADC, you get 1024
steps (since 2^10 = 1024).
For example, in a 5V system, each step represents about 4.9 mV (5V/1024
steps).
So if the input voltage is 2.5V, the ADC will return a value close to 512,
which is halfway between 0 and 1024.
Types of ADCs
1. Parallel ADC (Fast, but space-consuming):
o It uses multiple comparators to divide the reference voltage into steps. The input
voltage is compared to each step simultaneously to output a binary number.
o Drawback: Requires a lot of hardware, making it costly and power-hungry.
2. Counting ADC (More efficient, but slower):
A counter gradually increases the digital value until it matches the input voltage using a
Digital-to-Analog Converter (DAC).
Disadvantage
It can be slower since the counter needs time to find the correct value.
ADCs in ATmega328P
ATmega328P is a popular microcontroller (used in Arduino) with six 10-bit ADCs. This means it
can convert analog signals into digital values ranging from 0 to 1023.
Registers used in ADC operation:
o ADCSRA Register: Controls ADC settings like enabling/disabling it and setting
the clock speed for conversions.
o ADMUX Register: Selects the input channel (which sensor to read), reference
voltage, and adjusts data alignment.
o DIDR0 Register: Disables the digital input on the pin to save power when using
the ADC.
Result:
The ADC conversion result is stored in two registers, split between high and low bytes (ADCH
and ADCL). Depending on your application, you can read just 8 bits or the full 10 bits for more
precision.
Analog Comparator (ATmega328P)
The Analog Comparator compares two analog input voltages and gives a high or low
result based on which voltage is higher.
o It can be useful for triggering actions, such as interrupts or timers, when one
signal exceeds another.
In summary, analog signals from the real world need to be converted into digital values using
ADCs to be understood by microcontrollers.
The ATmega328P microcontroller provides 10-bit ADCs, allowing you to read analog
sensors with good precision and control, helping to measure physical phenomena like
temperature or sound accurately.
By understanding ADCs and how they interact with sensors, one can convert real-world data into
usable digital signals for your microcontroller projects.