# Capacitors in DC circuits

I have a question about capacitors in DC (digital) circuits. The picture below is an edited schematic of the Arduino Uno R3.

The DTR line is connected to the reset input of the Atmega328 by a 0.1uF capacitor.

The capacitor is needed to initiate a load to the atmega flash memory through the USB -> UART. Why is this the case, everything I have been taught says "Capacitors block DC and let AC through"

All I see is something that can let AC noise through to the Arduino reset? I know its needed, I tested it. But why its needed, how it fulfils that function I have no idea.

• Possible duplicate of What is the cap for in Arduino reset circuit? Nov 10 '16 at 17:51
• Yes, capacitors block DC. But when there's a change from 0->5V or vice-versa, that isn't DC any more. The capacitor is charged/de-charged/reverse-charged, so there is a small current flow for a short time.
– Janka
Nov 10 '16 at 17:52
• @WesleyLee It is close to a duplicate. But that answer isn't so good and it doesn't cover Andy's problem with it, either. This circuit does deal with Andy's problem there. So an answer here would actually be useful, I think.
– jonk
Nov 10 '16 at 18:00
• @jonk -- fair points, I'll retract the flag but leave the URL just in case. Nov 10 '16 at 18:04

The Atmel datasheet, page 305, Section 29.5 "System and Reset Characteristics" provides some useful information for the reset pulse. It says that the worst-case minimum pulse width is \$2.5\:\mu\textrm{s}\$. It then goes on to say that the ramp rate has to be contained between two boundaries; no faster than \$10\:\frac{\textrm{kV}}{\textrm{s}}\$, but also no slower than \$10\:\frac{\textrm{V}}{\textrm{s}}\$. So there are some restrictions that should be managed by any reset system.

There are some nice reset circuit ICs available which provide a manual reset input as well as a control line. I'd probably use one of those about a circuit I cared about. Okay. Actually, I'd make my own out of a PIC10LF320 in a SOT-23-6, which also includes a brown-out circuit of its own, which I'd probably also re-purpose, as well.

But let's look at this circuit. DTR is normally held HIGH (I believe) and is pulled LOW in order to initiate a reset. Assuming that the two MCUs are running on different power rails (or the same, doesn't matter), \$C_5\$ is charged up to the difference between the ATmega328's rail (via \$RN_1\$ and the DTR output line's HIGH value.) If there is no difference, the voltage will be nearly zero. But if the rails are different, then there will be a small voltage across \$C_5\$ that represents this difference.

When DTR is pulled LOW, that end of \$C_5\$ is also pulled down to that voltage (close to ground.) For the first moments, this also means that the other side of \$C_5\$ is similarly pulled downwards, too. If there was some voltage rail difference, then that's the voltage that appears at the reset pin of the ATmega328. Depending on the voltage differences between the MCUs and the reset pin requirements of the ATmega328, this could be a problem. The datasheet says that it may be required to be as low as \$600\:\textrm{mV}\$, though the typical only requires to be pulled down to \$1.3\:\textrm{V}\$. But if no difference in the rails, then hopefully near-ground appears at the reset pin of the ATmega328. I'm going to assume there is no difference, here, so that we at least have a good chance it works okay.

Now, as soon as \$C_5\$ is yanked down by DTR, \$C_5\$ begins charging up through \$RN_1\$, starting at a rate of about \$500\:\mu\textrm{A}\$. The time constant is \$1\:\textrm{ms}\$. So the voltage will rise rapidly. Assume that we only just barely achieved the required \$600\:\textrm{mV}\$ at the start (the capacitor held a slight charge.) Then we'd cross over the minimum rising threshold of \$1.1\:\textrm{V}\$ within about \$100\:\mu\textrm{s}\$. This is well more than long enough for the earlier mentioned minimum reset pulse width of \$2.5\:\mu\textrm{s}\$. So the spec is met here.

Now, let's go the other direction. Let's say that now DTR is held LOW for a long enough time that it charges up to about \$5\:\textrm{V}\$ through \$RN_1\$. Now, DTR is driven HIGH. What happens? Well, the other side of \$C_5\$ will now be at about \$10\:\textrm{V}\$ (the \$5\:\textrm{V}\$ charge on \$C_5\$ added to the DTR HIGH voltage value.) This is rapidly discharged, safely, via \$D_2\$. That's why \$D_2\$ was added. Otherwise, this voltage would be presented to the RESET pin of the ATmega328 and would have to be discharged via any internal protection diodes present there (which may themselves have additional specifications that must be met.)

What's interesting here is that the RESET pin in particular is called out in the datasheet on page 299. It says that it can support up to \$13\:\textrm{V}\$ worst case. So, technically, that might mean that \$D_2\$ isn't necessary to avoid driving protection diodes in the CPU. But it is still a good idea for an entirely different reason. This is to discharge \$C_5\$ rapidly (it would be very slow, via \$RN_1\$), so that it can be used for another reset very soon after being used.

Note on the reset pin:

As Majenko added in a comment, there is a high voltage programming mode for Atmel devices like this. I frankly don't fully apprehend it, as I haven't read a datasheet on the topic. But I did find out from an Atmel video that the PC6/RESET line, which normally acts like a /RESET line, can be changed into operating like a general purpose I/O port by changing the RSTDISBL fuse, which makes the general I/O function available. The bad thing about that is that the ISP programming mode NEEDS the /RESET line to do its job. So you can't program the device anymore, if you set up that fuse. This then forces you to use the parallel programming mode that is entered using the high voltage programming mode. I would guess that entering this mode uses the /RESET pin again, but this time places a high voltage on it that is detected in order to put the device into its parallel programming mode instead of the ISP programming mode.

I can't readily find a specific programming document on the details of using this mode to program their devices. Microchip publishes them. But it appears, cursory examination only, that Atmel does not. They document how to use the mode with their tools, such as the STK500 (which I have.) But not how to design your own tool. I'm guessing, for now, that this is a matter of non-disclosure for Atmel. And given that they have it available for so many different devices, I can see why they might want to avoid having to support it.

The details on this pin are starting to get complicated-sounding. But pins cost money and silicon is cheap. So Atmel, like other companies, try to come up with methods to use their scarce pins to provide as much versatility as they can to sell devices.

That's it.

• The problem with allowing a +10V spike on the RESET pin is that a high voltage (say 10V) on RESET is used to initiate HVP mode (High Voltage Programming). The diode is not there so much to protect the pin as to prevent HVP mode ever being accidentally entered.
– Majenko
Nov 10 '16 at 20:58
• @Majenko Thanks. I was just quickly scanning the sheet and could have read further on. Yes, that's about the right voltage for what I recall with PIC programming on the old PIC16C parts "back in the late 1980's," so I might have guessed.
– jonk
Nov 10 '16 at 21:01
• @Majenko Can you provide a page reference that discusses this programming mode for the PIN? Is this the RSTDISBL Fuse thing? I just can't find the exact programming specs in the datasheet. So I'm guessing it is elsewhere. Would appreciate a reference. I'll include it in my answer, if available.
– jonk
Nov 10 '16 at 21:06
• Not off hand, though I can probably find one. I knew it as a hunch like you from PIC programming, and did a google image search for "ATMega328P High Voltage programming" which gave me images of the wiring and pinouts used for HVP, including, on some, the voltage of the RESET pin.
– Majenko
Nov 10 '16 at 21:08
• @Majenko Thanks. Got it. I think I now understand it. I just listened to an Atmel video. It helps.
– jonk
Nov 10 '16 at 21:10

The capacitor C5 and resistor RN1 are used to TEMPORARILY apply RESET to the microcontroller chip during power-up. It assumes that C5 is discharged and will conduct the "AC" (change from 0V up to 5V) until it becomes fully charged and releases the reset line so that the microcontroller can start up properly.

You can use this online calculator to see the time-constant for any given resistor and capacitor: http://www.referencedesigner.com/rfcal/cal_05.php

When the circuit is first powered up, C5 holds the microcontroller -RESET line LOW (the active state) until C5 charges up through RN1. At that point RN1 holds the -RESET line HIGH which releases the microcontroller to start up in an orderly manner.

It is not clear exactly what is happening between the U3 DTR pin and the junction of C5/RN2. There is a label that says "LED3 Yellow", but there is no symbol for a LED or any other component there. But there is typically a way for an external device to apply a reset also, so that you can re-program the microcontroller, and that is likely what is happening there.

• Could you discuss the diode D2 in the circuit and how it helps regarding the use of C5? I was hoping a full answer would include that detail here.
– jonk
Nov 10 '16 at 18:07
• I believe D2 is provided to protect the reset input of the microcontroller from any possible reverse-polarity voltage. Nov 10 '16 at 18:09
• If possible that would be good, I have always left the Diode out, and wondered its use.
– Danny J
Nov 10 '16 at 18:15
• Hmm. Assume DTR is held LOW for a while. What does RN1 do to C5 then? What then happens if DTR is yanked high?
– jonk
Nov 10 '16 at 18:15
• So C5 drops low momentarily when RTS is pulled low. Following the time constant it is recharged by Vcc through RN1, giving the momentary reset needed to programme the Atmega flash. Sound right?
– Danny J
Nov 10 '16 at 18:17