Continue to Site

0-30 v dealing with adc of pic16f877

Status
Not open for further replies.

arbabar

Member level 2
hello,

i want solution of my problem kindly suggest me i m looking for it

my sensor output voltage ranged 0-30v

but controller works on 0-5v

so i use potential divider circuit and limited the voltage to 0-2.5v

as r2=430k and r1=4.7M formula = Vout={r2/(r1+r2)}*Vtotal
Vout={430k/(430k+4.7M)}*30=2.5V as vref=5v so vin(adc)=0-2.50v which mean adc value is from 0-512 ....

now i want to aad check point as

if

vmax of(0-30)v vmin(0-30V) uart Transmit

2.2 1.1 ABC

3.2 2.5 CDE

.. ... ...

hence 16 values.....

i simply find a factor of 12. as 30/2.5=12

so for calculating equavalent value of (0-30)v in range of (0-2.5)v i just simple divide (0-30)v by twelve...

now how can i add check point on my values obeviously i must add them into adc values form 0-512 kindly help me regarding to this i m new b..
i m working in mikro c

how could i design it in editable mode so that one should easly edit it i.e vmax and vmin and transmit alphabatical value

i m using adc, uart , lcd for edition and diplay voltage range, num pad to edit values .....

Use resistor values 6.5K and 1.3k. You will get 5V across 1.3k resistor.

thankyou jayanth.devarayanadurge how do u select these values hit and trial or some formula....

Check the current rating of the MCU pins and calculate a suitable value.

The ratio of the resistor values decides how much the voltage is dropped by, not the values themselves. There are an infinite number of solutions but only some make sense to use.

The criteria is:
1. The ADC needs a small current at it's input so if you make the values too high, the ADC itself will significantly drop the voltage in the top resistor and make the reading less accurate.
2. The ADC input has a capacitance which has to charge through the resistors so it becomes less responsive to rapid voltage changes as the resistor values are made higher.
3. If the values are made lower, they draw more current from the point you are measuring.

A compromise has to be made between loading the voltage you are measuring and the speed and accuracy of the ADC. A good value for the bottom resistor would be in the range 1K to 10K and the top resistor has to be 5 times that value in order to drop 30V down to 5V.

As jayanth.devarayanadurga states, you could use 6.5K and 1.3K or you could use 11K and 2.2K or 3.3K and 16.5K and so on.

Brian.

Status
Not open for further replies.