Author Topic: Help with Thermistor Library  (Read 394 times)

dmm

  • Newbie
  • *
  • Posts: 17
    • View Profile
Help with Thermistor Library
« on: July 11, 2016, 03:02:53 pm »
I'm currently working on connecting a thermistor to the module and reading temperature off of it. It probably seems weird to do this since there is a thermocouple on the board already, but my application is near high voltage lines where there is strong electrical interference which messes up the readings on thermocouples. So I am attempting a thermistor since it measures heat using resistance.

That being said, I don't know how to write a library for a thermistor so I am posting this out there to see if anyone has suggestions on how to approach this or how to do it.

Thank you,
David

Share on Facebook Share on Twitter


mc-Josh

  • Global Moderator
  • Newbie
  • *****
  • Posts: 27
    • View Profile
Re: Help with Thermistor Library
« Reply #1 on: July 11, 2016, 04:26:06 pm »
It is very simple to connect a thermistor to an mcModule. You will need to create a voltage divider with the thermistor and another resistor connected to VDD. Then you will simply read the output voltage with the ADC on the mcModule. The output voltage will depend on the characteristics of the thermistor and the value of the other resistor in the divider.

Here is the code if you have connected the output of the voltage divider to PIN0 of the mcModule and pin 6 as the voltage of the resistor divider to not waste power:
Code: [Select]
Define PinMode Pin0 As AnalogInput Alias thermistorVoltage
Define PinMode Pin6 As DigitalOutput Alias enableThermistorVoltage

Class thermistor
   
    Shared Event measureThermistor() RaiseEvent Every 60 seconds
       
        enableThermistorVoltage = True 'turn on voltage divider
        Thread.Sleep(20000) 'sleep 20ms for voltage to stabilize
        Dim voltage As Short = thermistorVoltage 'return thermistor voltage in mv
       
        'convert voltage to temperature based on thermistor voltage divider characteristics
       
        enableThermistorVoltage = False 'turn off voltage divider to save power
    End Event
   
End Class

You can also refer to "Section 3.8.3 Analog Inputs" of the mcmod110 product specification:
http://static1.squarespace.com/static/5644f11fe4b0d6ca7d80d351/t/575b3d4b40261d09e17d0c60/1465597268701/mcMod110+Product+Specification+V0.3.pdf

Hope this helps.

~mc-Josh
Useful Useful x 3 View List

dmm

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Help with Thermistor Library
« Reply #2 on: July 11, 2016, 06:03:42 pm »
This is great! Thank you for the help.

Now, can you point me to some instruction on creating a look up table? I have a table converting resistance to temperature and looking for how to make a table that can be referenced.

Thanks!

mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Help with Thermistor Library
« Reply #3 on: July 12, 2016, 02:16:13 pm »
@Dave - I did a quick search and it looks like there are a couple websites setup (some with excel sheets that you can download) to help you make this table.

Try these ones out:

http://stratifylabs.co/embedded%20design%20tips/2013/10/03/Tips-ADC-Thermistor-Circuit-and-Lookup-Table/

or

http://www.thingiverse.com/thing:103668

Hopefully either of those can help you out!
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB
Useful Useful x 1 View List