enter image description here

The above schematic is for the Digispark ATtiny85 development board.

I am still fairly new to electronics, however I understand what all these components' functions are. I am just not sure why it is used in this way...

In the schematic I circled the components in question:

  • What is the point of the two capacitors (C1 and C2) from 5V to GND?
  • Why is the diode (D3) there? Should it not be flipped the other way around?
  • What is the purpose of the two zener diodes (D1 and D2)?

5 Answers 5


C1 + C2: these are for "supply decoupling". Logic circuits like a microcontroller draw current from the (5V) supply in short peaks. This would cause the supply voltage to drop and become non-constant which affects all circuits.

This can be solved by adding "supply decoupling capacitors" (sometimes called bypass capacitors) as these behave like a local supply energy storage near the chips. When a chip draws a current peak from the supply, the capacitor supplies it instead of the USB port, power adapter or battery. This makes the current loop short (between IC and capacitor) so minimizes radio wave emissions (EMI). Also it prevents issues in other circuits inside the chip and other chips as well.

For the diodes: see Indradeel's answer.

  • 2
    \$\begingroup\$ It's not stated on the schematic, but the capacitors should be placed close to the VCC and GND pins of the MCU. This is standard practice for ICs, so instead of littering the schematic with a bunch of capacitors, it's convenient to draw them all off to the side. \$\endgroup\$
    – Adam Haun
    Commented Aug 7, 2019 at 17:27

Diode D3 is wrongly represented in this Digispark schematic diagram and does not comply with the actual hw configuration. In fact the Digispark hardware includes it with reversed polarity, so that 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 host devices connected via USB when the Digispark is powered via 5V or VIN pins).

Through the flipped diode polarity represented in this schematic diagram, the USB would not be able to power the Digispark device, which it actually does.

An implication of the D3 diode is that when powering a Digispark device with 3.3V on 5V pin, the USB needs to be physically disconnected first (other than removing the linear regulator).

The Digispark device exploits a bit-bang implementation of the USB protocol via PB3 and PB4; the two Zener diodes D1 and D2 are part of the related physical interface, limiting the voltage of the USB data lines to 3.6V, (more or less) complying with the USB standard specification. In fact USB D- is pulled up to +5V in order to indicate low-speed device to the USB host and the D1-R3 network decreases the D- voltage to 3.6V. Also, when the IC drives the USB interface via PB3 and PB4, the R1-D1 and R2-D2 networks reduce the interfacing voltage of USB D- and USB D+ respectively, limiting it to 3.6V. This simplified USB physical interface has the disadvantage of draining extra current also when USB is not used, as subsequently explained.

The network of two bypass capacitors is a standard approach when powering an IC, setting the two caps as close to Vcc and GND pins as possible (it also complies with the Noise Canceling Techniques mentioned in the ATtiny85 datasheet). The larger capacitor smooths out lower-frequency variations in the supply voltage, managing transition currents which occur while the IC switches states (especially while driving external devices), and the smaller capacitor suppresses high-frequency transients of the clock.

Notice that R3-D1 has the drawback to always consume current (about 1 mA at 5V = 5-3,6V)/1,5Kohm in this schematic diagram), which is sensible power, especially when the linear regulator is removed (to enable powering the Digispark via external +5V without backfeeding the 78M05 linear regulator), R4 is removed (to disable the PWR LED which consumes power) and the ATtiny85 IC is set in power-down sleep mode. A workaround would be to move the R3 pullup from 5V to USB V+ exploiting the diode D3, so that the D- interface is set to 3.6V when the USB device is connected (dissipating about 5 mW), while no current draws from D3-R3-D1 when the Digispark is powered via 5V pin. Also, PWR LED-R4 can be connected to USB V+ instead of 5V, so that the power LED only switches on when the USB is connected (consuming power) and there is no consumption when the device is only powered via 5V (in this case, setting PB3 to HIGH will dimly light up the power LED via R1/D1-R4, consuming more or less 25 mA at 5V).

A more general implication of the two Zener diodes is that setting PB3 and PB4 to High (either in input or output mode) drains (significant) extra current following expressions (V[PB3]-3.6)/R1 and (V[PB4]-3.6)/R2 (e.g, 21 mA at 5V, so it is better not to use PB3 and PB4 with 5V logic, while this issue is overcome with 3.3V power supply at 8MHz).

  • \$\begingroup\$ Does it need to be converted from 5V to 3.6V? Could something break if D1 and D2 were removed? \$\endgroup\$
    – Arbitur
    Commented May 19, 2023 at 21:57
  • 1
    \$\begingroup\$ Yes, it is needed. If you remove D1 or D2 (don't do it), you are no more compliant with USB standard specification, where LOW data bit should be between 0.0V and 0.3V and HIGH data bit between 2.8V and 3.6V. \$\endgroup\$
    – ircama
    Commented May 21, 2023 at 11:23

For the capacitors, see Bimpelrekkie's answer.

Zener diodes D1 and D2 reduce the usb data lines to USB high of 3.6V.

Diode D3 prevents USB 5V transients or overvoltage from damaging the 5V regulator chip V1 or the rest of the components. The device does not appear to be just a USB device. It also has it's own power input for standalone operation. The diode exists to protect that power supply, and everything else on the board when it is plugged into USB. The USB specification has a higher limit of 5.25V, so could potentially damage the 5V on-board regulator. I would guess that putting a diode at the USB port to protect the USB chip would be the job of the PC designer. Either way, the 5V connection to USB itself can be removed with no ill effects and then the diode would not be required. This is because the data lines are ground referenced.

  • 2
    \$\begingroup\$ The device is supposed to be a USB device, I don't see why this device would try to feed power to USB hosts like to a PC, so either that is just a schematic error and the diode is actually the other way around.Personally, since even the USB pins are zener limited from a 5V GPIO pins, I would not buy and plug this device to any PC. \$\endgroup\$
    – Justme
    Commented Aug 7, 2019 at 7:32
  • \$\begingroup\$ As @Justme stated, the device is a USB device. It is supposed to get power when plugged into a pc, so i still dont get why the diode is that way around. \$\endgroup\$
    – rrswa
    Commented Aug 7, 2019 at 13:48
  • \$\begingroup\$ @Justme the device does not appear to be just a USB device. It also has it's own power input for standalone operation. The diode exists to protect that power supply, and everything else on the board when it is plugged into USB. The USB specification has a higher limit of 5.25V, so could potentially damage the 5V on board regulator. The direction of the diode is fine, nothing wrong with it. \$\endgroup\$
    – Indraneel
    Commented Aug 7, 2019 at 16:57
  • \$\begingroup\$ @Indraneel but it is not USB host either, so why would it only feed power towards PC? On the product web page it reads it can be powered via USB or from external source, so it is quite clear that the diode is drawn incorrectly in the schematics or it would always require an external supply and backfeed the PC. \$\endgroup\$
    – Justme
    Commented Aug 7, 2019 at 18:18
  • \$\begingroup\$ @Justme you have a point. I didn't read the product page. If the product can be powered by USB, then the schematic is mislabeled. The diode is still required and correctly drawn, but the bus labelled 5V is connected not at regulator output, but at diode cathode at USB connector. Actually it is now 5V when on USB power, and 4.3V when on external power. The diode is not optional, unless one also wants to design in various short circuit and overvoltage protections. \$\endgroup\$
    – Indraneel
    Commented Aug 7, 2019 at 19:34

Just adding to @ircama's answer, D3 is incorrectly drawn in the schematic.

It has been thoroughly discussed in other forums, including Electronics Stack Exchange: Which way round should D3 go? and 5v vin on ATTiny85 with reverse biased Schottky diode?

That leaves @indraneel answer invalid regarding D3 orientation and function.

  • \$\begingroup\$ This is not an answer to the question. It is a comment to another answer. \$\endgroup\$ Commented Apr 7 at 11:39
  • \$\begingroup\$ True. Excuse my noob contribution, but I didn't have enough points to comment. I thought I should at least voice out that there was an incorrect answer. I was not allowed even to downvote. I just wanted to let others know, so they don't have to do as much research as I did to guess the right answer. \$\endgroup\$ Commented Apr 8 at 13:52
  • \$\begingroup\$ Hmm... then you made the right call. \$\endgroup\$ Commented Apr 8 at 21:25

The diode D3 makes sense if the board is powered from an external supply LESS than 5V. In that case, if D3 were absent, the board supply would bog down the USB power. When D3 is present, the power on the 5V marked net on the board will reverse bias it, if it is less than 5V.

However, f=if that supply is greater than, say, 6V, then the host is screwed, even with D3 in place in the polarity indicated.

  • \$\begingroup\$ It's also common to protect the voltage regulator with (schottky) diodes like this in case the board is powered from USB but not from the JP2 connector. 5V in reverse with no voltage on the input pin will kill most voltage regulators. More commonly the diode is placed anode from the output pin of the regulator to cathode on the input pin, in which case the regulator may survive. \$\endgroup\$
    – Lundin
    Commented Jan 15 at 15:36
  • \$\begingroup\$ I am not saying that what you say is wrong but note in Ircama's 2020 comment re how the board is actually manufactured in practice. D3 is reversed in practice on the board and the system would not function in their context without it being the case \$\endgroup\$
    – Russell McMahon
    Commented Jan 15 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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