Multiple sensors sharing the same I2C bus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-16 4:59 AM
Hi!
I have an automation project that requires a large number of sensors (up to 30). All sensors have digital outputs and use the I2C communication protocol. I would like to know if it is possible to have all the sensors sharing the same I2C bus. If so, where can I find more information on how to establish this connection? I'm planning on using an M-DUINO PLC.
Thank you in advance.
Sensor datasheet: https://www.st.com/en/imaging-and-photonics-solutions/vl53l1x.html
- Labels:
-
Time of flight
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-16 5:11 AM
​Hi
You can use multiple ST Time of flight sensor sharing the same I2C bus.
You may have lock on the application note linked below. It is for the VL53L0X but it also works for the VL53L1X.
Thanks,
Julien
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-16 5:42 AM
Thank you very much for your reply!
Is there any limitation regarding the number of sensors that can share the same I2C bus?
My project requires a "continuous" update of the distances measured by all the sensors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-16 8:37 AM
No limitations - except that each sensor is going to a capacitance to the bus. So your board layout guy is really going to have to pay attention to the pull-ups on the I2C.
There are a zillion web articles on how to configure I2C pull-ups. And if it were easy, there would not be so many.
But the software logic is easy.
Take a look at the Forum Question "Adding multiple vl53l0x sensors"
It has the psudo code you need.
If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-16 11:43 PM
I think I understood now.
Thank you so much for your help!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-19 1:07 AM
Hi!
I have one more question.
I read something about the fact that I2C communication might not be the best option when dealing with long cables.
I was planning on arranging my sensors to cover a length of approximately 10 m (maybe more). Is this still a suitable solution?
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-19 7:35 AM
The I2C bus is cheap, but it's not very robust. It's prone to noise issues. The bus clocks a bit every time the clock falls low, but if you add noise you can get a glitch, and an extra clock. That being said, there is an I2C bus inside every HDMI cable. It's how the Cable box communicates with the TV. In the HDMI case, the protocol just keeps repeating until the message gets through. But we don't have that luxury - it's too much time-sensitive data.
If you want long cables you are going to have to work for it. The cables are going to have to be twisted with ground wire, And well shielded. And thick.
And due to the capacitance involved you really have to design those pull-ups.
Ideally I2C cables should be 30cm max. After that you really have to start thinking about noise, and capacitance and pull-up design.
There is lots of information about designing I2C on the Web, but when I was asked for this type of design, I chose more CPUs communicating over RS-232.
If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-14 8:32 PM
Thanks for the writing last paragraph. My multiple VL53L3CX had 30cm cables each doesn't work. but I changed cables to 10cm each and it works with 4 sensors. I have to add 4 sensors more and 2 IMU sensors. I should try now. Thank you sir.
