<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[M5StickC and Grove-Temperature_Sensor_V1.2]]></title><description><![CDATA[<p dir="auto">I bought the Grove-Temperature_Sensor_V1.2 and connected to M5StickC. I copied almost all the code from the Seedstudio page (<a href="https://wiki.seeedstudio.com/Grove-Temperature_Sensor_V1.2/#software" target="_blank" rel="noopener noreferrer nofollow ugc">https://wiki.seeedstudio.com/Grove-Temperature_Sensor_V1.2/#software</a>) to convert the analog read to actual temperature, only adding the #include &lt;M5StickC.h&gt; and the M5.begin, but the temperature is way off and very oscillating. I am using pin 32 to read the data, Is it correct? Is it a sensor issue?</p>
<p dir="auto">For example, a sample output is:</p>
<p dir="auto">-0.34<br />
-2.32<br />
-4.34<br />
-2.16<br />
-3.89<br />
-4.04<br />
-3.42<br />
-5.16<br />
-4.42<br />
-4.79<br />
-5.24<br />
-5.09<br />
-5.38<br />
-6.61<br />
-6.40<br />
-5.82<br />
-6.96<br />
-6.82<br />
-6.96<br />
-6.89<br />
-6.96<br />
-7.17<br />
-6.96<br />
-8.08<br />
-6.96<br />
-6.96<br />
-7.94</p>
<p dir="auto">And the code is:</p>
<p dir="auto">#include &lt;M5StickC.h&gt;<br />
#include &lt;math.h&gt;</p>
<p dir="auto">const int B = 4275;<br />
const float R0 = 100000;<br />
const int PIN = 32;</p>
<p dir="auto">void setup() {<br />
M5.begin();</p>
<p dir="auto">Serial.begin(115200);</p>
<p dir="auto">}</p>
<p dir="auto">void loop() {</p>
<p dir="auto">int a = analogRead(PIN);</p>
<p dir="auto">float R = 1023.0/a-1.0;<br />
R = R0*R;</p>
<p dir="auto">float temperature = 1.0 / (log(R / 10000.0) / B + 1 / 298.15) - 273.15;</p>
<p dir="auto">Serial.println(temperature);</p>
<p dir="auto">delay(500);<br />
}</p>
<p dir="auto">Thanks,<br />
Fernando Gonzalez Sidders</p>
]]></description><link>https://community.m5stack.com/topic/2087/m5stickc-and-grove-temperature_sensor_v1-2</link><generator>RSS for Node</generator><lastBuildDate>Sun, 10 May 2026 03:39:26 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2087.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Jun 2020 21:56:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5StickC and Grove-Temperature_Sensor_V1.2 on Fri, 28 Aug 2020 18:24:37 GMT]]></title><description><![CDATA[<p dir="auto">I solved the issue, I am getting the correct temperature now.</p>
<p dir="auto">I changed the code to:</p>
<p dir="auto">#include &lt;M5StickC.h&gt;<br />
#include &lt;math.h&gt;</p>
<p dir="auto">const int B = 4275;<br />
const float R0 = 100000;<br />
const int PIN = 33;</p>
<p dir="auto">void setup() {<br />
M5.begin();</p>
<p dir="auto">Serial.begin(115200);</p>
<p dir="auto">}</p>
<p dir="auto">void loop() {</p>
<p dir="auto">int a = analogRead(PIN);</p>
<p dir="auto">float R = 4095.0/a-1.0;<br />
R = R0*R;</p>
<p dir="auto">float temperature = 1.0 / (log(R / R0) / B + 1 / 298.15) - 273.15;</p>
<p dir="auto">Serial.println(temperature);</p>
<p dir="auto">delay(500);<br />
}</p>
<p dir="auto">The correct pin was 33, and modified the 1023.0 to 4095.0 in the formula because esp32 is returning values between 0 and 4096. But anyway, the temperature readings were too high. Then, I modified the grove cable (as is explained here <a href="https://tinkerfarm.net/projects/the-m5stickc/the-5-volt-danger-with-the-m5stickc/" target="_blank" rel="noopener noreferrer nofollow ugc">https://tinkerfarm.net/projects/the-m5stickc/the-5-volt-danger-with-the-m5stickc/</a>) feeding the temperature sensor with 3.3v instead of 5v. And, now, (with no additional code changes) the temperature is correct.</p>
]]></description><link>https://community.m5stack.com/post/9868</link><guid isPermaLink="true">https://community.m5stack.com/post/9868</guid><dc:creator><![CDATA[fsidders]]></dc:creator><pubDate>Fri, 28 Aug 2020 18:24:37 GMT</pubDate></item><item><title><![CDATA[Reply to M5StickC and Grove-Temperature_Sensor_V1.2 on Wed, 01 Jul 2020 09:14:26 GMT]]></title><description><![CDATA[<p dir="auto">i have check the prodcut document.then i find this information, i guess this sensor need calibration:<br />
Nominal B-Constant： 4250 ~ 4299K</p>
<p dir="auto">if still can't work normal.  maybe you could try to contact seeed store</p>
<p dir="auto"><a href="https://wiki.seeedstudio.com/Grove-Temperature_Sensor_V1.2/#specifications" target="_blank" rel="noopener noreferrer nofollow ugc">https://wiki.seeedstudio.com/Grove-Temperature_Sensor_V1.2/#specifications</a></p>
]]></description><link>https://community.m5stack.com/post/9214</link><guid isPermaLink="true">https://community.m5stack.com/post/9214</guid><dc:creator><![CDATA[m5stack]]></dc:creator><pubDate>Wed, 01 Jul 2020 09:14:26 GMT</pubDate></item><item><title><![CDATA[Reply to M5StickC and Grove-Temperature_Sensor_V1.2 on Wed, 01 Jul 2020 02:11:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fsidders" aria-label="Profile: fsidders">@<bdi>fsidders</bdi></a> I fixed the code, changed 10000 to 100000 in temperature formula, but the temperature is still off and oscillating:</p>
<p dir="auto">#include &lt;M5StickC.h&gt;<br />
#include &lt;math.h&gt;</p>
<p dir="auto">const int B = 4275;               // B value of the thermistor<br />
const float R0 = 100000;<br />
const int PIN = 32;</p>
<p dir="auto">void setup() {<br />
M5.begin();<br />
Serial.begin(9600);</p>
<p dir="auto">}</p>
<p dir="auto">void loop() {</p>
<p dir="auto">int a = analogRead(PIN);</p>
<p dir="auto">float R = 1023.0/a-1.0;<br />
R = R0*R;</p>
<p dir="auto">float temperature = 1.0/(log(R/R0)/B+1/298.15)-273.15; // convert to temperature via datasheet</p>
<p dir="auto">Serial.println(temperature);<br />
delay(500);<br />
}</p>
<p dir="auto">The temperature displayed now is:</p>
<p dir="auto">42.42<br />
44.15<br />
42.42<br />
42.85<br />
42.96<br />
45.96<br />
46.07<br />
44.38<br />
44.15<br />
42.74<br />
43.50<br />
42.42<br />
44.15<br />
44.49<br />
42.42<br />
45.16<br />
49.58<br />
42.85</p>
]]></description><link>https://community.m5stack.com/post/9208</link><guid isPermaLink="true">https://community.m5stack.com/post/9208</guid><dc:creator><![CDATA[fsidders]]></dc:creator><pubDate>Wed, 01 Jul 2020 02:11:03 GMT</pubDate></item></channel></rss>