Please keep in mind that I am very new to reading circuit diagrams, and electronics in general. I am interested in using V-USB to connect my AVR microcontroller to my computer via USB. On the V-USB website, the following sample diagram is given, and I have some questions.

enter image description here

  1. USB Pin1 to ATTiny VCC: Why is there a ground connection as well, and what purpose does C4 serve? Traditionally, I am used to connecting a wire running 5V to VCC, but not hooking that up to ground too. I thought the ground connection is made internally, because I am connecting the ground from the power supply (in this case, USB cable) to the GND pin of the microcontroller already.
  2. You see how C2 and C3 are connected via one line to GND? Would this be equivalent to connecting them individually as well? So the negative end of each capacitor would be running on its own to ground instead of meeting up, and then going to ground. Or is it depicted like this to save space in the diagram?
  3. What is the purpose of C1? Isn't it creating a short circuit? I don't understand why it is there if the loop from USB Pin4 to USB Pin1 (which has C1 in it) does not access any of the pins on the microcontroller. Does C1 still impact the overall circuit somehow?
  4. Why does D- have R3 and a voltage connection, whereas D+ does not?
  5. Is R3 meant to pull up D- to a high logic level when PD3 (on the ATTiny) is not providing any input? Why?

I know these are a lot of questions, but I need to overcome my fear of circuit diagrams. I think there is a fundamental flaw in my process of understanding them. I think of the lines as physical wires and think of current as little dots following the paths in diagram - childish, I know.

Thanks for your help, any advice in general about reading circuit diagrams would be awesome too.

  • 2
    \$\begingroup\$ A capacitor is a short circuit at high frequency, but open circuit at low frequency. Consider what C1 and C4 do to high frequency noise. Now how about a steady DC supply voltage? \$\endgroup\$ – Ben Voigt Aug 21 '12 at 20:28

Ground is where everything starts. If you have two unconnected circuits the voltages of one circuit mean nothing to the other one. So you choose one reference voltage on one circuit to connect to a similar point on the other circuit, and that will almost always be the grounds of both. When you've connected those the +5 V of one circuit will also be seen as +5 V by the other circuit. The ground pin of the controller needs that same connection so that the rest of the circuit will see the controller's high and low levels as high and low too.

C4 is a decoupling capacitor, and should be placed as close as possible to the controller's Vcc and ground pins. It's a small energy reservoir for when the controller would need very short power peaks, which otherwise would cause noise on the Vcc. Always use a decoupling capacitor for every IC in your circuit.

It doesn't matter how you draw them, the schematic shows electrical connections, and those will be the same however you draw them. In this case it gives the schematic a more clear look. But also indicates that the ground connections of the capacitors should be close together.

C1 filters the USB's +5 V. This is often very noisy, and C1 smooths that to a clean voltage. Also, like C4 it acts as an energy reservoir. The USB's +5 V may come from a few meters away, and C1 will cover changes in current which are too fast for the power supply at the other end of the cable.

4) and 5)
The pull-up resistor indicates to the host which transfer speed the microcontroller can handle, here the controller is a full-speed device.

  • \$\begingroup\$ Thanks a lot. I still have some questions, if you don't mind assisting me further. (1) I think I am beginning to understand the role of C4, but my question about why it is connected to GND on the IC remains. Why can I not connect it in a series connection with USB Pin1 and the IC's VCC? I am a little confused because whenever I have had to power my microcontrollers, the power supply's positive connection would go directly to VCC (given it's the correct voltage). I can now understand why a capacitor should be connected in the middle, but why ground too? What is the purpose of the IC's GND then? \$\endgroup\$ – capcom Aug 22 '12 at 11:54
  • \$\begingroup\$ (2) Regarding C1, I need to make sure I am understanding this correctly. Is C1 affecting the rest of the circuit? It looks like it is connected in parallel with the USB "power supply", so won't its activity just affect the current passing through it, and not the rest of the circuit? (3) Can D1 and D2 be placed on the line that contains C1 and have the same impact? I would imagine not because then they would only affect that loop as they would be in parallel with the USB power supply, but the rest of the circuit would still get 5V, right? Note: D1 and D2 are meant to drop the voltage to 3.6V. \$\endgroup\$ – capcom Aug 22 '12 at 11:57
  • \$\begingroup\$ If I am at all unclear with my questions, please ask me to illustrate them with a diagram. Thanks again Steven, and everyone else. \$\endgroup\$ – capcom Aug 22 '12 at 12:01
  • \$\begingroup\$ @capcom - the ground connections close the circuit loop: current from your power supply's + enters the uC via the Vcc pin, passes through a bunch of transistors and returns to the power supply's - via the uC's ground to which it connects. No closed loop = no current. C4 provides a similar, but physically shorter loop. C4 is charged to Vcc, and when the uC needs extra current for a very short time it draws this from C4, again it passes to the uC's ground, from where it returns to C4's minus connection. \$\endgroup\$ – stevenvh Aug 22 '12 at 12:01
  • \$\begingroup\$ @capcom - (2) a capacitor is a low resistance for high frequencies, so it won't affect DC, but will short-circuit high frequency noise, so that that has an immediate return path to the USB supply, without affecting the microcontroller. (3) do you mean C1 directly on pin 1 of the connector? That's possible, but the (small) resistance of the diodes form a low-pass filter with C1, and you want the filtering at the voltage level you want to use as Vcc. D1 and D2 are needed to get 3.6 V because that's the level of the D+ and D- USB lines the AVR has on its digital inputs. \$\endgroup\$ – stevenvh Aug 22 '12 at 12:10
  1. C4 is a decoupling capacitor, it removes noise. It works on the high-frequency noise. You should have small decoupling caps on all digital chips, close to them. See the data sheets for the parts for suggested values, often 0.1 uF to 0.01 uF.
  2. A schematic shows connections. All it is saying is C2 and C3 are connected to ground. It doesn't say if that is a single wire or two.
  3. C1 is also a decoupling capacitor. It works on lower frequency noise, for example that from a power supply. It complements C4. You should have this sort of part on all boards, but location isn't critical.

4 & 5. That pull-up is required by the USB spec. That's how the computer/host knows if it is low-speed or full-speed USB. If it were the other speed, the pull-up would be on D+.

  • \$\begingroup\$ Thanks! Some follow up questions: 1. Is C4 essential? I will use it, but I am wondering what the effect would be if I were to remove it. And isn't a decoupling capacitor already there (C1), why does there need to be C4? 3. Okay, it is a decoupling capacitor, but why is it there if it isn't connected to anything? There is nothing inside the circuit loop which contains C1. Well, I am sure it's there for a purpose, I just don't understand why. Could you kindly elaborate? Thanks! \$\endgroup\$ – capcom Aug 21 '12 at 20:40
  • \$\begingroup\$ @capcom: See updated answer. \$\endgroup\$ – Brian Carlton Aug 21 '12 at 20:49

C2 and C3 are the capacitors to support your crystal. It is fairly important to connect them as symmetrically as you can, and as close to described in the datasheet for your microcontroller as you can (both in terms of layout and the value of the cap for the given crystal). Every once in a while, if you stray too far, the clocking circuit won't work. By connecting both caps to the same ground point, you are helping yourself keep things symmetric. Don't route one of the caps to ground through a long convoluted trace and one through a short trace. Same with connections on the other side of the caps to the microcontroller. Some of my old designs really violated this and still worked, but doing it right is the best way to go.

Just because two points are "connected" through a capacitor, that doesn't mean that they are connected as if by a wire. A useful way to think of a capacitor (as a first approximation, not gospel!!) is as a short circuit (i.e., direct connection) for very high frequency signals and as an open circuit for DC (i.e., constant) signals. This means that high frequency disturbances can be sort of "shorted" to ground to get rid of them without impacting DC levels (and that's what's meant by "bypass").


A little bit more about the capacitors:

We have C1 and C4 in parallel because of different behavior of those capacitors at high frequencies. As others have said, the capacitors at high frequencies are a short, but that's only for ideal capacitors. In real life that capacitor also has leads which have inductance and resistance and there are internal loses in the capacitor too. For that reason, capacitors often have equivalent series resistance and equivalent series inductance as important parameters.

Usually capacitors with greater capacitance have greater ESR and ESL values which makes them less suitable for high frequency use. For that reason, it is common to use several capacitors in parallel with different values. When the integrated circuit switches, it needs large amount of current for a short time. The capacitor with smaller capacitance will be able to quickly respond to the change in consumption. The downside is that it doesn't have much power to provide to the consumer. The capacitor with higher capacitance (in this case C1) reacts more slowly than the smaller capacitor (C4), so C4 is there to provide power until power from C1 comes.

Another thing that affects how quickly a capacitor can respond is the shape of the conductors it is connected to since they have their own resistance, inductance and capacitance. That's why Scott wrote about symmetric connection, since in that case both capacitors will have same parasitic effects influencing them.

One more thing that is commonly seen is to have a decoupling capacitor close to the power connector of the device. The reason for that is again the parasitic effects but this time of the cable. The cable itself has its own resistance, inductance and capacitance that because of that, the cable can't quickly respond to changes in power consumption. To solve that problem, we place a capacitor right at the point where the cable connects to the PCB. SO in this case, C1 is both the decoupling capacitor at the cable and the bigger decoupling capacitor which works together with C4.

As for the open empty loop side of things, well that's how decoupling capacitors work in the first place. Once the capacitor is connected in parallel with a voltage source, it is charged by the source and after some time reaches the voltage of the source. When we have a sudden increase in power consumption and a non-ideal source, the charge from the capacitor will go out and provide power to the device and by doing that resist the voltage change for some time. Digital circuits have large power consumption only for a short time, so a relatively small capacitor will be able to provide it with power while it's switching. Take a look at this simulation. The green line is voltage at the capacitor. When you click on the switch and connect the consumer, you'll see how it slowly starts to drop and when you release the switch, you'll see how it starts to rise. That's how the decoupling capacitors work in general.

  • \$\begingroup\$ Thank you so much, absolutely fabulous answer! And thanks a lot for the link too, visual aids are invaluable. \$\endgroup\$ – capcom Aug 22 '12 at 12:37

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.