RaspiFan2019
Posts: 5
Joined: Sat Jan 05, 2019 6:42 am

I2C hot swap sensors

Tue Jan 29, 2019 5:50 pm

Hi,

I want to make a hot swap system for sensors. I know that I have to connect power before data and that similar addresses may confuse the system, but I would like to know if there are any IC or software solutions to this.

Note: Each sensor has a different I2C address, and I will be using micro USB plugs (replacing USB data with I2C data) to ensure power before data.

Thanks!

PhatFil
Posts: 1685
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: I2C hot swap sensors

Tue Jan 29, 2019 5:59 pm

Generally thats a bad idea, hot swapping can disconnect a device in subtly different ways each time, a little left twist on the plug and one contact will break before the others etc. While many components may be robust enough to cope others may not be ..

If dead set on the idea I would suggest fitting a N/C switch on the +5v feed to the i2c/usb socket so you can press to disconnect the device you want to swap out and keep pressed while inserting its replacement to minimise the risk.

RaspiFan2019
Posts: 5
Joined: Sat Jan 05, 2019 6:42 am

Re: I2C hot swap sensors

Tue Jan 29, 2019 6:05 pm

Hmm, basically you are saying that its possible but I need to be extra careful?
I will look into the N/C switch.

Thank you for the quick response!

PhatFil
Posts: 1685
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: I2C hot swap sensors

Tue Jan 29, 2019 6:48 pm

If all sensors have different addresses why not simply connect them all and only query the ones that interest you? even when there are address conflicts for example if using 4 x bmp280 sensors which iirc only have a single addy option, you can still use them by adding an i2c multiplexer board with multiple channels.. ie https://www.ebay.com/itm/Tca9548A-I2C-I ... 100623.m-1

RaspiFan2019
Posts: 5
Joined: Sat Jan 05, 2019 6:42 am

Re: I2C hot swap sensors

Tue Jan 29, 2019 10:07 pm

The reason I'm not doing that is because I'm creating a multiuse system where different sensors can be plugged in when they are needed. For example, if a Pi is in a backpack, then I could have an armband with a UV sensor. Or, later attach a gesture sensor, and so on.

PhatFil
Posts: 1685
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: I2C hot swap sensors

Wed Jan 30, 2019 12:08 am

my own all be it very limited experience with diy modules and projects would suggest diy plug/sockets are a very weak link in the proverbial chain. Imho a true multipurpose device would have all the sensors and inputs attached and only use those apt for its current use.. Not only reducing the probability of faults but also making any useage change a matter of s/w configuration only. for devices you may want some distance from the pi in use check out all the retractable cabling options available for modification ;) so if your pi is in the backpack and you want a UV sensor on your head/arm, just pull it out ;)

User avatar
Gavinmc42
Posts: 4534
Joined: Wed Aug 28, 2013 3:31 am

Re: I2C hot swap sensors

Wed Jan 30, 2019 2:00 am

Have a look at Pimoroni's Flotila stuff, they use USB cables for i2c.
https://shop.pimoroni.com/?q=flotila

Personally I prefer the 4 way Micromatch connector system, but they are not for insertion/ removal 100's of times.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Interfacing (DSI, CSI, I2C, etc.)”