5
\$\begingroup\$

TL;DR

  • 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:

DigiSpark:

DigiSpark

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.

Footnote

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...

\$\endgroup\$
2
\$\begingroup\$

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).

\$\endgroup\$
9
  • \$\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\$ Aug 10 '19 at 19:34
  • \$\begingroup\$ @Greenonline Hmm. Updated once again. The only thing left is current measurement. And may be desoldering that "diode"... \$\endgroup\$ Aug 10 '19 at 20:16
  • 1
    \$\begingroup\$ @Greenonline Updated. I completely forgot about Schottky diodes which are very common in power applications :) \$\endgroup\$ Aug 10 '19 at 20:39
  • \$\begingroup\$ Very interesting indeed, thanks. So the fact that it is a Schottky makes all the difference..? \$\endgroup\$ Aug 10 '19 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\$ Aug 10 '19 at 20:56
2
\$\begingroup\$

While researching something for a project of mine, I got the idea to reverse engineer the digispark USB connection for clues, and the D3 diode had me stumped for days, days! But I think I finally figured it out:

  • What is the purpose of D3?:

D3 is to protect your laptop from the things you're likely to be doing with a crazy cheap prototyping board kind of product.

  • Which is the correct orientation?:

It's backwards on the "DigiSpark" schematics. Anode should be on USB, cathode (|) on the "5V".

  • Does it depend upon its intended purpose (whether to protect the USB or the 7805)?

Yes. Possibly it could be nice to have another one to protect the regulator, but: costs, limited space, and your laptop is not going to try to fry your digispark or pendrive or other stuff, so why bother?

Exhibit A: The annotated Digispark picture from the question. Correctly identifies the terminals as USB 5V in the very corner, and 5V to the right. Looking closely, there's a hint of cathode stripes on the right. And K12 is upside down, if this is the same/similar diode to this SMD diode K12 that would also imply cathode on the right.

Exhibit B: This pcb layout confirms the terminals. Diode direction seems ambiguous to me, and I'm not sure how "official" this image is, but the paths agree with a Digispark I physically have, and the annotated picture. USB 5V is in the corner.

Digispark PCB layout

Exhibit C: Every photo of actual digispark I find where the orientation of the diode is discernible shows the same orientation with anode in the corner. (there are some 3d renders floating around that differ, I guess ignore them?)

Some examples: way different diode, but note direction image from GitHub youtube vid of a prototype using digispark (best visible around 1:40 mark) The one I have also agrees.

And, perhaps most importantly: main image on this actual digistump product page shows anode in the corner (connected to USB 5V), cathode strip indicator "towards the USB connector"

While trying to describe it I noticed a possible source of confusion, on the board the diode lies with cathode pointing towards the USB connector, but the PCB paths run under and around and the actual USB 5V is in the corner. Perhaps while drawing the schematics someone glanced at the board and drew it backwards?

\$\endgroup\$
2
\$\begingroup\$

D3 diode is wrongly flipped in the first schematic diagram named "DigiSpark" and does not comply with the actual Digispark hw configuration, while its polarity is correct in the other schematic diagram marked "Mini development board".

The picture named "Annotated DigiSpark" shows the K12 Schottky diode (MDD DSK12), which has its cathode (|) close to the "K" label, while "2" is close to the anode; so the cathode (that can be also recognized by its color band) is connected to 5V and the anode to USB V+, in line with the "Mini development board" schematic diagram and this is the correct orientation.

Through D3 diode, the USB is able to provide +5V to the device, while an external power supply will not feed current to the USB in order to protect external USB host devices when the Digispark is powered via 5V or VIN pins.

The 78M05 linear regulator in the Digispark is actually not protected (regardless the D3 diode polarity) and backfeeding it with the Digispark 5V pin or with the USB connector (with VIN not connected) drains a current of about 2 mA from its OUT pin to GND (ensuring also to keep the IN pin floating to avoid increasing the leakage current). If the linear regulator is not needed (e.g., if an external 5V power supply is available), it is advisable to remove the regulator by unsoldering it (or by cutting its output pin).

D3 does not protect all possible cases and it is advisable to disconnect the USB when powering the Digispark through its 5V or VIN pins (for instance, 3.3V shall not be applied to the Digispark 5V pin if the USB cable is connected).

\$\endgroup\$
1
  • \$\begingroup\$ Nice answer and detailed explanation. \$\endgroup\$ Oct 27 '20 at 13:45
1
\$\begingroup\$

Actually, I had the same feeling because my board didn't work at the beginning but it was a matter of bootloader and not electronics. Moreover, Power LED works when the ATTiny is connected to USB port which means that in any way, the current flows from 5V net to GND. I guess in some specific extreme case, you could have 5V on this net when this protection diode is reverse biased, IF THERE IS ABSOLUTELY NO CURRENT AT ALL SO IF THERE IS INFINITE IMPEDANCE BETWEEN 5V AND GND (a net cut for example). My analysis was : the D3 is in the wrong orientation on the schematics but looking closer to the board, the orientation was OK. They should have updated the schematics but they will probably have thought, "OK! For just one misdirection, we won't change everything. The main point is to remember the diode has to be oriented the other way on the PCB!" Anyways, keen observation. I take the opportunity of this post to tell that USB signals from the computer is 3.3V but ATTiny85 answers with a 5V level. If we assume that there is a protection group of Zener diodes in the computer or the device we plug the ATTiny in (which is mostly the case), there is no specific risk of destruction. Otherwise, it should have been more prudent to insert a voltage divider...

\$\endgroup\$
0
\$\begingroup\$

The anode goes towards the source you want to protect.

If I have multiple power sources and even if this experimental in nature, I use these Arduinos of all kinds all over the place.

If I were to do a design, I would protect all power source with the anodes from the source and the cathodes to the 5 V bus. In this case, it's an extra two diodes. There's certainly enough room on the board for that.

As an aside, when you want to solder wiring directly into the board for sensors because you actually want to use the board for something permanent, it misses connectivity for GND and 5 V. I would create an array of 6 columns and 3 rows at 0.100 spacing with GND, 5 V, Signal. The 5 V in the middle that way if someone plugs it upside down you have less risk of shorting the board or killing your sensor.

\$\endgroup\$
0

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.