<?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[How to know what sensors are plugged into which ports and pins?]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/6030/how-to-use-multiple-units-wired-via-grove-pbhub">How to use multiple Units wired via GROVE? PbHub?</a></p>
<p dir="auto">Following up on my earlier post. I  have a single binary code base (same <strong>.ino</strong>) that needs to be configured at runtime based on which sensors are plugged into which ports and bus kind (UART,  GPIO or I2C).</p>
<h3>Question: How do others manage this <code>plug-n-play</code> vision?</h3>
<p dir="auto">For example, I currently send a MQTT or BLE message to my devices with configuration values when it cannot be determined at runtime.</p>
<h2>Example M5 Atom</h2>
<p dir="auto">The M5 Atom has the PB port out the back. This has KEY pin 32 and DATA pin 26. I can plug in a push button sensor.</p>
<p dir="auto">But if I plug in the same push button sensor into port PB of the<br />
<code>ATOMIC PortABC Extension Base</code> - it uses keys: 23 and 33.</p>
<p dir="auto">As mentioned in the <a href="https://shop.m5stack.com/products/atomic-portabc-extension-base" target="_blank" rel="noopener noreferrer nofollow ugc">PortABC reviews</a>:</p>
<blockquote>
<p dir="auto">So useful in an M5 ecosystem where some sensors still use UART or GPIO for integration. With that extension base, your Atom ends up with so many integration ports (2 x I2C, 1 UART, 1 GPIO) using YH2.0-4P connectors in a very compact form.</p>
</blockquote>
<h2>Sensor Mapping</h2>
<p dir="auto">I envision a JSON file that defines this kind of mapping (sensor to pins and ports).</p>
]]></description><link>https://community.m5stack.com/topic/6712/how-to-know-what-sensors-are-plugged-into-which-ports-and-pins</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 11:36:35 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6712.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Aug 2024 23:58:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to know what sensors are plugged into which ports and pins? on Wed, 21 Aug 2024 23:56:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a> Thanks for reply. My question is what happens in the example stated when the M5Atom is using the ATOMIC PortABC Extension. In this case, there are 2 I2C ports.</p>
<p dir="auto">So if my button is plugged into the M5Atom, it uses one set of pins, but if plugged into the Extension, it's a different pin set (and plugged into the red one as you state.)</p>
<p dir="auto">I just did some testing and with an EPROM setting I can state which of the 2 plugs (and associated pins) to use.  Next time it's powered on - the buttons work in the new plugin.</p>
<p dir="auto">Unfortunately the changes won't work unless POWER is cycled (rebooting isn't enough). Actually after changing the pins, rebooting will start looking at the different pin, and it won't work (without the POWER cycle.)</p>
<p dir="auto">So again, I was wondering what developers do with this <code>plug-n-play</code> vision without hardcoding all the devices and knowing where they are plugged in. I have the <code>PBHub</code> but haven't played with it yet (but I think it has a naming issue as well, eg. plug1 in slot1, etc).</p>
<p dir="auto">This dynamic configuration is where a JSON (or equivalent) configuration could be specified and stored in EPROM.</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.m5stack.com/post/26187</link><guid isPermaLink="true">https://community.m5stack.com/post/26187</guid><dc:creator><![CDATA[konacurrents]]></dc:creator><pubDate>Wed, 21 Aug 2024 23:56:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to know what sensors are plugged into which ports and pins? on Wed, 21 Aug 2024 05:09:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/konacurrents" aria-label="Profile: konacurrents">@<bdi>konacurrents</bdi></a> Ports are colour coded.<br />
UART devices have blue connectors,<br />
I2C have Red connectors,<br />
Analog have black connectors,<br />
Generic device have white connectors.</p>
<p dir="auto">There isn't a JSON file, that not how it works.</p>
<p dir="auto">M5Stack devices use ESP32's so I suggest looking into the ESP32's GPIO matrix system,<br />
The ports are often predefined in the code to simplify connection.<br />
Also check out the documentation on the M5Stack web sites product page.</p>
]]></description><link>https://community.m5stack.com/post/26171</link><guid isPermaLink="true">https://community.m5stack.com/post/26171</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 21 Aug 2024 05:09:02 GMT</pubDate></item></channel></rss>