[go: up one dir, main page]

0% found this document useful (0 votes)
2 views18 pages

UDAYVEER YDV EDW

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 18

ELECTRONIC DESIGN WORKSHOP

ASSIGNMENT = 1

TOPIC- WHAT ARE ANALOG INPUT OF ARDUINO NANO


PWM OPERATION AND DAC INPUTS.
INTERRUPTS AND INTERRUPT PROGRAMMIN

Name – UDAYVEER
ROLL NO- 2023UEI2842
1- WHAT IS ANALOG INPUT ?

Analog inputs are electrical signals that vary


continuously over time, rather than switching
between fixed states like digital signals (0 or 1). In
electronics and microcontrollers like Arduino,
analog inputs allow devices to measure real-world
signals s h as temperature, light, sound, and
pressure.uc
2- WHAT IS ARDUINO NANO ?

The Arduino Nano is Arduino's classic breadboard


friendly designed board with the smallest
dimensions. The Arduino Nano comes with pin
headers that allow for an easy attachment onto a
breadboard and features a Mini-B USB connector.
The classic Nano is the oldest member of the
Arduino Nano family boards. It is similar to the
Arduino Duemilanove but made for the use of a
breadboard and has no dedicated power jack.
3- ANALOG INPUT OF ARDUINO NONA

The Arduino Nano has 8 analog input pins, which


are labeled A0 through A7. These pins allow the
board to read analog signals (voltages) and convert
them into digital values through its analog-to-digital
converter (ADC). The inputs work with voltages
typically in the range of 0 to 5V, and the values are
mapped to a range from 0 to 1023, corresponding
to the voltage range.
4- How Analog Inputs Work

• Arduino uses an Analog-to-Digital Converter


(ADC) to convert the analog voltage (0V to 5V or
0V to 3.3V, depending on the board) into a
digital value.
• The ADC typically has a 10-bit resolution,
meaning it converts the analog signal into a
number between 0 and 1023.
• 0 → 0V
• 1023 → 5V (or 3.3V on some boards)
• Any voltage in between is mapped
proportionally.
5- Common Uses of Analog Inputs

• Reading Sensors
• (e.g., LM35, TMP36)
• Light sensors (e.g., LDR - Light Dependent Resistor)
• Potentiometers (variable resistors for adjusting values)
• Measuring Voltage
• Can be used to monitor battery levels or external
voltage sources.
• Interfacing with Analog Devices
• Some microphones, pressure sensors, and
other analog devices can be connected.
6- Analog Input Pins in Arduino

Most Arduino boards have dedicated analog input pins labeled


A0, A1, A2, A3, etc. These pins are connected to an Analog-to-
Digital Converter (ADC) that converts the incoming analog
voltage (typically 0V to 5V, or 0V to 3.3V on some boards) into a
digital value that the Arduino can process.

Common Arduino Boards and Their Analog Input Pins:


7-How It Works?

• Arduino has a 10-bit Analog-to-Digital


Converter (ADC).
• Converts 0V - 5V into a digital value between
0 and 1023.

Formula :
8- Pulse Width Modulation (PWM)
Operation

Definition and Basics :


Pulse Width Modulation (PWM) is a modulation
technique where the width of the pulses in a signal
is varied to control the amount of power delivered
to a load. This is achieved by adjusting the duty
cycle, which is the ratio of the pulse width to the
total period of the signal. A higher duty cycle results
in more power being delivered, while a lower duty
cycle reduces power output
9- How PWM Works ?

PWM signals are typically generated using a


comparator that compares a reference signal
(often a sawtooth or triangular wave) with a
modulating signal. When the modulating signal
exceeds the reference, the output pulse is
generated. This technique is widely used in
applications such as motor speed control, light
dimming, and audio signal generation
10- Types of PWM ?
11-Practical use case of PWM in real life application :

motors by generating a PWM signal from a


microcontroller to regulate the voltage applied to
the motor. By adjusting the duty cycle of the PWM
signal, the average voltage supplied to the motor
can be varied, thus controlling the speed of the
motor.
An excellent illustration of this is seen in electric
scooters where the controller generates a PWM
signal with a duty cycle corresponding to
the desired speed, triggered by the user twisting
the throttle. This technique offers precise speed
control, cost-effectiveness, and durability since it
reduces mechanical stress and overheating,
12- Interrupts and Interrupt Programming

Overview of Interrupts
Interrupts are signals that temporarily halt the main
program execution to allow a specific routine
(Interrupt Service Routine or ISR) to run. This
mechanism is crucial for real-time applications
where timely responses to events are necessary.
For example, an interrupt can be triggered by
hardware events such as timers or external signals
Using Interrupts in PWM Applications:

In PWM applications, interrupts can be utilized to


manage timing and control tasks such as sampling
input signals or generating output signals at precise
intervals. For instance, when using a Low Power
Interrupt Timer (LPIT), periodic interrupts can be
configured to execute code at specified rates. This
is particularly useful for generating PWM signals
based on sampled data from sensors, ensuring
accurate and responsive control of outputs

Interrupt Pins on Arduino :


Example: Arduino PWM with Interrupts:

A practical example involves using an Arduino


board where an external PWM signal can trigger an
interrupt to enable or disable another PWM signal
generated by a Digital-to-Analog Converter (DAC).
Below is a simplified code snippet illustrating this
implementation:
volatile bool pwmState = LOW;

void setup() {
pinMode(2, INPUT); // External PWM input
pinMode(9, OUTPUT); // PWM output pin
attachInterrupt(digitalPinToInterrupt(2),
togglePWM, RISING); // Trigger on rising edge
}

void loop() {
analogWrite(9, pwmState ? 255 : 0); // Write PWM
signal based on state
}
void togglePWM() {
pwmState = !pwmState; // Toggle state on
interrupt
}
Conclusion

Interrupts play a vital role in enhancing the


responsiveness and efficiency of embedded
systems, particularly in applications involving PWM.
By understanding how to implement and manage
interrupts effectively, developers can create robust
systems capable of real-time processing and
control. The integration of interrupts with PWM
allows for precise adjustments and timely
responses in various applications such as motor
control, lighting systems, and audio processing

You might also like