<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7188/simple-thermistor-adc-reading</link><description>First off, forgive me for being a newbie at ARM programming in general. In AVR this was straight forward. 
 
 I have a circuit connected like this to the ADC (P0.01 = AnalogInput2) . 
 I read sensible values from the thermistor if I have this ADC setup</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 May 2015 12:38:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7188/simple-thermistor-adc-reading" /><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25410?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 12:38:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2de3f980-5643-4b2e-aa08-0711c3e8aa5c</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks! The sample rate will be low, so not an issue. Thanks for clearing all of this up! I will check out the reference, blog and the thread. :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25409?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 12:35:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9167165-914b-4b8b-93e5-ed949369ca52</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I guess as long as the ratio between the thermistor and resistor stays the same you will be fine. I.e. that the maximum resistance in the thermistor is equal to the resistor value. Also, if you are going to have a high sample rate then you should pay some attention to the resitances and also add in a capacitor like discussed in &lt;a href="https://devzone.nordicsemi.com/question/990/how-to-measure-lithium-battery-voltage/"&gt;this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25408?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 12:25:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0724989-8e42-4407-be79-99dd42557c92</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Yeah, I was just curious about what kind of resistance that is too much.&lt;/p&gt;
&lt;p&gt;Thanks again for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25407?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 12:21:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8aaff623-402e-4507-a74c-e20dd187fccd</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Yes, it would simply because the current running through a high resistance is less than the current running through a low resistance. Ohms law basically. The guy in the blog i linked to, e.g., suggests mega-ohm resistors.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25406?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 12:13:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81754be4-a2de-4679-aeb6-9ffe8ca4521d</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks again! That was my original setup actually. Plus ADC_CONFIG_INPSEL_AnalogInputNoPrescaling then. Then I must redo the calculations to be inverse that less = more :)&lt;/p&gt;
&lt;p&gt;A dumb question: Would increasing the resistance on both make any difference to power consumption?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25405?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 12:09:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3311225d-c92b-4fa6-b087-bcd92d8a393f</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Flipping the resistors sounds like a very good idea. I think doing that and using ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling is the way to go.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25404?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 09:50:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de838b44-fd2e-4000-80f2-4a6ec5cd3242</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thank you so much for this fulfilling answer!
The thermistor is NJ28 NTC Thermistor,2.8mm,10K,3% and is &amp;quot;on top&amp;quot;. The supply is the VDD pin, which is measured to about 3V, where the power supply comes from USB.&lt;/p&gt;
&lt;p&gt;My voltage on the ADC will then range from 1.5V-3V.
If I put the thermistor as the 2nd resistor below the ADC connection (flip the resistors), it would range from 1.5V-0V which means the voltage will decrease with increased temperature.&lt;/p&gt;
&lt;p&gt;Wouldn&amp;#39;t the ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling be relevant then?&lt;/p&gt;
&lt;p&gt;In short I wonder about the optimal way to do this, with minimal drain. :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple thermistor ADC reading</title><link>https://devzone.nordicsemi.com/thread/25403?ContentTypeID=1</link><pubDate>Fri, 22 May 2015 08:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99918dbb-7e7d-4fe3-85b9-e769f2317ab5</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi, no need to apologize. We have all been newbies at some point in time.&lt;/p&gt;
&lt;p&gt;First of all; what supply voltage (Vdd) are you running your nRF51 on? (5 volts is way out of maximum ratings for the nRF51, which is 3.6 volts as you can see in the &lt;a href="https://www.nordicsemi.com/eng/nordic/download_resource/20339/13/24289504"&gt;Product Specification&lt;/a&gt; in Chapter 7, Table 20). And what sort of thermistor is this? I assume it is a NTC (resistance decreases when temperature rises).&lt;/p&gt;
&lt;p&gt;As you may know:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling&lt;/code&gt; will divide Vdd by two and use that as a &lt;em&gt;reference voltage&lt;/em&gt; for your measurements. So if you use, let us say, 3.3 volts as Vdd you will have a 1.65 volts as a reference voltage.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ADC_CONFIG_INPSEL_AnalogInputNoPrescaling&lt;/code&gt; will not do any scaling of your input voltage (as opposed to e.g. ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling which will divide your input by three).&lt;/p&gt;
&lt;p&gt;So! When you use the code you show us you will use a reference voltage of Vdd/3. Your input, Ain, will also be scaled down to Ain/3. Hence, when you use a voltage divider in a configuration like yours the input will always lie between 0V and your reference voltage. (Given that the voltage supplied at the &amp;quot;top&amp;quot; of your voltage divider is the same as Vdd)&lt;/p&gt;
&lt;p&gt;When you use the code that won&amp;#39;t work it is because you scale down your reference voltage to Vdd/2, but leave Ain &amp;quot;unscaled&amp;quot;. As an example. Let us say you have a Vdd at 3.3V. When you use &lt;code&gt;ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling&lt;/code&gt; your reference voltage becomes 1.65V. Since you don&amp;#39;t scale the input voltage the same way and use the resistor values you do Ain will have a minimum value of 1.65V. The same as the reference voltage. Then, when temperature rises the voltage on Ain will &lt;em&gt;increase&lt;/em&gt; and rise &lt;em&gt;above&lt;/em&gt; your reference voltage. When you do your ADC measurements this will result in a value that is always at the maximum of 1023 (if you use 10-bit resolution).&lt;/p&gt;
&lt;p&gt;So what you have to remember is that you always scale your input voltage down to a level that will always stay between 0V and your reference voltage.&lt;/p&gt;
&lt;p&gt;Make sure you read Chapter 31, &amp;quot;Analog to Digital Converter (ADC)&amp;quot;, in the &lt;a href="https://www.nordicsemi.com/eng/nordic/download_resource/20337/12/61911706"&gt;Reference Manual&lt;/a&gt; carefully to understand the ADC with reference   and input voltage scaling.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/blogs/30/measuring-lithium-battery-voltage-with-voltage-div/"&gt;This blog&lt;/a&gt; also has some info on ADC and prescaling.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>