Shop OBEX P1 Docs P2 Docs Learn Events
Making precise temperature measurements with Prop and MCP3208 — Parallax Forums

Making precise temperature measurements with Prop and MCP3208

pgbpsupgbpsu Posts: 460
edited 2012-02-06 07:54 in Propeller 1
Perhaps this thread belongs in a different forum. If so, I kindly ask the moderator to move it there or point me to the correct forum and I'll move it. The reason I say it might not belong in this forum is because I'm not having problems with the prop part of this. I'm using code from the OBEX and I've tested it and that works fine. To track down my problem, I've removed some of that and the connection to the prop. What doesn't work is my circuit.

I'm using a Prop connected to an MCP3208 to measure temperature (via thermistor) as precisely as possible for some ice crushing experiments. I've attached a hand-drawn version- I'm new to the hardware side of things and haven't gotten past pencil and paper and into ExpressPCB, or DipTrace, etc, although once I get the circuit working I'd like to move this onto a board that could be plugged into the GG Prop USB platform.

The idea here is to embed a thermistor in a block of ice and crush it while recording the temperature (hopefully to a resolution of 0.01C if possible). I'm using an Analog Device's AD820 op amp as a non-inverting amplifier.

I'm trying to design this system to have maximum resloution/accuracy between 0 and -10 degrees C.

Is this circuit, based on the wiki entry http://en.wikipedia.org/wiki/Operational_amplifier_applications for op amps, the right idea?

I've (using my DMM) that V_ref is what it should be: 4.096v and the voltage going into the + side of the op-amp is a very stable 0.452v (after leaving my voltage divider). How do I figure out what voltage I want as an input here given that I have a 12-bit ADC and I really only care about measurement over this narrow 10 degree range? What about the correct resistance between pin 2 and ground given that my thermistor will vary from ~7000 ohms to 10000 ohms as the temperature drops from 0 to -5 and beyond.

I have more info and pictures, but thought I should start with the schematic to see if I'm on the right track.

Thanks,
Peter
1024 x 791 - 36K
«1

Comments

  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-01-17 12:16
    What does your ice crushing experiment entail? I wonder if you might be better off with a non-contact temperature sensor such as the MLX90614. It also has SPI output with 0.14C precision and 0.5C accuracy.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-01-17 12:18
    Concerning your circuit, I think you want to connect pin 4 of the AD820 directly to ground, and pin 3 to your voltage divider.
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-17 12:22
    Hi Circuitsoft-

    Thanks for the link. That's a cool looking part but I don't think it will work for this experiment. First is my goal of getting down to .01 degrees C at the best, but .1C at the worst. And secondly, this sample ends up in a bi-axis compressor and the sample itself is enclosed in a "squishing" vessel. In my current design I embed the thermistor into the chunk of ice and feed the wires out via a small hole drilled in the base of the vessel.

    But I'll look into this as a possibility. I need to see how much space I have below the vessel and if the hole I've drilled moves during the experiment.
  • RaymanRayman Posts: 14,845
    edited 2012-01-17 12:59
    At first glance, your circuit doesn't make sense to me...
    I think pin 4 should almost always be connected to ground or a negative supply.
    Also I don't think c2 should be there...

    One way I look at opamps is that the voltages at the inputs have to be equal. So, assume that your - input equals the + input you're forcing and see what that means for the output voltage... (it's just a voltage divider)
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-17 13:00
    Concerning your circuit, I think you want to connect pin 4 of the AD820 directly to ground, and pin 3 to your voltage divider.

    I made this change (simply removing the Cap between pin3 and 4 and updated the schematic in the original post). I should have been clearer in my first post. This circuit does produce an analog voltage at V_out. I have been measuring it with a DMM. Problem is the several thousand ohm difference between room temperature, ice water, salty ice, water that I see if I measure the resistance of the thermistor directly, collapses when I read the voltage at V_out under the same conditions.

    I thought (wrongly perhaps) that I could use this op-amp to grow the difference between voltage at 0degrees and -10 degrees. To put it another way, I want to convert this large variation in resistance into large (say >3V) differences in voltage between 0 degree and -10 degrees. Do I understand this use of an op-amp correctly? If so, how to I go about configuring this to accomplish this? I don't care if my V_out clips at 5V when my temperature is outside my range of interest. Ideally, I'd map 0 degrees to 0 volts and -10 degrees to 5V. With a 12-bit converter I'd get .002 degrees of temperature change with every millivolt change in V_out.
  • RaymanRayman Posts: 14,845
    edited 2012-01-17 13:15
    Then, I think you have a non-inverting amplifier where Vout= V(pin 3) * (1+ Rtherm/1.9k).
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-17 13:42
    Hi Rayman-

    That suggests to me that if I want a low V_out (say 0.5V) when Rtherm=7000 ohms (0 degrees) I'd want to replace that 1.9K resistor with something really big (66k ohm), but when my Rtherm is 10k ohms (-5 degrees) because the temperature has dropped, to get a V_out of 4V I'd need that 1.9K resistor to be a bit smaller, say 1.2k ohms. I need a variable resistor, but I thought I had that in my thermistor so I must not be using it right.

    So how best do I measure changes in resistance on the order of a few thousand ohms?

    Thanks,
    Peter
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-01-17 13:48
    The circuit you have is an op amp with adjustable gain depending on temperature. However, your input is always zero. Connect pin 3 to your voltage divider, and pin 4 to ground. Then you should be able to read temperatures.

    As another option would be to read the resistance directly from the prop. These values will measure from 7k - 12.7k, full scale. I calculated the values for your purpose, but the code is straight from AN001.
    {{
        3.3V        3.3V
         ┬           ┬
          9.1K  .1µ
         ┣───────────╋──┳────── APIN
        ()NTC   .1µ └──── BPIN
                       31.6K
    
    31.6X/(31.6+X) = 9.1
    
    }}
    
    ''This program demonstrates the use of the counter in POS detector with feedback to  
    ''perform ADC calculations. 
     
    CON 
      _clkmode = xtal1 + pll16x 
      _xinfreq = 5_000_000 
     
    ' At 80MHz the ADC/DAC sample resolutions and rates are as follows: 
    ' sample   sample                
    ' bits       rate                
    ' ----------------               
    ' 5       2.5 MHz                
    ' 6      1.25 MHz                
    ' 7       625 KHz                
    ' 8       313 KHz                
    ' 9       156 KHz                
    ' 10       78 KHz                
    ' 11       39 KHz                
    ' 12     19.5 KHz                
    ' 13     9.77 KHz                
    ' 14     4.88 KHz                
                                     
      bits   = 12                       'try different values from table here 
      fbpin  =  10                      'feedback pin (BPIN) 
      adcpin =  9                       'feedin pin (APIN) 
     
    OBJ 
         txt : "VGA_Text" 
            
    VAR  long value 
     
    PUB go 
      txt.start(16) 
      cognew(@asm_entry, @value)        'launch assembly program into a COG 
      txt.out($00)           'clear the screen  
      repeat 
        waitcnt(40_000_000 + cnt) 'wait 1/2 second until updating 
        txt.out($00)         'clear the screen 
        txt.dec(value)         'write the value to the screen 
     
    DAT 
     
    ' Assembly program 
     
                  org 
     
    asm_entry     mov       dira,asm_dira                   'make pins 8 (ADC) and 0 (DAC) 
    outputs 
     
                  movs      ctra,#adcpin                    'POS W/FEEDBACK mode for CTRA 
                  movd      ctra,#fbpin 
                  movi      ctra,#%01001_000 
                  mov       frqa,#1 
                   
                  mov       asm_cnt,cnt                     'prepare for WAITCNT loop 
                  add       asm_cnt,asm_cycles 
     
    :loop         waitcnt   asm_cnt,asm_cycles              'wait for next CNT value  
                  mov       asm_sample,phsa                 'capture PHSA and get difference 
                  sub       asm_sample,asm_old
                  add       asm_old,asm_sample 
                                                              
                  wrlong    asm_sample, par                 'write the value to main memory 
         
                  jmp       #:loop                          'wait for next sample period 
     
    ' Data 
    asm_cycles    long      |< bits - 1                     'sample time 
    asm_dira      long      |< fbpin                        'output mask 
    asm_cnt       res       1 
    asm_old       res       1 
    asm_sample    res       1
    
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-17 14:24
    Hi Circuitsoft-

    I have connected my voltage divider to pin 3 and grounded pin 4. The circuit works in the sense that I can get differing voltages at V_out based on changing temperature of the thermistor (dip it in ice water, hold it between fingers, etc). It just doesn't give the variety/range I was hoping for.

    Your code came through fine, but the schematic got munched a bit (by my browser perhaps). Using the Prop to read the ADC values directly could be used to replace the MCP3208. I'm using a prop demo board which, I believe the App not says won't work. Nonetheless it's worth a try. Can you clarify your schematic above? I assume the items along the bottom are ground? I'm looking at version 2.0 of the AN001 app note. I don't see the schematic you drew in there, although the code does seem to be in the section "Pin State Detection Mode". This doesn't follow figure 14 does it?

    Thanks,
    pb
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-01-17 15:18
    My schematic is different. If you copy it and paste it into propeller tool, it'll probably read okay.

    The circuit won't work properly on a solderless breadboard because resistances are too high/unpredictable. On the demo board, you should be okay.

    So, bridge a 31.6K resistor between P10 and P11. Bridge a .1uF cap from P10 to ground, and put the thermistor in parallel with it. Bridge another .1uF cap from P10 to +3.3V and parallel it with a 9.1K resistor. Make all wires as short as possible. Use 0402 SMT components where possible.
  • RaymanRayman Posts: 14,845
    edited 2012-01-17 15:37
    The sigma-delta ADC really need SMT parts, very close to Prop pins to work the best.

    Personally, I think I'd use thermocouples and an ADC chip that can read them directly...

    .01 C accuracy might be a challenge though...
  • RaymanRayman Posts: 14,845
    edited 2012-01-17 15:45
    I just googled up this page with a circuit similar to yours:
    http://www.8052.com/forum/read/56295

    Looked some more and 0.01 C looks tough...
    Here's a chat where they say you can do it with a 24-bit ADC with programmable gain:
    http://e2e.ti.com/support/other_analog/temperature_sensors/f/243/t/106864.aspx

    But, they want a wide measuring range and precision.
    If you just need a small range of temperatures and also are just looking for relative changes and not the
    absolute temperature, then just an OPAMP buffer to a regular ADC might work...
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-01-17 19:15
    To achieve both the zero out at 10kΩ and 5 Volts at 7kΩ, consider a differential amplifier.

    First, I might suggest using a differential input high resolution ADC instead of the MCP3208. Just to illustrate and lead into an amplifier circuit, here is what I mean:
    diff_therm2.png

    The 5 volt (or 3.3 volt) supply feeds a bridge circuit consisting of 3 x 10kΩ resistors, and your thermistor forms the 4th leg. At zero °C, the differential voltage to the ADC is zero. And when the sensor resistance is 5kΩ, the differential voltage to the ADC is 0.833 V. A 12 or 16 bit ADC with i2c interface, with an internal PGA (programmable gain amplifier), will have a range that can convert that 0.833 V input with something well better than the 500 steps you need for you 0.01 degree resolution. The signal is ratiometric, so you want a ratiometric ADC, so that the exact value of the power supply does not matter. The thing that matters is the ratio of the thermistor to the other bridge resistors.

    Here is an amplifer circuit that could go before the MCP3208.
    diff_therm.png

    The idea is similar. There is a bridge there with 3 x 10kΩ resistors and the thermistor forms the 4th leg. When the thermistor is at 10kΩ, the output V1 from the first op-amp is zero, and if the thermistor resistance drops to 5k, then the op-amp output increases to 1.67V due to feedback. The second stage amplifies that change by a non-inverting gain of x3. That brings the final output to the ADC to 0 to 5V. Provided that the ADC reference is also the voltage feeding the bridge, this too is a ratiometric circuit, not too sensitive to the exact power supply voltage.
    496 x 350 - 15K
    641 x 377 - 17K
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-18 09:42
    My schematic is different. If you copy it and paste it into propeller tool, it'll probably read okay.

    The circuit won't work properly on a solderless breadboard because resistances are too high/unpredictable. On the demo board, you should be okay.

    So, bridge a 31.6K resistor between P10 and P11. Bridge a .1uF cap from P10 to ground, and put the thermistor in parallel with it. Bridge another .1uF cap from P10 to +3.3V and parallel it with a 9.1K resistor. Make all wires as short as possible. Use 0402 SMT components where possible.

    Circuitsoft- Thanks for clarifying your schematic. I'm using a demo board (with friction bread board area) for this so SMT parts and using the counters for ADC functions isn't an option. However, simply using the 10k resistor and my thermistor as a voltage divider into either the MCP3208 or a DMM gives solid results. How did you decide that resistor should be 9.1k?

    Even this simple voltage divider circuit may be good enough. I went back to the data sheet for my thermistor. Without calibration it should be good to 0.1C. If I got that that performance out of it I think that would work. I'm trying Tracy's second circuit to see if I can do a bit better.
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-18 09:50
    Rayman wrote: »
    The sigma-delta ADC really need SMT parts, very close to Prop pins to work the best.

    Personally, I think I'd use thermocouples and an ADC chip that can read them directly...

    .01 C accuracy might be a challenge though...

    Rayman-

    Thermocouples don't normally have this kind of resolution so I think I'm stuck with a thermistor. Which is fine because I think I'm making some progress with all the help on the forums. My requirements have eased a bit so I might be able to pull this off.
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-18 11:02
    Hi Tracy-

    Thanks for your generous help. Before trying the first schematic you suggested, I tried the second. I already have all the parts and it makes sense to me intuitively. This is my first real effort at hardware stuff. What you sent works well at both 0 degrees and ~-10. I understand the 3x gain on the second op amp. But how did you pick resistor values for the first op amp? After freezing the thermistor into a block of ice and doing a few more measurements (and asking the vendor for temp vs resistance) curves I've found that my range of resistance for -10C to 0 is more like 12Kohms - 7Kohms. I'd like to understand how I can recalculate the resistor values on the first op amp stage to work for this range rather than the 10-5k range I first stated.

    Thanks again. This is working beautifully. Btw, I have a reference voltage chip, but it's not used in this circuit. Should it be? What about capacitors? They seem to get sprinkled around but I'm not sure where they should go.

    Gratefully,
    Peter
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-01-18 11:46
    Sprinkle around some capacitors, across the op amp power supplies. There won't be capacitors in the signal path unless you find that there is too much noise (fluctuations in the reading). The voltage reference is not used because this is a ratiometric circuit. As drawn, the op amp (the second op amp in particular) needs to be one that can operate from a single supply so that it can go to zero volts into the ADC. It may be a good idea to offset the input a little from zero, so make it cover a little wider range, 1°C down to -11°C.

    If the thermistor resistance is 12k at -10°C, then choose the other three resistors (R4 especially) to be 12k fixed. The bridge is in balance when the thermistor is at 12k, and at that point the same voltage (2.5V with a 5V supply) will be at both inputs of the first op-amp, and the op amp outputs will both be zero (or as close to zero as they can be). When the Rthermistor decreases to 7kΩ at 0°C, the voltage at the sensor arm of the bridge wrt common will be,
    5V * (12 / (7+12)) = 3.1579V.
    Due to feedback action, that same voltage will appear at the V- input at the junction of the other two other equal resistors. That makes the output V1=1.3158V.
    In general, assuming 5V supply,
    V1 = 5 - (10 * R3 / (R3 + R4)).
    Note that the feedback resistors R1 and R2 are not in the equation. The only important thing is that they are equal. Note also that when you plug in R3=R4, you get V1=0.

    To bring 1.3158 V up to 5 V, the gain is 5/1.3158 = 3.78. Choose resistors for non-inverting gain such that,
    R6/R5 + 1 = 3.78.

    I'm glad that helped. Ask again if you want clarification.
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2012-01-23 14:32
    Sprinkle around some capacitors, across the op amp power supplies. There won't be capacitors in the signal path unless you find that there is too much noise (fluctuations in the reading). The voltage reference is not used because this is a ratiometric circuit. As drawn, the op amp (the second op amp in particular) needs to be one that can operate from a single supply so that it can go to zero volts into the ADC. It may be a good idea to offset the input a little from zero, so make it cover a little wider range, 1°C down to -11°C.

    If the thermistor resistance is 12k at -10°C, then choose the other three resistors (R4 especially) to be 12k fixed. The bridge is in balance when the thermistor is at 12k, and at that point the same voltage (2.5V with a 5V supply) will be at both inputs of the first op-amp, and the op amp outputs will both be zero (or as close to zero as they can be). When the Rthermistor decreases to 7kΩ at 0°C, the voltage at the sensor arm of the bridge wrt common will be,
    5V * (12 / (7+12)) = 3.1579V.
    Due to feedback action, that same voltage will appear at the V- input at the junction of the other two other equal resistors. That makes the output V1=1.3158V.
    In general, assuming 5V supply,
    V1 = 5 - (10 * R3 / (R3 + R4)).
    Note that the feedback resistors R1 and R2 are not in the equation. The only important thing is that they are equal. Note also that when you plug in R3=R4, you get V1=0.

    To bring 1.3158 V up to 5 V, the gain is 5/1.3158 = 3.78. Choose resistors for non-inverting gain such that,
    R6/R5 + 1 = 3.78.

    I'm glad that helped. Ask again if you want clarification.

    Tracy,

    What's the advantage of using a bridge circuit (3 resistors + the thermistor) versus a simple voltage divider with the thermistor and a fixed resister?

    BTW, I think you may have swapped R4 with R3 in your equation for V1 above. Shouldn't it be: V1 = 5 - (10 * R4 / (R3 + R4)) ?
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-23 14:40
    Sal-

    I can't answer your question about why a bridge and not a simple divider, but I can say this circuit has worked very well so far. I hope to have some of the temp data to plot (and share) soon. I believe you are correct in your comment about the equation. When doing calculations, I found/used the same expression you have. I think it was probably simply a transcription error by Tracy.

    Peter
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-01-23 15:15
    The advantage to a bridge circuit is that the reference voltage changes with supply jitter identically to the measured voltage. So, it makes it much easier to amplify small changes into significant easily-measured values.
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2012-01-23 16:51
    One more question regarding the formula for V1: shouldn't it be the absolute value of the formula shown, e.g.

    V1 = abs(5 - (10 * R4 / (R3 + R4))) ??

    If the abs() is omitted, then if R4 is 12K as in the example, and R3 drops to 2K, then the result is

    V1 = 5 - (10 * 12000 / (2000 + 12000)) = -3.57v

    which is clearly impossible with the schematic shown. In fact, this formula goes negative for any R3 < 12K.

    Running an LTSpice model of this circuit always gives positive values of V1 for R3 < 12K.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-01-23 21:31
    I stick with my formula in post #18 (referring to the 2nd schematic in #14).
    V1 = 5 - (10 * R3 / (R3 + R4))
    That could have been simplified to
    V1 = 5 * (R4 - R3) / (R4 + R3)
    In the diagram, R4 is always larger than R3 (you set it up that way). So the subtraction result is always positive, and V1 is positive. If your op-amp happens to have both (+) and (-) power supplies, then indeed if R3 becomes larger than R4, the output of the op amp will go negative. No absolute value. The negative value would not be good for the MCP3208 ADC though, as it only converts positive voltages.

    A simple divider consisting of a 12k resistor in series with a 7k--12k thermistor is fine, except that the voltage swing (with 5V excitation) is only be 0.66 volt at the junction. The bridge circuit provides an offset and the op-amps provide zero reference and gain, so that the change from 7k--12k fills the entire 5V range of the converter.

    When I look at that bridge circuit with the op-amp, I anchor my quick analysis out of habit to the 5V supply, not to ground. The action of feedback (if the op-amp is hooked up right) will be to bring the two inputs to the same voltage. Therefore, the voltage across the sensor R3 will be the same as the voltage across R1, and since the same current flows through equal resistors R1 and R2, the voltage across them in series is twice the voltage across R1. And the output voltage will be 5 minus that. So immediately,
    V1 = 5 - (2 * 5* R3 / (R4 + R3)
    where 5*R3/(R4+R3) is the voltage across R3. And that is what simplifies to
    V1 = 5 * (R4 - R3) / (R4 + R3)
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2012-01-24 10:18
    I stick with my formula in post #18 (referring to the 2nd schematic in #14).
    V1 = 5 - (10 * R3 / (R3 + R4))

    Tracy,

    Your formula for V1 agrees with my Spice model of the circuit, and I agree with your analysis. My analysis, however, always comes out with R4 stubbornly in the numerator rather than in the denominator as it is in yours. It's been a while since I've done any circuit analysis, so I'm probably doing something wrong or missing a step. Here's my analysis:

    Let's call the 5 volt supply Vcc...

    V+ = Vcc(R4/(R3+R4)) i.e. a simple voltage divider

    V- = (Vcc - V1)(R2/(R1+R2)) another simple voltage divider

    Since the op-amp feedback will force V- = V+, then

    Vcc(R4/(R3+R4)) = (Vcc - V1)(R2/(R1+R2))

    Solving for V1:

    V1 = Vcc - (VccR4(R1+R2) / R2(R3+R4))

    If R1 = R2, then:

    V1 = Vcc - (2VccR4/(R3+R4)) (conveniently, R2 cancels out)

    This is the same as your formula for V1, except it has R4 in the numerator rather than R3.
  • LawsonLawson Posts: 870
    edited 2012-01-24 12:09
    The attached schematic shows the circuit I used to measure the temperature of a Digikey 495-2623-ND thermistor to a precision of +-300uK at a 3 sigma certainty. (I like this thermistor because it's tiny with fairly tight tolerances) I'm posting this because it could be helpful with future upgrades. Also, this is a fun circuit to play with because it's sensitive to EVERYTHING. Even taped to the top of a small aluminum sheet with copper tape, I could tell when the lights in the room were turned on and off.

    For my circuit I'm using the thermistor in a "half-bridge" configuration because the 24-bit ADC is directly reading the voltage changes on the resistor bridge so the zero-offset compensation of a full bridge is just extra parts. The op-amp only buffers the thermistor bridge and input anti-aliasing filter from the ADC and could be eliminated at moderate sample rates if the input loading from the ADC was compensated for in software. While this circuit requires greater ADC precision, it avoids introducing most noise from the op-amp. I also use a filtered buffered reference voltage to drive the half-bridge and the ADC to keep noise from sneaking in through the reference pin. (got this off the ADS1251 datasheet) R102 should have an extremely low temperature coefficient to minimize the effect of ambient temperature on the thermistor resistance measurement. I used digikey PLT0805-5.0KACT-ND for R102. The whole circuit demonstrates at least a 10,000/1 ratio between it's sensitivity to thermistor temperature and ambient temperature. (sufficient to push a 2-4 degree HVAC temperature swing to less than a mili-Kelvin of error)

    The software on the propeller then samples the ADS1251 at 4KHz and uses a 3rd order CIC filter (fancy name for a speed optimized moving average filter) to divide the sample rate by 128 to 31.25Hz. (20KHz sampling and a divide by 512 filter might be better in general, but I had a known noise source at 4KHz I wanted to eliminate) This software filtering gives me a sqrt(128) improvement in signal to noise, and is the final component that gets me to the sub-miliKelvin precision. The ADS1251 was chosen because it has an extremely simple interface and none of the more complex competing chips I saw offered clearly better performance.

    Lawson
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-01-24 12:42
    Nice setup Lawson! I haven't taken the plunge into 24 bit converters, but they sure do make that circuit clean and easy. Also ratiometric, so the voltage from the reference does not matter, so long as it is stable and noise free over the time course of a measurement, however, the value of the reference resistor does demand the highest accuracy and stability. I've been using 16 bit converters with a selectable 16x PGA to narrow the input range, but that does introduce the accuracy and noise of the PGA into the signal path. At 24 bits, a single bit is like the thickness of one sheet of copy paper in a stack 1.7 kilometers high.

    Sal,
    I think the error is in this equation:
    V- = (Vcc - V1)(R2/(R1+R2)) another simple voltage divider
    That puts V- at (Vcc-V1)/2, because R2=R1. Not so. It should be (wrt Vss):
    V- = V1 + (Vcc - V1)*(R2/(R1+R2)
    ..... = V1 + (Vcc - V1)/2
    The even split of voltage between R1 and R2 is added to the voltage at the output.
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2012-01-24 13:49
    Sal,
    I think the error is in this equation:
    V- = (Vcc - V1)(R2/(R1+R2)) another simple voltage divider
    That puts V- at (Vcc-V1)/2, because R2=R1. Not so. It should be (wrt Vss):
    V- = V1 + (Vcc - V1)*(R2/(R1+R2)
    ..... = V1 + (Vcc - V1)/2

    Yep, that was it. I forgot to account for V1 (in addition to the divider). When I fix this and solve for V1, I get

    V1 = 2Vcc(R4/(R3+R4)) - Vcc

    This still has R4 in the numerator, but this equation is equivalent to yours.
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-24 20:07
    Hi Sal-

    I see Tracy has set the record straight. Sorry for mis-leading you about the equation. I should have chimed in earlier to let you know how this functioned in practice. We chose all the resistors in the first op-amp stage to be 12.7K ohms. When the thermistor was really cold (like -20C) the resistance was nearly 30k ohms and the output at V1 was zero. When the resistance in the thermistor was warm ( say room temperature) the resistance was low (~2.5kohms) our output was 5V. I have some notes about what resistances started producing an output voltage and where it started clipping. I can dig that out of you'd like to see it.

    Lawson-
    Thanks for sharing your circuit. 300uK is very impressive. I can see why you'd need to go to 24-bit ADC to get that kind of measurement. I have some experience with the AD7767 24-bit low power ADC. Once I get my head around our results I'll see if we need to upgrade. Again, thanks for sharing. Would you be willing to share your CIC code? That also sounded very interesting.

    Cheers,
    Peter
  • LawsonLawson Posts: 870
    edited 2012-01-25 11:59
    @Tracy: Well, 24-bit ADCs are highly statistical bits of silicon. They're based on taking a ton of crude samples and averaging them. For instance, the ADS1251 in an ideal circuit has a noise floor of about 19 bits rms directly out of the chip. (~16-17 stable bits) If you further average the samples in software you can improve resolution at the expense of sample rate. I'm running just about 19.5-bits rms or about 17.3 stable bits with my temperature measurements. (I've got more noise on this pcb than I'd like) The really nice thing is that my first alias of DC is at ~1.4MHz which lets me get 80-100dB of attenuation at the first alias with an over-damped 2nd order input filter.

    @pgbpsu: I've attached my assembly driver for the ADS1251. Its designed to run 4 chips in parallel with one Mclk and one Sclk shared with all the chips and the Dout of each chip individually brought to the propeller. The third order CIC code follows the serial input code and was added after finding a 2.5Hz buzz (an alias of 60Hz) in my data when simply averaging the samples. (btw, the internal averaging filter in the ADS1251 is also a CIC filter) This code was put together after reading several articles on the web. It does help that I'm fairly familiar with the z-transform when reading the articles. (x*z^-1 translates to x(k-1) in code) This code does what I need it to do, but is in no way a general purpose driver.

    Lawson
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2012-01-25 12:23
    pgbpsu: Does the thermistor survive crushing the ice, or do you replace it for every attempt?
  • pgbpsupgbpsu Posts: 460
    edited 2012-01-25 12:31
    @Lawson-

    Thanks for sharing the code. I'll have a look at it. For what we're doing so far Tracy's circuit is working well. But we have ideas for a regulation experiment where more precise and accurate measurements might be required. So we might be able to put your circuit to use. Thanks.

    @Sal- It survives. I'm still trying to get the data pulled together and work on some other things but I intend to post some plots of temperature and some photos as well. That should help explain how things are hooked up.
Sign In or Register to comment.