<?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[Wrong ADC readings when using Serial Communication at PortA]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I'm using M5Core2 to make a datalogger. For that, I'm communicating with a telemetry box by Serial using a PmodRS232, with needs alimentation. So I use PortA for Serial and feeding of PmodRS232 and the communications run smoothly.</p>
<p dir="auto">The problem is that I'm also using PIN 36 as an ADC and if I plug the PmodRS232 at PortA the readings of the ADC increase by ~60%. If I unplug the cable of PIN 36 I get 4095 if PmodRS232 is plugged in (which is wrong), and 0, if PmodRS232 isn't plugged in (which is correct).</p>
<p dir="auto">I already know PortA as pull-up resistors, but I don't understand why that affects PIN 36 (or 35, I already tried it) readings.</p>
<p dir="auto">Thanks a lot for your help, I'm looking forward to solving this problem.</p>
]]></description><link>https://community.m5stack.com/topic/4553/wrong-adc-readings-when-using-serial-communication-at-porta</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 07:13:29 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4553.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Aug 2022 08:55:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wrong ADC readings when using Serial Communication at PortA on Thu, 25 Aug 2022 08:46:07 GMT]]></title><description><![CDATA[<p dir="auto">It worked! Fixed problem eheh!</p>
]]></description><link>https://community.m5stack.com/post/18453</link><guid isPermaLink="true">https://community.m5stack.com/post/18453</guid><dc:creator><![CDATA[bexybot]]></dc:creator><pubDate>Thu, 25 Aug 2022 08:46:07 GMT</pubDate></item><item><title><![CDATA[Reply to Wrong ADC readings when using Serial Communication at PortA on Tue, 23 Aug 2022 21:29:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> thanks for your reply again Felix,</p>
<p dir="auto">You might just be right. Tomorrow I'll try it. Thanks a lot!</p>
]]></description><link>https://community.m5stack.com/post/18442</link><guid isPermaLink="true">https://community.m5stack.com/post/18442</guid><dc:creator><![CDATA[bexybot]]></dc:creator><pubDate>Tue, 23 Aug 2022 21:29:10 GMT</pubDate></item><item><title><![CDATA[Reply to Wrong ADC readings when using Serial Communication at PortA on Tue, 23 Aug 2022 16:03:15 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/bexybot" aria-label="Profile: bexybot">@<bdi>bexybot</bdi></a></p>
<p dir="auto">It seems that the PmodRS232 can be powered with 3.3 V or 5 V. And I assume whatever voltage is used to power it, it also uses on the TX and RX pins. Now, port A, while the GPIOs are 3.3 V, delivers 5 V on the VCC line. My assumption is that a connected PmodRS232 raises the TX and RX lines to 5 V and through the pull-up resistors or internally in the ESP32 its 3.3 V VCC line is raised as well messing with the ADC. Maybe check the TX and / or RX lines with a multi-meter to see if they are 3.3 V or 5 V. If I am correct you need to change your setup to power the PmodRS232 with 3.3 V instead.</p>
<p dir="auto">ADC: if you care about values between min an max, I'd modify the calculation to first do the multiplication and the the division.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/18437</link><guid isPermaLink="true">https://community.m5stack.com/post/18437</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 23 Aug 2022 16:03:15 GMT</pubDate></item><item><title><![CDATA[Reply to Wrong ADC readings when using Serial Communication at PortA on Tue, 23 Aug 2022 11:25:24 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your response <a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a>,</p>
<p dir="auto">It's very strange, that's why I'm asking on this forum. I could not find anything online. I'll take a picture of the setup, and send the relevant code.</p>
<p dir="auto">It works well without the PmodRS232.</p>
<p dir="auto"><img src="/assets/uploads/files/1661253404439-whatsapp-image-2022-08-23-at-12.14.46-resized.jpeg" alt="0_1661253355675_WhatsApp Image 2022-08-23 at 12.14.46.jpeg" class=" img-fluid img-markdown" /></p>
<h2>Code:</h2>
<p dir="auto">void setup(){<br />
M5.begin();<br />
M5.Rtc.begin();</p>
<p dir="auto">// Serial Config<br />
Serial2.begin(115200 , SERIAL_8N1, 32 , 33 );<br />
Serial2.setTimeout(300);</p>
<p dir="auto">// ADC Config<br />
analogReadResolution(12);<br />
analogSetAttenuation(ADC_11db);<br />
pinMode(36, INPUT); // I already tried with and without this, same results<br />
}</p>
<p dir="auto">void loop{<br />
M5.Lcd.drawString(("Read voltage: " + String(analogRead(36)/4095*3.9), 0, 0, 4);<br />
}</p>
]]></description><link>https://community.m5stack.com/post/18434</link><guid isPermaLink="true">https://community.m5stack.com/post/18434</guid><dc:creator><![CDATA[bexybot]]></dc:creator><pubDate>Tue, 23 Aug 2022 11:25:24 GMT</pubDate></item><item><title><![CDATA[Reply to Wrong ADC readings when using Serial Communication at PortA on Tue, 23 Aug 2022 10:23:18 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/bexybot" aria-label="Profile: bexybot">@<bdi>bexybot</bdi></a></p>
<p dir="auto">I don't see the ADC reading on GPIO36 being influenced by serial traffic on port A.</p>
<p dir="auto">My setup periodically (1 s) sends a string through port A (and I generate traffic from the terminal in the other direction) while I read the ADC value from GPIO36. The value is pretty stable. And I don't see a difference whether port A is connected or not.</p>
<p dir="auto">The fact that you get the maximum value (4095) with GPIO36 floating and PmodRS232 connected, but the minimum value (0) when PmodRS232 is not connected is very strange. If I have GPIO36 floating I get a reading of about 400 independent of port A connection.</p>
<p dir="auto">Can you share the circuit you use for the ADC input? And also how you setup and read GPIO36?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/18431</link><guid isPermaLink="true">https://community.m5stack.com/post/18431</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 23 Aug 2022 10:23:18 GMT</pubDate></item></channel></rss>