Giter VIP home page Giter VIP logo

thermocouples's Introduction

thermocouples

Python library of random things dealing with thermocouples.

Type K

Linear interpolation from a table is a standard way to convert from temperature to voltage and back for thermocouples. Strangely I could not find a python library that does that, so I made one.

Type K thermocouples are pretty linear on a small scale. For any 10 degree C range, the slope can be described very well with a linear function. The file typek.py uses the values from NIST at every 10 degrees, and uses linear interpolation to calculate the values in between. This results in a very fast, small library to calculate the temperature from a type K thermocouple given the cold junction temperature and the voltage from the thermocouple.

import typek
temp_C = typek.get_temp(cold_junction_temp_C, thermocouple_millivolts)

Compared to the full set of values from NIST (included as nist_typek.py), the interpolation works very well:

linear interpolation

And the error is well below what most ADC's can measure, and is therefore negligible. For example, my 16-bit ADC with a range of ±0.256 volts measures 7.8 microvolts per bit (theoretical measurement increment), plus some instrumental noise.

Using the same graph from above and subtracting the unit value from the interpolated value shows a maximum error of 3 microvolts at the extremes, and less than 1 microvolt for normal use. At room temperature, that equates to an error of about 0.00002 °C. Note that the accuracy of a type K is about ±1.5 °C.

error

thermocouples's People

Contributors

jonathanimb avatar

Watchers

 avatar

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.