Sei sulla pagina 1di 13

DIGITAL AMMETER

-USING ATMEGA8A

BY-CHANDAN GUPTA
B.SC.(H)ELECTRONICS
3rd yr
6347
Contents
1. Introduction
2. Components Required
3. Circuit Diagram
4. Working
5. Working of ADC
6. Bibliography
Introduction

In this project I am going to make a low range ammeter


using ATMEGA8A microcontroller. In ATMEGA8A, I am
going use 10bit ADC (Analog to Digital Conversion)
feature to do this. Although we have few other ways to
get the current parameter from a circuit, we are going to
use resistive drop method, because it’s the easiest and
simplest way to get current parameter.
Components Required
• HARDWARE COMPONENTS:-

ATMEGA8A, power supply (5v), 16*2LCD, 100uF


capacitor, 100nF capacitor (4 pieces), 100Ω resistor (7
pieces) or 2.5Ω (2 pieces), 100KΩ resistor.

• SOFTWARE:- Atmel studio 5.1, Mega load boot loader.


Circuit Diagram
Working
• The voltage across R2 and R4 is not completely linear; it will be a
noisy one. To filter out the noise, capacitors are placed across each
resistor in the divider circuit as shown in figure.

• In ATMEGA8A, we can give Analog input to any of FOUR channels of


PORTC, it doesn’t matter which channel we choose as all are same.
We are going to choose channel 0 or PIN0 of PORTC. In ATMEGA8A
, the ADC is of 10 bit resolution, so the controller can detect a
minimum change of Vref/(2^10), so if the reference voltage is 5V
we get a digital output increment for every 5/(2^10) = 5mV. So for
every 5mV increment in the input we will have a increment of one
at digital output.
Working of ADC
Now we need to set the register of ADC based on the
following terms:
1. First of all we need to enable the ADC feature in ADC.
2. Here are going to get a maximum input voltage for ADC
conversion is +5V. So we can set up maximum value or
reference of ADC to 5V.
3. The controller has a trigger conversion feature that
means ADC conversion takes place only after an
external trigger, since we don’t want that we need to set
the registers for the ADC to run in continuous free
running mode.
4. For any ADC, frequency of conversion (Analog value to Digital value)
and accuracy of digital output are inversely proportional. So for
better accuracy of digital output we have to choose lesser
frequency. For normal ADC clock we are setting the presale of ADC
to maximum value (2). Since we are using the internal clock of
1MHZ, the clock of ADC will be (1000000/2).
These are the only four things we need to know to getting started with
ADC.
All the above four features are set by two registers,
• RED (ADEN): This bit has to be set for enabling the ADC
feature of ATMEGA.
• BLUE(REFS1,REFS0): These two bits are used to set the
reference voltage (or max input voltage we are going to
give). Since we want to have reference voltage 5V,
REFS0 should be set, by the table.
• YELLOW (ADFR): This bit must be set for the ADC to
run continuously (free running mode).
• PINK (MUX0-MUX3): These four bits are for telling the
input channel. Since we are going to use ADC0 or PIN0,
we need not set any bits as by the table.
• BROWN (ADPS0-ADPS2): these three bits are for setting
the prescalar for ADC. Since we are using a prescalar of
2, we have to set one bit.

• DARK GREEN (ADSC): this bit set for the ADC to start
conversion. This bit can be disabled in the program
when we need to stop the conversion.
Bibliography
1. https://circuitdigest.com/microcontroller-
projects/digital-ammeter-using-avr-atmega8
THANK YOU

Potrebbero piacerti anche