<?xml-stylesheet type="text/xsl" href="https://community.element14.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/"><channel><title>Limited ADC on ESP8266, and possible options.</title><link>/challenges-projects/design-challenges/experimenting-with-thermistors/b/challenge-blog/posts/limited-adc-on-esp8266-and-possible-options</link><description>TL;DR
My favourite IoT board, the Wemos D1 Mini, only has ONE analog input - this limits me to using just one thermistor at a time. Read further as I look at my options.

Why Wemos?
The Wemos D1 Mini has WiFi built in, it&amp;rsquo;s easy to progra...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Limited ADC on ESP8266, and possible options.</title><link>https://community.element14.com/challenges-projects/design-challenges/experimenting-with-thermistors/b/challenge-blog/posts/limited-adc-on-esp8266-and-possible-options</link><pubDate>Thu, 18 Aug 2022 20:17:02 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80380d5e-c0a6-453f-81a2-d73e3fb745b0</guid><dc:creator>DAB</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Nice update Nico.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24242&amp;AppID=377&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Limited ADC on ESP8266, and possible options.</title><link>https://community.element14.com/challenges-projects/design-challenges/experimenting-with-thermistors/b/challenge-blog/posts/limited-adc-on-esp8266-and-possible-options</link><pubDate>Wed, 17 Aug 2022 13:47:26 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80380d5e-c0a6-453f-81a2-d73e3fb745b0</guid><dc:creator>scottiebabe</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Aww, thanks for the shoutout! :) I am glad you are having fun in the challenge too! Using the word &lt;strong&gt;invents&lt;/strong&gt; is going to send ALL the sharks circling my blog LOL&lt;/p&gt;
&lt;p&gt;I love the project, keep up the great work!&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24242&amp;AppID=377&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Limited ADC on ESP8266, and possible options.</title><link>https://community.element14.com/challenges-projects/design-challenges/experimenting-with-thermistors/b/challenge-blog/posts/limited-adc-on-esp8266-and-possible-options</link><pubDate>Wed, 17 Aug 2022 13:15:32 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80380d5e-c0a6-453f-81a2-d73e3fb745b0</guid><dc:creator>michaelkellett</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;If you can set the outputs of the micro to high impedance input you could connect one to each thermistor and the other ends of both thermistors to a single resistor to ground.&lt;/p&gt;
&lt;p&gt;Measure the voltage across the fixed resistor as Shabaz describes below. with each thermistor held high in turn by one micro outoput and the other set to high impedance.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/1280x720/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-80380d5e-c0a6-453f-81a2-d73e3fb745b0/pastedimage1660742075227v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Not the most accurate scheme but needs no extra parts.&lt;/p&gt;
&lt;p&gt;A capacitor across R1 will probably reduce noise.&lt;/p&gt;
&lt;p&gt;MK&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24242&amp;AppID=377&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Limited ADC on ESP8266, and possible options.</title><link>https://community.element14.com/challenges-projects/design-challenges/experimenting-with-thermistors/b/challenge-blog/posts/limited-adc-on-esp8266-and-possible-options</link><pubDate>Wed, 17 Aug 2022 12:36:54 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80380d5e-c0a6-453f-81a2-d73e3fb745b0</guid><dc:creator>shabaz</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Nico,&lt;/p&gt;
&lt;p&gt;An 8-bit ADC will provide better than 1 degree C resolution, if your desired temperature range is small enough.&lt;/p&gt;
&lt;p&gt;The curve from the thermistor is non-linear as you observed, so it would need an extremely high-resolution ADC (like 24-bit) if such a curve was to be measured. However, by using a potential divider, it straightens it out enough to reduce the ADC resolution a massive amount.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s a worked example:&lt;/p&gt;
&lt;p&gt;If (say) you want to use a 10 k thermistor for the range of -20 to +40 degrees C, then you&amp;#39;d look up (or write code to do it, using the coefficients) the resistances of the thermistor for that temperature range. It would look like this:&lt;/p&gt;
&lt;pre&gt;TEMP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtherm&lt;br /&gt;------&amp;nbsp; &amp;nbsp; &amp;nbsp;  ------&lt;br /&gt;-20 deg C:   97k ohm&lt;br /&gt;-10 deg C:&amp;nbsp;  55 kohm&lt;br /&gt;0 deg C:     32 kohm&lt;br /&gt;10 deg C:    19 kohm&lt;br /&gt;20 deg C:    12 kohm&lt;/pre&gt;
&lt;p&gt;and so on. You&amp;#39;d do it for your desired resolution, say 1 degree C, instead of 10 deg C as I have done.&lt;/p&gt;
&lt;p&gt;Next, you&amp;#39;d randomly pick a resistor value for the potential divider. Say 33 kohm to start with. It should not be too low because then current will cause the thermistor to self-heat, and it should not be too high because then the voltage from the potential divider won&amp;#39;t vary much, requiring a higher ADC resolution. You can check the impact of the resistor by looking up the &amp;#39;dissipation constant&amp;#39; and working out how much power is being used by the thermistor, but for now lets assume that has been done and 33k was considered acceptable.&lt;/p&gt;
&lt;p&gt;So, with a 33 kohm resistor in series with the thermistor, this is the circuit, where Vmid is the output that would connect to the ADC:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="330" src="/resized-image/__size/640x660/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-80380d5e-c0a6-453f-81a2-d73e3fb745b0/thermistor_2D00_schematic.png" width="320" /&gt;&lt;/p&gt;
&lt;p&gt;The voltage Vmid will be (3.3/(33k+Rtherm))*Rtherm, so now the table can look like this:&lt;/p&gt;
&lt;pre&gt;TEMP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtherm      Vmid&lt;br /&gt;------&amp;nbsp; &amp;nbsp; &amp;nbsp;  ------      ----&lt;br /&gt;-20 deg C:   97k ohm     2.46V&lt;br /&gt;-10 deg C:&amp;nbsp;  55 kohm     2.06V&lt;br /&gt;0 deg C:     32 kohm     1.62V&lt;br /&gt;10 deg C:    19 kohm     1.21V&lt;br /&gt;20 deg C:    12 kohm     0.88V&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The ADC value will be (256 / 3.3V) * Vmid&amp;nbsp; if the ADC resolution is 8-bit (2^8 = 256 values). The table is now:&lt;/p&gt;
&lt;pre&gt;TEMP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtherm      Vmid      ADC data&lt;br /&gt;------&amp;nbsp; &amp;nbsp; &amp;nbsp;  ------      ----      --------&lt;br /&gt;-20 deg C:   97k ohm     2.46V     191&lt;br /&gt;-10 deg C:&amp;nbsp;  55 kohm     2.06V     160&lt;br /&gt;0 deg C:     32 kohm     1.62V     126&lt;br /&gt;10 deg C:    19 kohm     1.21V     94&lt;br /&gt;20 deg C:    12 kohm     0.88V     68&lt;/pre&gt;
&lt;p&gt;Provided the ADC data is changing by 1 or more, then (at a first approximation) the resolution of the ADC is fine to meet your needs. In the table above, the steps are 10 degrees, and the ADC value is changing by more than 1. It&amp;#39;s a similar thing for a table with 1 degree C resolution. With Matlab for instance (it could be done using free Octave, or using Python), this is the&amp;nbsp;table values of temperature and ADC data, in a chart form, and it is possible to see just visually (or it could be done mathematically, if it gets hard to determine on the chart) that for every 1 degree C increment on the x-axis, the ADC value on the vertical axis is changing by more than 1.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="288" src="/resized-image/__size/1646x576/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-80380d5e-c0a6-453f-81a2-d73e3fb745b0/10k_2D00_example.png" width="823" /&gt;&lt;/p&gt;
&lt;p&gt;The 33k resistor in the potential divider might not be optimal, because the line on the chart flattens a bit horizontally at the higher temperatures, so a different value could be attempted (easier to do if code is written to test out different resistor values), however from the chart, 33k would meet needs.&lt;/p&gt;
&lt;p&gt;To continue the example, let&amp;#39;s say the circuit above was connected to the ADC, and you were getting readings. They could be converted back to temperature using this formula (where adcval is the result from the ADC):&lt;/p&gt;
&lt;p&gt;vmid = (3.3V/256)*adcval&lt;/p&gt;
&lt;p&gt;rtherm =&amp;nbsp;(33k / (1-(vmid/3.3V))) - 33k&lt;/p&gt;
&lt;p&gt;Now that rtherm has been calculated from the ADC value, a lookup can be done to get back to temperature (or use a formula, using beta value or Steinhart-Hart, but I think a lookup table would be easiest if say only 1 deg C resolution was needed, then the table would be small).&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24242&amp;AppID=377&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Limited ADC on ESP8266, and possible options.</title><link>https://community.element14.com/challenges-projects/design-challenges/experimenting-with-thermistors/b/challenge-blog/posts/limited-adc-on-esp8266-and-possible-options</link><pubDate>Wed, 17 Aug 2022 11:38:48 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80380d5e-c0a6-453f-81a2-d73e3fb745b0</guid><dc:creator>hitesh.boghani</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Arduino Nano looks like a good choice. I am also considering Nano 33 IoT that I have. However, in their documentation somewhere I read that A4 and A5 usage as ADC in is not recommended. Also, it says &amp;#39;as opposed to other Nano boards&amp;#39; so you may be fine - just double check. Pi Pico W seems to have limited ADC compared to Nano so Nano seems winner from that view point, too! Good luck! [emoticon:c4563cd7d5574777a71c318021cbbcc8]&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=24242&amp;AppID=377&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>