Giter Site home page Giter Site logo

thermistor_by_cubik2k's Introduction

Thermistor

Updates

  • 4/18/2021 - initial creation (2021 tax day for the USA)

This library is intended to be used with thermistors of type NTC or PTC. This library will convert the thermistors resistance to a temperature given the thermistors B-value, center temperature and center resistance (the typical approach), or if you have the thermistors thermal constants (less popular method). Methods are provided for you to measure the resistance, pass that resistance in, and get a temperature back, or you can pass in an analog pin, number of averages, and a few other parameters and the library will get the average and send back the temperature. Note this "autoMeasure" approach is blocking and will not return control until the measurements are made.


Create the object based on how you want to compute the temperature

  • If you have the B-value, center temp and center resistance
  • Thermistor MyThermistor(double B, double CenterTempC, double CenterResistance);
  • if you have 3 thermal constants as reported by the data sheet
  • Thermistor MyThermistor(double R1, double ConstA1, double ConstB1, double ConstC1);
  • if you have 4 thermal constants as reported by the data sheet
  • Thermistor MyThermistor(double R1, double ConstA1, double ConstB1, double ConstC1, double ConstD1);

Use the begin method to designate how you want computations made

  • If your code measures, averages, and computes the thermistors resistance, omit arguments in the begin method. Then use the getTempX, passing in the resistance and a temp is returned

  • void begin();

    double getTempF(double Resistance = 0.0);
  • If you want the library to measure, average, and compute temperatures pass in the analog pin, and other parameters to the begin method. Then use the getTempX and omit any arguments

  • void begin(int AnalogReadPin, unsigned long ReadSamples, unsigned long ReadResolution, unsigned long R1, double VoltageDividerVolts);

    double getTempF();

Typical Wiring
Thermistors either NTC ot PTC are typically wired in a voltage divider scenario. This allows the voltage to be measured across them and resistance computed.

Computing Thermistor Resistance

  1. Use a voltage divider as shown above
  2. Measure the bits at the analog pin
  3. Convert bits to volts using the appropriate bit resolution 1024 for 10 bit MCU's. volts = bits / resolution;
  4. Using a voltage divider equation Vo = Vi (R2 / (R1 + R2))
  5. Use the equation to solve for R2 (R2 (Vi * R1) / (Vo - Vi);
  6. Pass R2 in to the getTempF, getTempC, getTempK, or getTempR methods
  7. Make sure calculations are based on floats or doubles.

Tips on reducing noisy readings

  1. Add decoupling capacitors to the power supply for the voltage divider (100 uF and 0.1 uF to start)
  2. Add decoupling capactitors across the thermistor (10 uF and 0.1 uF to start)
  3. Use averaging
  4. Use AGND if you are using a Teensy AGND is a more insulated ground intended for analog pins
  5. Use 10 bit resolution input if you are using a Teensy 4.0, Teensy 3.2 seem clean at even 12 bits (analogReadRes(BIT))

Typical reading response chart


  1. Readings for a 30-minute period
  2. R1 = 10K resistor
  3. Teensy 4.0, 10 bit read resolution
  4. 0.1 uF decoupling cap across Thermistor
  5. approx 57,000 read per second
  6. Recordings taken every 500 ms
  7. Test environment: desk in my home office
  8. Breadboard mounting, 3 inch jumper wires

thermistor_by_cubik2k's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.