<?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[Issue with Analog Voltage Measurement on Core2]]></title><description><![CDATA[<p dir="auto">Under UIflow, I execute the following code on a Core2 device, signal from Port A, pin 32,<br />
using a Micro-Python execution block:</p>
<p dir="auto">from machine import ADC<br />
adc=ADC(32)<br />
signal = int(adc.read())</p>
<p dir="auto">label1 show signal</p>
<p dir="auto">The value obtained is always 4095, even if no voltage is present at the input pin 32.</p>
<p dir="auto">Please give me some explanations how to connect and measure an analog signal (V) using the<br />
M5stack core2 device.</p>
<p dir="auto">Regards, Claude</p>
]]></description><link>https://community.m5stack.com/topic/4215/issue-with-analog-voltage-measurement-on-core2</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 00:21:10 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4215.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Apr 2022 17:19:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Issue with Analog Voltage Measurement on Core2 on Tue, 19 Apr 2022 13:45:11 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>  Now got some useful readings of Volts using the following code. Not sure about accuracy due to logarithmic scale. I've tested it with an AA 1,5 battery as input signal, connecting GND and ADC pin 32. As I already use a GPS and an expansion board, so at the moment SDA pin 32 at Core2 unit is the only available choice. My code:</p>
<p dir="auto">execute:<br />
from machine import ADC<br />
adc=ADC(32)<br />
adc.atten(ADC.ATTN_11DB)<br />
while true (with blockly), execute:<br />
signal = int(adc.read())<br />
if signal == 4095:<br />
signal = 0<br />
percentage = float(signal / 4095 / 100)<br />
volts = float(3.9 * percentage * 100)<br />
label2 show volts (with blockly)</p>
<p dir="auto">Now getting 0 at idle connection and +- 1.5 V when testing it with an AA battery as analog signal.</p>
]]></description><link>https://community.m5stack.com/post/17214</link><guid isPermaLink="true">https://community.m5stack.com/post/17214</guid><dc:creator><![CDATA[falbriard]]></dc:creator><pubDate>Tue, 19 Apr 2022 13:45:11 GMT</pubDate></item><item><title><![CDATA[Reply to Issue with Analog Voltage Measurement on Core2 on Mon, 18 Apr 2022 18:37:55 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/falbriard" aria-label="Profile: falbriard">@<bdi>falbriard</bdi></a></p>
<p dir="auto">the reason is that Port A by default is used for I2C and I2C requires pull-up resistors on both lines which are inside M5Core2. Also see <a href="https://docs.m5stack.com/en/core/core2" target="_blank" rel="noopener noreferrer nofollow ugc">M5Core2</a> schematic. That is why you always get the value 4095.</p>
<p dir="auto">A better choice would be Port B / GPIO36. Port B is available on the <a href="https://docs.m5stack.com/en/base/m5go_bottom2" target="_blank" rel="noopener noreferrer nofollow ugc">M5GO Battery Bottom2</a>. GPIO36 (and others) via <a href="https://docs.m5stack.com/en/module/bus" target="_blank" rel="noopener noreferrer nofollow ugc">Bus Module</a>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/17211</link><guid isPermaLink="true">https://community.m5stack.com/post/17211</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 18 Apr 2022 18:37:55 GMT</pubDate></item></channel></rss>