0

I am going to do a project with a lot of Arduinos connected via I2C, where like of them can became master for a moment to announce an event. So I would like to see how much is the bus used. As there will be a central point, I thought about putting a LED there, from +5V to clock line, so it would shine when the transfer occurs and be black when the line is free. And so I would be able to guess the utilisation level of the bus. (The clock is effectively PWM going to zero often while in transfer, while being plain +5V when no transfer is active).

Of course direct connection is not the best idea, as it would disrupt the pull-ups and mess with the protocol (as it would drain a lot of power to clock each time it went down), there should be some separator/amplifier.

The question is - does anybody know a simple setting, where the LED would be driven by a small current to zero (that is inverting amplifier as simple as possible with high enough input impedance to not disturb I2C communication)?

Thanks for all hints :)

  • 1
    Just get one of the modern high power blue leds. Those will light up with as little as 0.1mA, perhaps even lower. Calculate the appropriate high value resistor to get this very low current. – Gerben Jan 9 '17 at 16:02
  • Thank you, I tried it and it worked even with clasical red LED (as I have no blue at hand just now) and 2K resistor (so approx 1mA), but it was bad visible, especially for short transmitions. Still it worked reliably with 30 cm long wires (and worked even with just 330R resistor, which was easy to spot - but I would not like to test it under noise on robot), so I finally set it with bipolar PNP with emitor on Vcc, base over 2K to clock and colector over 330R + red LED to GND. Shines nice too, drains just about 2mA from I2C. (If you want, make it answer and I will accept it) – gilhad Jan 11 '17 at 21:41
1

It can be done with two N-channel MOSFETs or one P-channel MOSFET (depending on what you have locally / can get / is in your bits box):

schematic

simulate this circuit – Schematic created using CircuitLab

In the left schematic the first MOSFET acts like a NOT gate, and the second is a simple low-side switch. The pair together make an active-low low-side switch.

The right hand schematic, which is somewhat simpler, uses a single P channel MOSFET as a high-side switch. This is normally driven with an N-channel MOSFET to invert the logic, since it is naturally active-low. You don't want that, so you can just connect direct to the gate.

Note that all MOSFETs are "logic level" with a threshold voltage below 3V (or -3V in the case of the P-channel).

  • 1
    Thanks you too. I had not MOSFET at hands, so I used bipolar PNP and 2K resistor to its base (as 4k did not open it fully) in the second schema (inverted logic). Works like a charm :) – gilhad Jan 11 '17 at 21:44

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.