View previous topic :: View next topic |
Author |
Message |
MAKInnovation
Joined: 16 Nov 2010 Posts: 61
|
AD595 |
Posted: Thu Sep 12, 2013 12:49 am |
|
|
Dear Friends;
I am confused to develop a formula for AD595 temperature measurement IC.
My Code is below:
Code: |
#include <18F6722.h>
#DEVICE ADC=10
#fuses HS, NOWDT, PROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 10000000)
#include"D:\Drivers\Flex_LCDPORTF.C"
#use rs232 (baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
LONG RatioSel;
float temp;
void main()
{
set_tris_a(0XFF);
lcd_init();
setup_adc( ADC_CLOCK_DIV_8 );
setup_adc_ports(ALL_ANALOG);
while(1)
{
int16 i;
set_adc_channel(1);
delay_us(100);
RatioSel = read_adc();
RatioSel = RatioSel * 1.25;
lcd_gotoxy(1,3);
printf(lcd_putc,"RatioSel: %ld ",RatioSel);
delay_ms(1000);
}
}
|
I am using the resister devider circuit with 15K at IC side and 10K at ground side and middle pin is connected on analog pin of microcontroller.
when the temperature is 30C the value of the IC is 0.3 and ic read 0.12v on its analog pic because of devider circuit.
As per my understanding calculation would be
1023/5 * 0.12 * 1.25 = 30
Is it correct or please make me correct.
I dont know why i have to use "1.25" multiplier to make my result correct.
Also this formula does not work for the whole range from 0C to 1000C i required.
Can any one tell me the correct formula for temperature calculation using above hardware setting or suggest me any other correct option.
Regards
Ashraf |
|
|
alan
Joined: 12 Nov 2012 Posts: 357 Location: South Africa
|
|
Posted: Thu Sep 12, 2013 1:17 am |
|
|
Actually quite easy.
You are getting a digital value of 0.12*1024/5 = 24 (already inaccurate because it should be 24.7)
Now you need to convert it back to an "analog value" as that is what you're measurement are related to.
Vchip = (ADC * 5/1024) / (voltage divider) = 24 * 5/1024 * 25/10 = 0.293.
The output of your sensor are 10mV/Deg.
Temp = Vsensor / 0.01 = 29.3 should have been 30 but see top of post.
Thus your actual multiplier are 5/1024 * 25/10 * 1/0.01 = 1.221
Regards
Alan |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Sep 12, 2013 1:34 am |
|
|
Further comments though:
What is the minimum recommended source impedance for the ADC?. Does your divider meet this?. You need a buffer amplifier, or to use lower resistance values on the divider.
Then, don't set the channels as 'ALL_ANALOG', unless you are going to use all the analog channels. Each channel selected to the input multiplexer, potentially increases noise injected to the ADC. OK if the pins are connected to nice stable analog signals, but not if the pins are floating.
Then the big 'limit' on accuracy is using the power supply as Vref. Even with a good PSU, this will only be 1% 'accurate' at best, and _will_ have significant noise spikes on it as the CPU works. For high accuracy with low level signals, you need to be using a proper high precision Vref.
Remember also that simple resistors, will only typically be 1% at best accuracy....
Best Wishes |
|
|
MAKInnovation
Joined: 16 Nov 2010 Posts: 61
|
|
Posted: Thu Sep 12, 2013 1:59 am |
|
|
Thank you friends |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Sep 12, 2013 8:46 am |
|
|
You CAN use Vdd as the reference supply with excellent results.
I have several heat control designs ( with 12bit A/Ds) where
Vdd is supplied by an LM317 from a 12V primary supply.
The "calibration" is preformed by fine adjustment of the LM317 divider pot.
works superbly well, |
|
|
MAKInnovation
Joined: 16 Nov 2010 Posts: 61
|
|
Posted: Thu Sep 12, 2013 11:34 pm |
|
|
Dear Asmboy;
Can you send me a complete schematic of heat c ontrol design on my email address
[email protected]
Ashraf |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
|
|