{"id":2177,"date":"2020-03-23T14:00:51","date_gmt":"2020-03-23T13:00:51","guid":{"rendered":"http:\/\/www.sciencetronics.com\/greenphotons\/?p=2177"},"modified":"2025-06-16T18:37:45","modified_gmt":"2025-06-16T16:37:45","slug":"temperature-measurements-with-an-ntc-thermistor","status":"publish","type":"post","link":"https:\/\/www.sciencetronics.com\/greenphotons\/?p=2177","title":{"rendered":"Temperature measurements with an NTC thermistor"},"content":{"rendered":"<p><script src=\"https:\/\/sagecell.sagemath.org\/static\/embedded_sagecell.js\"><\/script><br \/>\n<script>sagecell.makeSagecell({\"inputLocation\": \".sage\"});<\/script><br \/>\n<a href=\"http:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc-300x210.png\" alt=\"\" width=\"300\" height=\"210\" class=\"alignright size-medium wp-image-2191\" srcset=\"https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc-300x210.png 300w, https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc-150x105.png 150w, https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc-400x280.png 400w, https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc.png 708w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nFollowing a discussion on Facebook I put here an online tool to calculate the output of a voltage divider consisting of a fixed resistor and an NTC thermistor following a first order <a href=\"https:\/\/en.wikipedia.org\/wiki\/Thermistor#Steinhart%E2%80%93Hart_equation\" rel=\"noopener\" target=\"_blank\">Steinhart\u2013Hart equation<\/a>.<\/p>\n<p>The calculations are based on a voltage divider where either the voltage over the NTC or over the pass resistor is measured. You can change the values in the script according to your own settings. If you break the script for some reason, just reload the page.<\/p>\n<p><a href=\"https:\/\/www.sagemath.org\/index.html\" rel=\"noopener\" target=\"_blank\">SageMath<\/a> uses Python as programming language.<br \/>\n<br clear=\"all\"\/><\/p>\n<div class=\"sage\">\n<script type=\"text\/x-sage\">\n#----------------------------------------\n# thermistor parameters\n#----------------------------------------\nB  = 4388.3\nR0 = 198.4          # kohm\nT0 = 25             # \u00b0C \nK  = 273.15\n#----------------------------------------\n# voltage divider\n#----------------------------------------\nRpass  = 2.2        # kohm\nV0     = 3.3        # V\nVADC   = 3.3        # V  ADC reference voltage\nADCmax = 1023       # ADC steps\n#----------------------------------------\n# temperature limits\n#----------------------------------------\nTlow  =   0         # \u00b0C\nThigh = 300         # \u00b0C\nTstep =  10         # \u00b0C\n#----------------------------------------\n# calculation part\n#----------------------------------------\nimport numpy as np\ndef NTC_beta (temperature, R0, B, T0):\n    return R0 * exp (B * (1.\/(temperature+K)-1\/(T0+K)));\n#\nT   = np.arange(Tlow,Thigh,Tstep)\nNTC = [(temperature,NTC_beta(temperature, R0, B, T0)) for temperature in T]\nVNTC = [(temperature,V0*RNTC\/(RNTC+Rpass)) for (temperature,RNTC) in NTC]\nVpass = [(temperature,V0*Rpass\/(RNTC+Rpass)) for (temperature,RNTC) in NTC]\nADCNTC = [(temperature, floor(V\/VADC*ADCmax+0.5)) for (temperature,V) in VNTC]\nADCpass = [(temperature, floor(V\/VADC*ADCmax+0.5)) for (temperature,V) in Vpass]\n#=========================================\nG1 = list_plot(NTC,xmin=Tlow,xmax=Thigh,ymin=0,ymax=2*R0)\nG1 += text(\"NTC resistance [k\u03a9]\",(Tlow-0.1*(Thigh-Tlow),R0), rotation=\"vertical\")\nG1 += text(\"temperatur [$^o$C]\",((Tlow+Thigh)\/2,-0.15*R0), rotation=\"horizontal\")\n#=========================================\nG2 = list_plot(VNTC,xmin=Tlow,xmax=Thigh,ymin=0,ymax=V0,color=\"blue\",legend_label=\"NTC\")\nG2 += list_plot(Vpass,xmin=Tlow,xmax=Thigh,ymin=0,ymax=V0,color=\"red\",legend_label=\"pass resistor\")\nG2 += text(\"voltage [V]\",(Tlow-0.1*(Thigh-Tlow),V0\/2), rotation=\"vertical\")\nG2 += text(\"temperatur [$^o$C]\",((Tlow+Thigh)\/2,-0.075*V0), rotation=\"horizontal\")\n#=========================================\nG4 = list_plot(ADCNTC,xmin=Tlow,xmax=Thigh,ymin=0,ymax=ADCmax,color=\"blue\",legend_label=\"NTC\")\nG4 += list_plot(ADCpass,xmin=Tlow,xmax=Thigh,ymin=0,ymax=ADCmax,color=\"red\",legend_label=\"pass resistor\")\nG4 += text(\"ADC value\",(Tlow-0.1*(Thigh-Tlow),ADCmax\/2), rotation=\"vertical\")\nG4 += text(\"temperatur [$^o$C]\",((Tlow+Thigh)\/2,-0.075*ADCmax), rotation=\"horizontal\")\nga=graphics_array((G1, G2, G4),ncols=1)\nga.show(figsize=[5,25]) \nprint(\"        T     NTC     V(NTC)   V(pass)  ADC NTC   ADC pass\")\nprint(\"   nr  \u00b0C     kohm       V       V        cts       cts\")\nfor index,temp in enumerate(T):\n    ntc = float(NTC[index][1])\n    vntc = float(VNTC[index][1])\n    vpass = float(Vpass[index][1])\n    adcntc = int(ADCNTC[index][1])\n    adcpass = int(ADCpass[index][1])\n    print(\"{:5d} {:5.1f}  {:6.2f}   {:6.3f}  {:6.3f}    {:5d}     {:5d}\".format(index+1,temp,ntc,vntc,vpass,adcntc,adcpass))\n<\/script>\n<\/div>\n<p><!--more--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following a discussion on Facebook I put here an online tool to calculate the output of a voltage divider consisting of a fixed resistor and an NTC thermistor following a first order Steinhart\u2013Hart equation. The calculations are based on a voltage divider where either the voltage over the NTC or over the pass resistor is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2191,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[46,11,8,27],"tags":[],"class_list":["post-2177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-avr","category-electronics_en","category-everything_en","category-science_en","entry","has-media"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.sciencetronics.com\/greenphotons\/wp-content\/uploads\/2020\/03\/20200323_ntc.png","jetpack_shortlink":"https:\/\/wp.me\/p48grL-z7","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2177"}],"version-history":[{"count":19,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2177\/revisions"}],"predecessor-version":[{"id":2315,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/posts\/2177\/revisions\/2315"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=\/wp\/v2\/media\/2191"}],"wp:attachment":[{"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sciencetronics.com\/greenphotons\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}