I have a setup as seen in this image: enter image description here

The question is what will the voltage at the line on the left size (marked with [Volt ??] ) be when the open-drain logic is active? The goal is to have a logic zero but I am not sure how the diode D1 is going to affect this. Will it depend of its forward voltage or some other characteristics? How can I estimate the voltage at [Volt??] to make sure it will be low enough to register as logic zero?

  • For clarifications: this is an I2C bus connecting a Raspberry Pi to an Atmel ATTiny13 micro-controller. The 3.3v and R1 are the RPi side, and the open-drain side is one of the ATTiny I/O pins. The diode D1 is added to protect the RPi from miss configuration on the ATTiny side that might pull the line high to 5v which might damage the RPi.
  • \$\begingroup\$ FAD, you do realize that if Raspberry Pi uses true I²C (I²C uses only two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock (SCL), your setup will not work as data can only go one way on the SDA line. \$\endgroup\$ – Suirnder Apr 5 '13 at 15:49
  • \$\begingroup\$ @Suirnder, Aside from the voltage values issue it should work. Keep in mind that the I2C bus is open-drain driven and since the pull-up resistor is before the diode so both sides can pull the line down still. \$\endgroup\$ – Fahad Alduraibi Apr 5 '13 at 16:18
  • \$\begingroup\$ @FAD if the pi pulls the line down the tiny won't see it as the diode will block lower voltage, a simple level shifter with a MOSFET can be used as noted here ics.nxp.com/support/documents/interface/pdf/an97055.pdf \$\endgroup\$ – Gorloth Apr 5 '13 at 17:31

The maximum voltage that can be interpreted as a low per the I2C spec is 30% of VCC. For your circuit to operate correctly (assuming that the Raspberry Pi follows spec) the voltage will need to be less than 30% of 3.3V or 0.99V.

You'll need to do some circuit analysis to determine the voltage that will be seen.

The ATTiny13 data sheet says that for the GPIO lines, a low can be as high as 0.7V depending on the pin and the amount of current sunk.

Add in the forward drop of the diode you've placed (which will be conducting when the ATTiny13 is conducting) and you may end up in trouble.

You may need to reverse the logic on the ATTiny13 and have it drive an external logic level MOSFET on, instead of relying on the sinking capability of the pin. You should also go with a schottky diode for D1 to lessen the forward drop.

  • \$\begingroup\$ The VIL [high] for the attiny13 is not 0.7! it is 0.3*Vcc which is in my case is 0.3*5.0 = 1.5v so that shouldn't be a problem. It is the detection of high logic (VIH[low]) that might be a problem as i mentioned in another comment. \$\endgroup\$ – Fahad Alduraibi Apr 5 '13 at 16:26
  • \$\begingroup\$ Are you disagreeing with page 115 of the attached datasheet, under the section "Output Low Voltage"? I assumed that you were driving the GPIO output low to make the Raspberry Pi see a low. \$\endgroup\$ – Adam Lawrence Apr 5 '13 at 17:16
  • \$\begingroup\$ you are totally right. I was mixing the VIL with VOL. I also failed to mention that I am actually using the attiny13a not the attiny13 and its VOL max is 0.8v which is even worse. \$\endgroup\$ – Fahad Alduraibi Apr 5 '13 at 19:12
  • \$\begingroup\$ since we know the pull-up voltage and resistor, can't we calculate the max current? isn't it I=V/R=3.3/18000=1.8mA? Is that correct? if it is correct then based on the ATTiny13A datasheet the VOL will be <0.1v \$\endgroup\$ – Fahad Alduraibi Apr 5 '13 at 19:40
  • \$\begingroup\$ Don't forget to subtract the diode voltage and the GPIO voltage. \$\endgroup\$ – Adam Lawrence Apr 6 '13 at 1:25

A 'normal' diode (like 1N4148) would have a voltage drop of around 0.6V. The transistor might give you something like 0.2V in addition to that (check the datasheet). This could give you a total voltage drop of 0.8V, or just 0.6V.

Here, you can find how TTL and CMOS will see this:

  • TTL: 0 to 0.8V is low, 2 to VCC is high
  • CMOS: 0 to VDD/2 is low, VDD/2 to VDD is high

So this could get tricky with TTL, and you might be more secure using a schottky or germanium diode with a voltage drop of 0.2V and 0.3V, respectively. However, it might just work with a standard diode, so just test it and you'll see if it works!

  • 2
    \$\begingroup\$ There will also be a voltage drop across the transistor of about 0.2V - check the datasheet for this value. Volt should still be a logic 0. \$\endgroup\$ – xyzio Apr 5 '13 at 15:24
  • \$\begingroup\$ yeah i was planing on using a schottky diode just to be safe since I couldn't find the electrical characteristics of VIL and VIH in the Broadcom datasheet (makers or the RPi arm chip). However, I just realize that I might have another issue with the arduino detecting a logic 1, since ATTiny13 VIH[min]= 0.6*5v = 3v! This might not work, right? \$\endgroup\$ – Fahad Alduraibi Apr 5 '13 at 15:52
  • \$\begingroup\$ @FAD I'm sorry, I don't know. I never worked with Arduino or Raspberry Pi. \$\endgroup\$ – user17592 Apr 5 '13 at 15:54
  • 2
    \$\begingroup\$ 0.2 V drop for the transistor is a value that's commonly used for BJT's. For MOSFETs you need to figure the drop from the load current and the Rds(on) of the FET. It could be as low as a few mV. \$\endgroup\$ – The Photon Apr 5 '13 at 15:59
  • \$\begingroup\$ @ThePhoton that is good news, but I couldn't find any details about the specs of drain circuit of the attiny chip so I cannot know for sure how much is the drop value. \$\endgroup\$ – Fahad Alduraibi Apr 5 '13 at 16:21

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