Adafruit is open and shipping! Let's build back better, together!
0

Creating an i2c secondary
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Creating an i2c secondary

by efosdick on Tue Nov 17, 2020 2:09 pm

I am working on a project where I have a sensor that will be repeated a number of times. It will have (one of, not sure which yet) the SAMD processors on it and a bunch of sensors hooked into that processor, mostly i2c. I want to have those hooked into a primary controller that can poll the sensors and process the results. I have used i2c a bunch with individual sensors but it would be really nice to be able to use one as a secondary. I also see the guide on i2c that shows how to detect which "other pins" can be i2c so I think that I can use a set of the "other pins" as the secondary.

What I'm not seeing is how to set that all up. I imagine that I would need to specify the address and then define a bunch of functions but this is where I lose the trail. Has anyone done this? Is there a better way to be doing this?

efosdick
 
Posts: 33
Joined: Thu Oct 05, 2017 3:46 pm

Re: Creating an i2c secondary

by tannewt on Tue Nov 17, 2020 6:29 pm

What do you mean by secondary? Do you mean a second SAMD connected over I2C to the first? UART is a much easier process to do that.

If you want a second I2C bus, then call `busio.I2C(scl, sda)` a second time with the second set of pins you want to use.

tannewt
 
Posts: 1919
Joined: Thu Oct 06, 2016 8:48 pm

Re: Creating an i2c secondary

by efosdick on Tue Nov 17, 2020 6:34 pm

What I'm thinking is that the secondary has 5 or 6 sensors hooked up to it. Then from the primary I could use the secondary as any other i2c device. I would have multiple of the secondaries setup. I could set it up and write a library to make calls to it. Perhaps UART is a better solution. I will check into that. Thanks!

efosdick
 
Posts: 33
Joined: Thu Oct 05, 2017 3:46 pm

Please be positive and constructive with your questions and comments.