Electronics > Microcontrollers
Problems with internal temperature sensor - MCP3561
Dave_PT:
Hi.
I'm using a Microchip ADC (their forum is having problems, as I can't even register), MCP3561.
The problem should occur in the entire MCP346x and MCP356x family.
I need to read the internal temperature sensor. I know that the precision is nothing special, but it is just to get an idea.
Current status:
At this point I can write correctly and read all the registers.
I can get internal readings of "normal" and "inverted" Vref (via MUX) with saturation of the ADC FS as expected.
As recommended in the datasheet I have MUX[7:0] = 0xDE.
The OSR is high, so that the conversion frequency is low, OSR = 40960.
My Vref+ is a 2.5V reference and the Vref- is the AGND.
My circuit:
Problem:
When I read the ADCDATA register, the value changes a lot practically on all new readings (~ 146000 <-> ~150000), like some king of "step/jump".
Anyway, even if the value was stable, using the temperature conversion equation for a Vref of 2.5V, the value is wrong, as it would be around -119ºC (indoor temp ~25ºC).
temp[ºC] = 0.0013 * (2.5/3.3) * ADCDATA - 267.146 => 0.0013 * (2.5/3.3) * 150000 - 267.146 = -119.4ºC
Some help?
Is it normal the ADC value, with MUX=0xDE, fluctuating so much?
Is the temperature conversion equation really correct?
Thanks!
Dave_PT:
As expected, if I use the MUX to connect Vin+ and Vin- to the same point (for example the "Temp diode P"), the ADC converts the value to 0 (zero).
So far so good ... but I still have no explanation for the strange effect with Temp Diodes.
[EDIT]
If I invert the diode connections, the ADC conversion is approximately equal, but negative as expected.
So the conversion to IC Temperature continues to fail completely ....
MasterT:
Setup: confg_reg: 6 : 1101 1110 (0xDE)
Readings:
0000 0000 0000 0101 0111 1110 1000 0001 (0x00057E81)
0000 0000 0000 0101 0111 1110 1000 1001 (0x00057E89)
0000 0000 0000 0101 0111 1110 1000 1011 (0x00057E8B)
0000 0000 0000 0101 0111 1110 1000 1011 (0x00057E8B)
0000 0000 0000 0101 0111 1110 1000 1000 (0x00057E88)
0000 0000 0000 0101 0111 1110 1000 1001 (0x00057E89)
0000 0000 0000 0101 0111 1110 0111 1010 (0x00057E7A)
0000 0000 0000 0101 0111 1110 1001 0000 (0x00057E90)
0000 0000 0000 0101 0111 1110 1000 0101 (0x00057E85)
0000 0000 0000 0101 0111 1110 1000 1001 (0x00057E89)
Formula math:
TEMP (C) = 0.00133 * ADCDATA (LSb) – 267.146
TEMP (C) = 0.00133 * 360073 * (2.048/3.3) - 267.146 = 30.06 <- seems wrong.
But if I use second formula from DS:
V(in.mV) = 0.2964 * TEMP (C) + 79.32
rearranging:
TEMP (C) = (V(in.mV) -79.32) / 0.2964 = (86.616 - 79.32) /0.2964 = 24.6
I have correct value.
What is going on, is that when I calculate V(IN.mV) I use slope & offset correction factors,
double off_mVolt = -0.000242;
double slp_mVolt = 0.981872;
First formula uses raw hex data w/o correction, and result is off.
Ones more:
ADCDATA-correct = ((360073 *0.981872) --0.000242);
TEMP (C) = 0.00133 *ADCDATA * (2.048/3.3) - 267.146 = 24.67
Dave_PT:
Thanks for the answer.
The big difference between my setup and yours, basically is Vref. I use a 2.5V Vref and you use a 2.048V.
However my reading is practically half of yours in mV ...
Your setup:
raw_adc = 360073
mv = (360073*2.048)/2^23 = ~87.9mV
My setup:
raw_adc = 150000
mv = (150000*2.5)/2^23 = ~44.7mV
It's too perfect to be just a coincidence ...
You are using the gain at x1, right?
Thank you again!
MasterT:
Here is confg_reg = 3;
reg_bits = 0b10001011;
boost = 10; gain = 001, az-mux= 0
Navigation
[0] Message Index
[#] Next page
Go to full version