Volt meter using PIC controller
project is the application of built-in ADC of PIC microcontroller. In which I
discus one example of attenuator for 100v range. If anyone understand this example
he can design for more ranges. There are some learning points for learners.
1. How to Program ADC
2. How to set voltage ratio for ADC input
3. How to adjust attenuator for voltmeter
4. Interfacing of LCD
5. Reading values of ADC
6. How to use built-in libraries of MikroC Pro for PIC
Here is the list of components
1. PIC16F877A
2. Crystal 10MHz
3. Non pol capacitors 33pf
4. Resistors
5. LCD 16x2
Little math for attenuator
Range for 100v
ADC max input voltage 5v
So set the attenuator which drop
95v when input max at 100v
So 100/5 = 20 so the 19:1 is the
best ratio for this division
So simply I set attenuator
resistor R4 19k ohm and input resistor R2 1k ohm
Then see the code
Circuit diagram:
MikroC code:
Little explanation required
for it
I want to show reading from 0v to
100v and ADC input is 5V max so what is scaling voltage value for display
digits = 5v/range
Scaling voltage = 5/100 = 0.05
means 50mv
It means that when 50mv appear at
ADC then must display 1v at LCD.
And another thing in ADC into the
microcontroller that is
ADC length is 10bit output so
what is mini voltage value at which ADC change one step output in binary like
from 0000000000 to 0000000001
= 5/210
5/1024= 0.00488 means 4.8mv
But I want to display 1v at 50mv
now fine the factor to divide ADC output
=50mv/4.9mv = 10.2
So here is very important we will
divide ADC value with factor 10.2 now see
No comments:
Write commentsI am very thankful for your precious time