<?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[Connecting multi TOF4m units via PA.hub - weird behaviour]]></title><description><![CDATA[<p dir="auto">Greetings I am trying to connect 2 TOF4m sensors to M5Stack Core Basic via Pa.hub.<br />
Below basic blockly schematics. As soon as I connect second sensor to PAhub- labels react in a weird way. For example: If I put something near one of sensors - both labels change and show some random distance. As soon as I connect only one sensor to pahub -  everything works fine and distance information works.<br />
<img src="/assets/uploads/files/1731174648804-466090905_8929499030434630_7755274929070497307_n.jpg" alt="466090905_8929499030434630_7755274929070497307_n.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/6970/connecting-multi-tof4m-units-via-pa-hub-weird-behaviour</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 01:06:02 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6970.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Nov 2024 17:51:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Fri, 21 Feb 2025 02:31:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/elliptic3612" aria-label="Profile: Elliptic3612">@<bdi>Elliptic3612</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/matthewchan" aria-label="Profile: matthewchan">@<bdi>matthewchan</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/sb12345" aria-label="Profile: SB12345">@<bdi>SB12345</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/sqbaczek" aria-label="Profile: sqbaczek">@<bdi>sqbaczek</bdi></a><br />
We have fixed this problem, please wait for the next version of UiFlow2 firmware</p>
]]></description><link>https://community.m5stack.com/post/28288</link><guid isPermaLink="true">https://community.m5stack.com/post/28288</guid><dc:creator><![CDATA[kuriko]]></dc:creator><pubDate>Fri, 21 Feb 2025 02:31:01 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Wed, 19 Feb 2025 09:48:39 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></p>
<p dir="auto">I have the same issue.</p>
<p dir="auto">I tried  to only connect only ONE TOF4m to PA.HUB 2.1 then Port A.</p>
<p dir="auto">I got " unexpected arguement 'addrsize' " when I init TOF4M</p>
<p dir="auto">but if i change TOF4M to TOF, it works fine(the init funtion of TOF, not 4M version, has no argument, i.e.  just init() )</p>
]]></description><link>https://community.m5stack.com/post/28269</link><guid isPermaLink="true">https://community.m5stack.com/post/28269</guid><dc:creator><![CDATA[matthewchan]]></dc:creator><pubDate>Wed, 19 Feb 2025 09:48:39 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Fri, 29 Nov 2024 08:36:18 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sb12345" aria-label="Profile: SB12345">@<bdi>SB12345</bdi></a></p>
<p dir="auto">ok, have you tried to only connect one TOF4m to port C? Does that work?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/27213</link><guid isPermaLink="true">https://community.m5stack.com/post/27213</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Fri, 29 Nov 2024 08:36:18 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Thu, 28 Nov 2024 14:08:56 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></p>
<p dir="auto">Indeed yes, I get a port address error. I have a Core 2.</p>
]]></description><link>https://community.m5stack.com/post/27187</link><guid isPermaLink="true">https://community.m5stack.com/post/27187</guid><dc:creator><![CDATA[SB12345]]></dc:creator><pubDate>Thu, 28 Nov 2024 14:08:56 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Mon, 18 Nov 2024 18:09:25 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sb12345" aria-label="Profile: SB12345">@<bdi>SB12345</bdi></a></p>
<p dir="auto">ok, I see, hmm.</p>
<p dir="auto">Have you tried to connect one TOF4m to port A and the other to port C and then setup two I2C busses?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/27089</link><guid isPermaLink="true">https://community.m5stack.com/post/27089</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 18 Nov 2024 18:09:25 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Mon, 18 Nov 2024 15:39:44 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>  Tried this. I could not get the address change to 'stick' after a power cycle, but perhaps I'm missing something. I did this using UIFlow2.</p>
]]></description><link>https://community.m5stack.com/post/27085</link><guid isPermaLink="true">https://community.m5stack.com/post/27085</guid><dc:creator><![CDATA[SB12345]]></dc:creator><pubDate>Mon, 18 Nov 2024 15:39:44 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Mon, 18 Nov 2024 10:31:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi guys</p>
<p dir="auto">BTW: TOF4m allows to change its I2C address (using <code>set I2C address</code> block in UIFlow2) so you could change the I2C address of one TOF4m, then connect both using a passive <a href="https://docs.m5stack.com/en/unit/hub" target="_blank" rel="noopener noreferrer nofollow ugc">hub</a>. This would take PaHub out of the equation.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/27079</link><guid isPermaLink="true">https://community.m5stack.com/post/27079</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 18 Nov 2024 10:31:44 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Sun, 17 Nov 2024 20:16:21 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">My first post here. Came across this thread googling.</p>
<p dir="auto">I can recreate this problem, it has been driving me crazy. I have tried 2 different PAHubs to ensure that isn't the issue. Can confirm the same issue arises with both. I bought the PAHub as it claimed it could handle 2 devices with the same I2C address across different ports, but something strange is occurring.</p>
<p dir="auto"><img src="/assets/uploads/files/1731873992699-img_20241117_200450.jpg" alt="IMG_20241117_200450.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">I have ToF4m sensors affixed 90 deg to each other, and attached to port A of a Core2 via the PAHub.</p>
<p dir="auto">Either ToF4m works fine when it is the only unit connected to the Core2.</p>
<p dir="auto">When both are connected via the PAHub, the results seem to interfere with each other. Particularly, a zero reading on one sensor always leads to a zero on the other. Also, the readings go from being stable and consistent to very noisy indeed - errors of up to 1m. I do not believe this is a laser intereference issue as if I cover one sensor, and point the other to clear air with no object for 3m, I still get a reading of 0 from both sensors.</p>
<p dir="auto">I am also unable to initiate ToF4M when connected via PaHUB2 on UIflow 2.0, and have had to revert to 1.0 to perform these tests.</p>
<p dir="auto">This has cost me a lot of time, and sadly I am unable to offer a solution at this time but I watch this thread with interest.</p>
<p dir="auto">Edit to add:</p>
<p dir="auto">If I remove one of the ToF4M modules whilst the program is running, both labels continue to update with results, further leading me to believe this is an address collision issue rather than a laser interference issue.</p>
]]></description><link>https://community.m5stack.com/post/27076</link><guid isPermaLink="true">https://community.m5stack.com/post/27076</guid><dc:creator><![CDATA[SB12345]]></dc:creator><pubDate>Sun, 17 Nov 2024 20:16:21 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Fri, 15 Nov 2024 13:32:01 GMT]]></title><description><![CDATA[<p dir="auto">Greetings everyone! I have very similar error as <a class="plugin-mentions-user plugin-mentions-a" href="/user/sqbaczek" aria-label="Profile: sqbaczek">@<bdi>sqbaczek</bdi></a> when running 1 ToF4M via PaHUB2 with CoreS3 and also Cardputer on UIflow 2.0. The ToF4M works fine when directly connected to the I2C port of either CoreS3 or Cardputer. It appears that ToF4M cannot be initiated when connected via PaHUB2 on UIflow 2.0.</p>
<p dir="auto">Below is the error I get with CoreS3 when on UIflow 2.0:</p>
<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 24, in &lt;module&gt;
  File "&lt;stdin&gt;", line 17, in setup
  File "driver/vl53l1x.py", line 60, in __init__
  File "driver/vl53l1x.py", line 176, in get_model_info
  File "driver/vl53l1x.py", line 273, in _read_register
TypeError: unexpected keyword argument 'addrsize'
</code></pre>
<p dir="auto">Below is my code on UIflow 2.0:</p>
<pre><code>import os, sys, io
import M5
from M5 import *
from hardware import *
from unit import TOF4MUnit
from unit import PAHUBUnit



label0 = None
i2c0 = None
pahub_0 = None
tof4m_0 = None


def setup():
  global label0, i2c0, pahub_0, tof4m_0

  M5.begin()
  Widgets.fillScreen(0x222222)
  label0 = Widgets.Label("label0", 0, 0, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)

  i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
  tof4m_0 = TOF4MUnit(PAHUBUnit(i2c=i2c0, channel=0), 0x29)


def loop():
  global label0, i2c0, pahub_0, tof4m_0
  M5.update()
  label0.setText(str(tof4m_0.get_distance))


if __name__ == '__main__':
  try:
    setup()
    while True:
      loop()
  except (Exception, KeyboardInterrupt) as e:
    try:
      from utility import print_error_msg
      print_error_msg(e)
    except ImportError:
      print("please update to latest firmware")
</code></pre>
<p dir="auto">I tested other units via PaHUB2 with CoreS3 on UIflow 2.0. These include Gesture Unit, 8Servos Unit, ENV Pro Unit, EXT.IO2 Unit. They all appear to work fine, at least not showing any initiation error.</p>
]]></description><link>https://community.m5stack.com/post/27054</link><guid isPermaLink="true">https://community.m5stack.com/post/27054</guid><dc:creator><![CDATA[Elliptic3612]]></dc:creator><pubDate>Fri, 15 Nov 2024 13:32:01 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Fri, 15 Nov 2024 02:16:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sqbaczek" aria-label="Profile: sqbaczek">@<bdi>sqbaczek</bdi></a><br />
I think this might be some weird hardware problem, like a damaged component in the PaHUB causing the transmitted information to be incorrect... etc. Maybe the best way is to find a working one to test it.</p>
]]></description><link>https://community.m5stack.com/post/27038</link><guid isPermaLink="true">https://community.m5stack.com/post/27038</guid><dc:creator><![CDATA[kuriko]]></dc:creator><pubDate>Fri, 15 Nov 2024 02:16:29 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Sun, 10 Nov 2024 21:11:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a>,<br />
thanks for response - yes I have tried different ports on PA.hub so between two uiflows sensors might have different port values.</p>
<p dir="auto">best,</p>
]]></description><link>https://community.m5stack.com/post/27009</link><guid isPermaLink="true">https://community.m5stack.com/post/27009</guid><dc:creator><![CDATA[sqbaczek]]></dc:creator><pubDate>Sun, 10 Nov 2024 21:11:36 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Sun, 10 Nov 2024 15:17:50 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sqbaczek" aria-label="Profile: sqbaczek">@<bdi>sqbaczek</bdi></a></p>
<p dir="auto">unfortunately I don't have the proper hardware, e.g. TOF4m unit, so I cannot test this myself. Sorry.</p>
<p dir="auto">BTW: are you aware that in UIFlow<strong>1</strong> you use PaHUB channel 0 and <strong>2</strong> and in UIFlow<strong>2</strong> you setup PaHUB channel 0 and <strong>1</strong>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/27007</link><guid isPermaLink="true">https://community.m5stack.com/post/27007</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sun, 10 Nov 2024 15:17:50 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Sun, 10 Nov 2024 12:53:12 GMT]]></title><description><![CDATA[<p dir="auto">Greetings <a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a>!<br />
Thank you for your reply,<br />
Even if I space apart both sensors and direct them in different spots - they still get weird readings. As soon as I disconnect one of them from pa.hub one label gets proper readings - and other gets very simillar reading to first label (even though it is linked with disconnected sensor).<br />
Below screenshot of readings with one sensor disconnected from pa.hub - and both labels change as soon as I get some object near the connected sensor.</p>
<p dir="auto"><img src="/assets/uploads/files/1731243073871-462582190_1192320768525964_4002535964587001502_n.jpg" alt="462582190_1192320768525964_4002535964587001502_n.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">For UIflow 1 code is:</p>
<pre><code>from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit


setScreenColor(0x222222)
tof4m_0 = unit.get(unit.TOF4M, unit.PAHUB0)
tof4m_1 = unit.get(unit.TOF4M, unit.PAHUB2)






label0 = M5TextBox(43, 36, "label0", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(45, 88, "label1", lcd.FONT_Default, 0xFFFFFF, rotate=0)


while True:
  label0.setText(str((str('odl 1 ') + str(((str(((tof4m_0.get_single_distance_value) / 10)) + str('cm')))))))
  label1.setText(str((str('odl 2 ') + str(((str(((tof4m_1.get_single_distance_value) / 10)) + str('cm')))))))
  wait_ms(500)
  wait_ms(2)
</code></pre>
<p dir="auto">When I try to run it on UIflow 2.0 with pa.hub I get error:</p>
<p dir="auto">Traceback (most recent call last):<br />
File "&lt;stdin&gt;", line 29, in &lt;module&gt;<br />
File "&lt;stdin&gt;", line 20, in setup<br />
File "driver/vl53l1x.py", line 60, in <strong>init</strong><br />
File "driver/vl53l1x.py", line 176, in get_model_info<br />
File "driver/vl53l1x.py", line 273, in _read_register<br />
TypeError: unexpected keyword argument 'addrsize'</p>
<p dir="auto">This is my code for uiflow 2 - and it does not work</p>
<pre><code>import os, sys, io
import M5
from M5 import *
from hardware import *
from unit import TOF4MUnit
from unit import PAHUBUnit



label0 = None
label1 = None
i2c1 = None
pahub_0 = None
tof4m_2 = None
tof4m_0 = None


def setup():
  global label0, label1, i2c1, pahub_0, tof4m_2, tof4m_0

  M5.begin()
  Widgets.fillScreen(0x222222)
  label0 = Widgets.Label("label0", 44, 65, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
  label1 = Widgets.Label("label1", 43, 111, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)

  i2c1 = I2C(1, scl=Pin(22), sda=Pin(21), freq=100000)
  tof4m_0 = TOF4MUnit(PAHUBUnit(i2c=i2c1, channel=1), 0x29)
  tof4m_2 = TOF4MUnit(PAHUBUnit(i2c=i2c1, channel=0), 0x29)


def loop():
  global label0, label1, i2c1, pahub_0, tof4m_2, tof4m_0
  M5.update()
  label0.setText(str((str('Odl1 ') + str((tof4m_2.get_distance)))))
  label0.setText(str((str('Odl2 ') + str((tof4m_0.get_distance)))))


if __name__ == '__main__':
  try:
    setup()
    while True:
      loop()
  except (Exception, KeyboardInterrupt) as e:
    try:
      from utility import print_error_msg
      print_error_msg(e)
    except ImportError:
      print("please update to latest firmware")

</code></pre>
<p dir="auto">Thank you for help,<br />
best,<br />
Matt</p>
]]></description><link>https://community.m5stack.com/post/27004</link><guid isPermaLink="true">https://community.m5stack.com/post/27004</guid><dc:creator><![CDATA[sqbaczek]]></dc:creator><pubDate>Sun, 10 Nov 2024 12:53:12 GMT</pubDate></item><item><title><![CDATA[Reply to Connecting multi TOF4m units via PA.hub - weird behaviour on Sun, 10 Nov 2024 10:04:35 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sqbaczek" aria-label="Profile: sqbaczek">@<bdi>sqbaczek</bdi></a></p>
<p dir="auto">assuming the programming is correct my best guess would be that the two ToF4m influence each other due to the signal they both send out. Maybe the signal of one gets reflected from the walls and then is picked up by both (and vice versa)?</p>
<p dir="auto">BTW: have you tried the UIFlow2 instead? Do you get the same results?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/27002</link><guid isPermaLink="true">https://community.m5stack.com/post/27002</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sun, 10 Nov 2024 10:04:35 GMT</pubDate></item></channel></rss>