Please bear with me as I am a bit new to electronics and arduino.

I am trying to have multiple sensors connected to an Arduino Mega through I2C Bus. That is working but I would like to have the ability to make one or several device connected to that BUS undetectable at some point in time and then make them detectable again at some other time while some others stay detectable. I have been trying to accomplish that with relays, MOSFET... but no like or I might be doing something wrong or completely out of point. Can anyone help me accomplish that?

enter image description here

what I have been trying to do so far

  • 4
    What is the reason you want to do this? It may be that there is a better solution to the greater goal. Mar 17 '18 at 21:45
  • Let say we have an interface made with an LCD and two buttons that is part of the whole circuit with the aim to tell the Arduino that the component that you will detect first is a temp sensor, the second is an humidity sensor and so on.. I am thinking that the only way to achieve this using an I2C Bus is by first switching OFF all the devices' SCL lines than switch them back on one by one so that the circuit can precisely tell what type of sensor is at which address
    – Olfredos6
    Mar 18 '18 at 6:28
  • looks like SCL through Q1 is backwards, just riding the body diode of the IRF
    – dandavis
    Mar 18 '18 at 12:54
  • 1
    I2C designs don't usually "detect" devices - that's more a development tool. I2C is designed to have multiple devices connected at once - that's the whole point. The kinds of games you seem to be trying to play here typically only legitimately happen when you want to use more than one device with the same unconfigurable address. Apr 17 '18 at 13:41
  • I think that you are doing it wrong. You know that if you have a SHT21 on the I2C it will be on address 0x80, while the TC74 has address 0x9A and the TCA9538 can have address 0xE0, 0xE2, 0xE4 or 0xE6. So just search the whole I2C address space, and see if you can detect one of the devices you know
    – frarugi87
    Apr 17 '18 at 13:53

Use a 2-channel switch between the master and each slave. When the switches are open, the slave is off the bus. When closed, the slave is on the bus and can respond. Example: http://www.ti.com/lit/ds/symlink/ts3a4741.pdf

You may just need a single channel even, just keep the slave from seeing the clock.

  • Thanks for your answer...but I would like to have a digital switch that the micro controller will control so that I do not have to do this manually
    – Olfredos6
    Mar 18 '18 at 6:40
  • 1
    It is not a manual switch...
    – user2497
    Mar 18 '18 at 15:35

Found the solution

A DSWITCH did the trick. See the picture below

enter image description here

  • 1
    Please tell us more about this DSWITCH
    – user2497
    Mar 18 '18 at 15:34
  • look at a component like the TI TS5A3357DCUR using a logic input you can select one of three inputs /outputs to connect to a common output/input respectively.
    – user30884
    Apr 17 '18 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.