-2

I am new to this domain, for a project I have to build a health monitoring system to monitor temperature, heartrate and SPO2 . I am using MAX30102 Pulse Oximeter sensor, and MCP908 temperature sensor , with esp8266 . The problem is that each sensor need an SDA pin and an SCL pin but the Node MCU have only one SDA pin and one SCL pin . what should I do? I searched and I found something about I2C protocol but I didn't understand because there is no simple explanation for this . please help!!!!!

Lili Lili
  • 1
  • 1
  • SO is a programming Q&A platform and this question is not about programming. [What topics can I ask about here?](https://stackoverflow.com/help/on-topic) Please delete this. – Rob Jul 31 '23 at 19:25
  • I2C is a bus structure, meaning that all devices can connected to the same SDA and SCL pins as long as 1) each device has different I2C address, 2) and both SDA and SCL has proper pull-up resistors. Read [this tutorial](https://learn.sparkfun.com/tutorials/i2c/all) for more information. – hcheung Aug 01 '23 at 07:34

1 Answers1

0

That's the whole point of I2C, you only need one SDA/SCL on your device and all other I2C sensors connect in a chain one after another.

like this: Sensor 1 to Sensor 2 to Sensor 3... to ESP (saves the need for more ports on the micro-controller and ton of wires)

So, you simply connect:

  • the SDA from the ESP to the SDA on the MAX30102
  • MAX30102 SDA to the SDA of the MCP908

Same for the SCL, from one to another to another (like a chain)

The only tricky thing with I2C is that all devices attached have to have a unique chip address. Normally each sensor of the same family will have the same address set in the factory that can't be changed so most of the time you can't have 2 same sensor attached together. There are of course ways around buy using something called I2C multiplexer board/chip.

So, yes, you are absolutely ok with your setup just connect things one after another and it will work

Hope that helps

  • I2C is a bus structure, not a "chain one after another". All devices share the same bus (SDA and SCL) lines. – hcheung Aug 01 '23 at 07:21
  • I think "chain" is easier to understand than a "bus" if you are new to this stuff, don't you think? – ChipChop Gizmo Aug 01 '23 at 08:56
  • When you "chain" something together, it means you connect them in serial one after another. A "bus" is a common highway where all devices attached to it. They are fundamentally different. Read [network topology](https://en.wikipedia.org/wiki/Network_topology). – hcheung Aug 01 '23 at 09:43