<?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[Using Color Sensor TC34725 with Pbhub]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/3740/using-ir-remote-sensor-with-pbhub">Using IR Remote sensor with PbHub</a></p>
<p dir="auto">Just following up this question from some months ago, I was wondering if anyone had been able to operate the Color Sensor via a Pbhub channel? (I have been trying for quite some time now and am out of ideas).</p>
<p dir="auto">My specific question when looking essentially at trying to extend the example TC34725 sketch to channel 0 in pbhub is that I don't understand how to get<br />
<code>tcs.getRawData(&amp;red, &amp;green, &amp;blue, &amp;clear); </code><br />
to read data from the channel 0 address of the porthub?</p>
<p dir="auto">Just so that the Color Sensor sketch is here:</p>
<pre><code class="language-#include">#include "Adafruit_TCS34725.h"

/* Example code for the Adafruit TCS34725 breakout library */

/* Connect SCL    to analog 5
   Connect SDA    to analog 4
   Connect VDD    to 3.3V DC
   Connect GROUND to common ground */

/* Initialise with default values (int time = 2.4ms, gain = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();

/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X);

void setup(void) {
  Serial.begin(9600);

  if (tcs.begin()) {
    Serial.println("Found sensor");
  } else {
    Serial.println("No TCS34725 found ... check your connections");
    while (1);
  }

  // Now we're ready to get readings!
}

void loop(void) {
  uint16_t r, g, b, c, colorTemp, lux;

  tcs.getRawData(&amp;r, &amp;g, &amp;b, &amp;c);
  // colorTemp = tcs.calculateColorTemperature(r, g, b);
  colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
  lux = tcs.calculateLux(r, g, b);

  Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - ");
  Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - ");
  Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
  Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
  Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
  Serial.print("C: "); Serial.print(c, DEC); Serial.print(" ");
  Serial.println(" ");
}```</code></pre>
]]></description><link>https://community.m5stack.com/topic/4420/using-color-sensor-tc34725-with-pbhub</link><generator>RSS for Node</generator><lastBuildDate>Mon, 04 May 2026 16:18:55 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4420.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Jul 2022 05:50:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Thu, 07 Jul 2022 04:23:38 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/learly6" aria-label="Profile: learly6">@<bdi>learly6</bdi></a></p>
<p dir="auto">no, you don't need a softI2C library. The ESP32 in the M5Stack device already takes care of that for you. You can select almost any two pins to be used for I2C. This <a href="https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/" target="_blank" rel="noopener noreferrer nofollow ugc">tutorial</a> explains it quite nicely.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/17932</link><guid isPermaLink="true">https://community.m5stack.com/post/17932</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 07 Jul 2022 04:23:38 GMT</pubDate></item><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Thu, 07 Jul 2022 01:56:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Right, all will be I2C except for the PIR and IR remote, which was part of my confusion (as to why the research supervisor chose a PbHub instead of a PaHub and also suggested this route instead of a parallel setup with grove hubs). But understanding that I don't <em>need</em> to do it using a PbHub, would it be possible using the softI2C library (or via some other method)?</p>
]]></description><link>https://community.m5stack.com/post/17931</link><guid isPermaLink="true">https://community.m5stack.com/post/17931</guid><dc:creator><![CDATA[learly6]]></dc:creator><pubDate>Thu, 07 Jul 2022 01:56:58 GMT</pubDate></item><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Wed, 06 Jul 2022 22:13:14 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/learly6" aria-label="Profile: learly6">@<bdi>learly6</bdi></a></p>
<p dir="auto">in general all sensors which use I2C can be connected to port A in parallel - no need for a PaHub or PbHub. They only need to have different I2C addresses.</p>
<p dir="auto">You won't need the library you mentioned above. ESP32 allows to set almost any pins to be used for almost any function, e.g. I2C.</p>
<p dir="auto">Most of the sensors you mentioned above use I2C. Unfortunately two of them have the same address. So you either need a PaHub or you need to setup two I2C buses.</p>
<ul>
<li>TC34725 (0x29)</li>
<li>Ultrasonic (0x57)</li>
<li>DLight (0x23)</li>
<li>ToF (0x29)</li>
<li>ENVIII (SHT30:0x44 , QMP6988:0x70)</li>
<li>PbHub (0x61)</li>
</ul>
<p dir="auto">The PIR sensor uses a GPIO. You can either connect it directly to a GPIO of the M5Stack or you can use a PbHub.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/17930</link><guid isPermaLink="true">https://community.m5stack.com/post/17930</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 06 Jul 2022 22:13:14 GMT</pubDate></item><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Wed, 06 Jul 2022 21:25:08 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">Right, because of the combination of sensors I am required to connect to the M5, I need to use a Hub. I am not only connecting the TC34725, but also a PIR motion, Ultrasonic, DLight, TOF, ENVIII, etc. (7 sensors as of now).</p>
<p dir="auto">I was thinking of something like this library to achieve this: <a href="http://todbot.com/blog/2010/09/25/softi2cmaster-add-i2c-to-any-arduino-pins/comment-page-2/" target="_blank" rel="noopener noreferrer nofollow ugc">http://todbot.com/blog/2010/09/25/softi2cmaster-add-i2c-to-any-arduino-pins/comment-page-2/</a></p>
<p dir="auto">Thanks,<br />
L</p>
]]></description><link>https://community.m5stack.com/post/17929</link><guid isPermaLink="true">https://community.m5stack.com/post/17929</guid><dc:creator><![CDATA[learly6]]></dc:creator><pubDate>Wed, 06 Jul 2022 21:25:08 GMT</pubDate></item><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Wed, 06 Jul 2022 21:05:58 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/learly6" aria-label="Profile: learly6">@<bdi>learly6</bdi></a></p>
<p dir="auto">M5Stack devices already have an I2C port (port A). Is there a particular reason you cannot simply connect the TCS347225 to port A? What is the reason you want to use a PbHub?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/17928</link><guid isPermaLink="true">https://community.m5stack.com/post/17928</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 06 Jul 2022 21:05:58 GMT</pubDate></item><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Wed, 06 Jul 2022 20:53:28 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 replying. I know that PbHub is meant for the simple I/O, but I was wondering if it were possible to use softwarewire or some other method to read the sensor data from a PbHub channel. My research supervisor has suggested I do this and has requested so without using a PaHub, but I don't fully understand how it would be possible.</p>
<p dir="auto">Thanks,<br />
L</p>
]]></description><link>https://community.m5stack.com/post/17927</link><guid isPermaLink="true">https://community.m5stack.com/post/17927</guid><dc:creator><![CDATA[learly6]]></dc:creator><pubDate>Wed, 06 Jul 2022 20:53:28 GMT</pubDate></item><item><title><![CDATA[Reply to Using Color Sensor TC34725 with Pbhub on Tue, 05 Jul 2022 07:05:28 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/learly6" aria-label="Profile: learly6">@<bdi>learly6</bdi></a></p>
<p dir="auto">I don't think you can use a P<strong>b</strong>Hub for the TCS347225. The P<strong>b</strong>Hub is meant for simple I/O whereas the TCS347225 is an I2C device. Did you mean a P<strong>a</strong>Hub - which acts as an I2C switch? But normally you only need a P<strong>a</strong>Hub if you have multiple of the same sensors which share the same I2C address.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/17912</link><guid isPermaLink="true">https://community.m5stack.com/post/17912</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 05 Jul 2022 07:05:28 GMT</pubDate></item></channel></rss>