• What is the purpose of D3?
  • Which is the correct orientation?
  • Does it depend upon its intended purpose (whether to protect the USB or the 7805)?

I have two ATtiny85 development boards, one is a DigiSpark and one is a generic mini development board.

As the schematics below show, they are essentially the same:



Mini development board:

Mini development board

However there is one small but significant difference - the orientation of D3:

  • The DigiSpark has the anode to 5V and cathode to USB 5V;
  • the Mini Dev board has the anode to USB 5V and cathode to 5V.

I have tested and checked the orientation of D3, on both boards, with a diode tester and both of the schematics are indeed correct1, and both boards work from USB power, as required. However, the orientation of D3 on either board is opposite to that of the other.

For the Mini development board, I assume that the diode (with the anode connected to USB 5V) would protect the USB from externally connected VIN feeding back, via 5V. Would that be a correct assumption to make?

However, for the DigiSpark board:

  • How can the board be powered from USB, if the diode is blocking the USB 5V (anode to the 5V output of the 7805)?
  • Is D3 protecting the 7805 from USB power?
  • If so, then the USB is left unprotected (when an external supply is applied)?

For completion, here are annotated photos of the two boards, showing the component identifiers:

Annotated DigiSpark

Annotated DigiSpark

Annotated mini development board

Annotated mini development board

For full disclosure, these images come from my blog Digistumped?, which has some additional reasoning explained, which I don't need to go into here.

I have checked and metered out both boards and checked the components and their connections. All components are accounted for in the schematics... There are no hidden components (which aren't shown on the schematics) and no hidden traces/connections/contacts.


1 I have searched and found links discussing the orientation, but none have a suitable explanation:

Diode D3 is not in reverse. as suggested in post#2 of digispark ATTiny85 not running on independent power:

Is D3 really connected as per the schematic? I think it should have the anode connected to the USB connector.

as this Bypass Digispark 5v 500ma current limit? post states

we can see that there is a diode that drops the voltage to the VIN pin on the board...as i understand it that pin is there to prevent external power from feeding back into the usb port...

See also Powering the Digispark and Power from USB connector, in particular this post:

I do think the schematic for the original digispark is wrong... the diode is pointing towards, the 5v, not away from it, so it is allowing the USB to provide power to the 5v pin, but preventing any power present on 5v from feeding into the 5v line. Just to be clear, this is the schematic I am looking at for the Digispark...


Well, you are right, in DigiSpark's schematic USB power pin becomes useless. If you look into schematics of some common development boards which run into the same problem of USB supply competing with possible external supply, you'll find either this

Arduino Nano

(taken from https://www.arduino.cc/en/uploads/Main/Arduino_Nano-Rev3.2-SCH.pdf)

or this

Arduino Uno

(taken from https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf)

The Nano's schematic speaks for itself here: the diode's purpose is being a supply-selector. Simply judging based on this fact, we can deduce that it should be connected so that it allows current to flow when there is no external supply, and blocks it if there is one. This implies connection of the cathode to 5V.

Small form-factor boards tend to use a single diode to save space and put up with its disadvantages like relatively large voltage drop and inability to switch the board to 3.3V operation without sinking current from USB. However, even if we look at the body diode of the MOSFET in Uno's schematic, we'll see that it's oriented the exact same way we've just deduced.

Moreover, this arrangement also protects USB bus from possible overvoltage (due to possible connection mistakes). In DigiSpark's schematic the diode does not protect USB from anything at all, it won't save the bus even from, let's say, 7V, because the diode voltage drop is approximately 0.7V (depends on forward current).

I don't see any point in protection of the 7805 from VBUS at all. Under what circumstances could VBUS become >5V +/- 5%? If you really have to take protection to this level, you should look into something like https://www.rugged-circuits.com/ (though I don't quite remember if they offer real USB isolation)

UPD: I can't think of a way to supply current (at least more than a few microamps, if we are talking about a small signal/power diode) through a reverse-biased diode. The fact that it does power from USB suggests that either there is some circuitry around the diode, that lets the current through, or this is actually not a diode. Are there any board layout files available? Otherwise you have to verify the schematic (just trace the circuit with a multimeter), or try to find datasheet based on the "diodes" SMD marking. Also you can try to measure current consumption of the device through USB connector, though I think it's highly unlikely that the uC is supplied by reverse current of the diode. But I am not saying it's entirely impossible.

UPD2: I thought I sorted it out, but no. I've come across a photo on some forum links you included that shows that only VBUS pin is required for powering. Data lines are not connected. But anyway, here is what I thought. During idle state USB D+ line is pulled high. Usually that's what the pullup resistor of the slave device is for, but since facts suggest that the uC is powered even with VBUS blocked, the hub must be doing the same thing. Powering uCs through IO's CMOS protection diodes is a common thing.

UPD3: As far as I can see the diode is marked "K12". Do the dimensions correspond to SOD-123? If so, then it's a (of course, they have low forward voltage!) Schottky diode, and Schottky diodes are famous for large reverse currents. This [ https://img.ozdisan.com/ETicaret_Dosya/468036_1760701.pdf ] datasheet claims 0.1-3mA, depending on conditions. This may be very well sufficient to power the uC, but can lead to problems when uC's pins are loaded. You can try loading a pin (set to output and high) with a 125-150 Ohm resistor and measuring +5V voltage. If uC is supplied by reverse current, then the latter should drop (and may be even reset the uC doing so).

  • \$\begingroup\$ Nice answer, but the DigiSpark does actually power from USB, and I can't figure out how that is the case, if D3 is blocking the current. \$\endgroup\$ – Greenonline Aug 10 at 19:34
  • \$\begingroup\$ @Greenonline Hmm. Updated once again. The only thing left is current measurement. And may be desoldering that "diode"... \$\endgroup\$ – kutukvpavel Aug 10 at 20:16
  • 1
    \$\begingroup\$ @Greenonline Updated. I completely forgot about Schottky diodes which are very common in power applications :) \$\endgroup\$ – kutukvpavel Aug 10 at 20:39
  • \$\begingroup\$ Very interesting indeed, thanks. So the fact that it is a Schottky makes all the difference..? \$\endgroup\$ – Greenonline Aug 10 at 20:41
  • \$\begingroup\$ Yes. Typical silicon diodes have very small reverse currents, power diodes (like 1n4007 etc) usually have ~5uA reverse leakage, small signal diodes (like 1N4148) under proper conditions exhibit ~25nA of leakage. Schottky diodes are not "traditional" semiconductors (you can read more on Wikipedia), they were designed to have low forward voltage (and therefore can be found in power supply applications, less forward voltage = less wasted power), but it lead to another drawback - large reverse current. \$\endgroup\$ – kutukvpavel Aug 10 at 20:56

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.