Shop OBEX P1 Docs P2 Docs Learn Events
Reading temperature with commonly found RadioShack parts? — Parallax Forums

Reading temperature with commonly found RadioShack parts?

eagletalontimeagletalontim Posts: 1,399
edited 2013-03-26 22:03 in Propeller 1
I am looking to build a very simple temperature sensor that can read 20 to 60 degree F using basic items found at a RadioShack. The components I already have are resistors, standard switching transistors (NPN and PNP), a 741 OP amp, a few 555 timers, diodes, zener diodes, and voltage regulators. I cannot buy any parts for this project so I am limited to what I have on hand. Any information, preferably a schematic, on how to possibly build an ADC with the 741 that can possibly use a diode as the "probe". I have already searched but can't seem to find any schematics or code that will work :(

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2013-03-24 19:45
    VF changes 2mV / degree centigrade
    The only thing is calibrating it.
    Current to voltage amp
    Accuracy, not great.

    [General Discussion]

    DC amplifier (inverting, non-inverting, your choice), X5


    nominal 0.6V in, 3V out
    10 degree change, 20mV change
    0.620 V * 5 = 3.1V out
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-24 20:20
    I found an old thermistor and am using a 555 timer to create pulses out to the Prop based on the analog signal from the thermistor. I am watching it on my O-scope and it seems to be adjusting to temperature changes but the waves are not square, they are saw blade? Must have something strange in my circuit to cause that.
  • jmgjmg Posts: 15,173
    edited 2013-03-24 21:17
    I am looking to build a very simple temperature sensor that can read 20 to 60 degree F using basic items found at a RadioShack. The components I already have are resistors, standard switching transistors (NPN and PNP), a 741 OP amp, a few 555 timers, diodes, zener diodes, and voltage regulators.

    There is a useful app note here
    http://cds.linear.com/docs/en/application-note/an137f.pdf
    - and this mentions using PNP transistors as the sense element. 2N3904 or 2N3906.seem to be popular choices, so there should be calibration info out there for these devices.
  • JonnyMacJonnyMac Posts: 9,108
    edited 2013-03-25 09:04
    You could connect the thermistor and a capacitor as an RC circuit, charge or discharge the cap (depending on configuration), the switch the pin to input mode to allow the thermistor to discharge or charge the cap. You could use a counter to measure the time required and linear this to temperature. Two components and some code. Easy.

    Have a look at page 126 of the PEK manual.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-25 09:36
    I've had really good experiences with this thermistor, which I think I originally got at Radioshack back in the day. I use it with a 0.22µF cap. I have a SPIN method that uses PASM RCTime and I get really good resolution (<0.1°F) and accuracy probably around ±1°F without individual calibration. With it, you can get it about as accurate as you want.
    It also is setup to function at any PLL mode (since I use it at several different speeds)
    OBJ
      RC     : "RCTIME"                                     ' RCTIME counter (PASM)
      FLT    : "FloatMath"                                  ' SPIN float math (plus the ln function in here)
    
    VAR
    
      BYTE SPEED_MULT                                       ' when at 40MHz, this is 0; 1 = 20MHz, 2 = 10MHz, 3 = 5MHz  
    
    PRI get_temp : temp | rtime
    '' determine temperature from RC time and assign temp_output
      
      IF (rtime := RC.RCTIME(TEMP_p, 500, 1, TEMP_RC_WAIT) << SPEED_MULT)                                   ' use ">> 1" instead of "<< SPEED_MULT" when useing 80MHz clock
        temp := FLT.FRound(FLT.FAdd(FLT.FMul(-379.223, ln(FLT.FFloat(rtime))), 4054.36))                    ' result it degrees in F * 10
    
    PRI ln (val)
    '' Thanks to lonesock (Jonathan)
    
      RETURN FLT.FDiv(FLT.FFloat(val - $3F7A_7DD1), 12102203.0)
    
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-25 17:34
    The reason I am going with the 555 circuit is because I would also like to learn about this same circuit for a 5V ADC for another project I am working on. This gives me a little hands on experience with it :) I can test the temperature with other already made devices so I can convert the pulses into a temperature reading. Interesting stuff I am learning as I tinker with this more!
  • JonnyMacJonnyMac Posts: 9,108
    edited 2013-03-25 18:53
    Bear in mind that in the 555 the thermistor is controlling charge or discharge timing of a cap which is connected to a comparator that controls the output. It's not buying you anything.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-25 19:15
    Would I be better off using an OP amp instead?
  • JonnyMacJonnyMac Posts: 9,108
    edited 2013-03-25 19:50
    My point is that you don't get anything from the 555 that you cannot do with the Propeller as is. It all comes down to your resistive element (thermistor) controlling the charge/discharge of a cap. You can route that through the 555 and measure the pulse, but you don't need it. The 555 is not an ADC; it's a single-shot or oscillator (you're using the latter). Whether you use the 555 or not, you are still measuring time and converting that to an analog voltage.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-25 20:25
    Exactly. Take a step out of the equation. No need to complicate it more.

    Remember the acronym KISS
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-25 21:13
    So where can I find a schematic on how to wire the thermistor to the Prop? Is there any code in the Obex that I could use for this? I only have 2 days left before I leave to go hunting and this project includes a peltier cooled cooler which I would like have shut off when the temp inside reaches 32 degrees. Right now, I can cool it down to 15 degrees which is too cold for drinks.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-03-26 04:19
    It is as simple and complex as this:
    Thermister1.png

    There are OBEXs for this.

    Basically:
    1. Permanently set the pin to low.
    2. Set the pin to output, Discharges the capacitor.
    3. Set the pin to input.
    4. Remember the time.
    5. Wait for pin to go high.
    6. Read time again.

    BTW, that's very similar to what the 555 does, but without the 555.

    Note! I drew the schematic with a pullup thermistor. This same operation can just as easily be done with a pulldown thermistor configuration.

    Duane J
    696 x 312 - 18K
  • jmgjmg Posts: 15,173
    edited 2013-03-26 12:47
    So where can I find a schematic on how to wire the thermistor to the Prop? Is there any code in the Obex that I could use for this? I only have 2 days left before I leave to go hunting and this project includes a peltier cooled cooler which I would like have shut off when the temp inside reaches 32 degrees. Right now, I can cool it down to 15 degrees which is too cold for drinks.

    You could simply clone the 555, but then you have C variations in the equation, and the transfer is Non-linear. However, it could work ok for a single set-point.


    Or you could look somewhere like this
    http://ww1.microchip.com/downloads/cn/AppNotes/cn_00685b.pdf

    and the run the Prop in Resistor-ADC mode. Sounds complex, but really is just a resistor from FF.D (ADC-in) to GND which sets the current, and then the Thermistor + correction resistor in parallel, connect to the FF.Q (ADC Feedback). Plus the standard SDM caps.

    The negative feedback keeps a constant voltage across pulldown resistor (== constant current) and now the Counter ADC value, is the average voltage needed on the Thermistor to give stable operating, (drops as temperature increases) and gives (CalValue-CounterValue) Scaled as ~temperature.
    Spice plot added for clarity : This shows a raw NTC, and a parallel compensated NTC, and an error plot.
    Highest voltage is at lowest temperature, so you would scale Current and Correction R, to suit temperature range of interest.
    The Prop ADC has a virtual Gnd of ~50% Vcc so has a Vlimit of ~1.65V
    1024 x 620 - 40K
  • JonnyMacJonnyMac Posts: 9,108
    edited 2013-03-26 12:49
    So where can I find a schematic?

    Duane has made it easy and as I pointed out in post #5, the PEK documentation (which you can find under the Help menu in the Propeller Tool) has all kinds of good information starting on page 126.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-26 20:45
    I have switched over to using the RCTime and using the thermistor that I have on hand along with some ceramic caps that I had laying around. The only caps that I have are 102, and 103. Is there any way to calculate the figures to plug into Bobb Fwed's post above? This is the last day I have to get this finished and I have gotten nowhere :(
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-26 21:11
    It's all about testing. Each thermistor will have different values.
    I used Excel's equation calculator (I forgot what it's called). It gives you the numbers based on 3 or more sample values.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-26 21:23
    Hmmm, well, I would not know where to begin. I guess I can just bring my thermometer with me and unplug the power supply when it gets too cold...
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-26 21:34
    OK. Then get your RCTime value, and right it next to the current temperature.
    Get 3 or more samples across as wide of a range as you will be using.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-03-26 22:03
    I will have to get the readings tomorrow after work since I have to be up in 6 hours... Tomorrow is the last day I have to work on this and I hope to get it working!
Sign In or Register to comment.