Analog Input and Output Presentation
Analog Input and Output Presentation
Output
What is Analog?
• • Analog refers to continuous signals
that vary over time.
• • Represent real-world phenomena
like light, sound, and temperature.
• • Example: Volume knob on a
speaker.
Analog Input
• • Used to read real-world data.
• • Examples:
• - Temperature sensors
• - Light sensors
• - Potentiometers
• • Microcontrollers use ADC (Analog to
Digital Converter) to read analog
input.
Analog Output
• • Simulates analog behavior using digital
signals.
• • Common method: PWM (Pulse Width
Modulation).
• • Examples:
• - Dimming an LED
• - Controlling motor speed
• - Generating audio tones
ADC - Analog to Digital Conversion
• • Converts continuous analog
signals into discrete digital values.
• • Arduino: 10-bit resolution →
values from 0 to 1023.
• • Formula: Voltage =
(AnalogReading / 1023) *
ReferenceVoltage
PWM - Pulse Width Modulation
• • Mimics analog output using fast digital
pulses.
• • Duty cycle determines average voltage.
• • Higher duty cycle = brighter LED / faster
motor.
Arduino Example - Analog In/Out
• • Analog Input: analogRead(A0);
• • Analog Output: analogWrite(9,
128);
• • Common pins:
• - Analog In: A0 to A5
• - PWM Out: ~3, ~5, ~6, ~9, ~10, ~11