Impedance matching - Page 1
Forum section: electronics / beginners

author: Starlord
author_rank: Frequent Contributor
timestamp: April 15, 2017, 05:37:52 am
content: I was reading up on Neopixels the other day and I cam across a very interesting and detailed post about impedance matching on Adafruit's forums:https://forums.adafruit.com/viewtopic.php?t=51153QuoteMy question is, if the effective output impedance of the Atmega's pin is about 125 ohms, would the ideal value resistor at the Neopixel / mosfet / whatever end, also be 125 ohms?And if so, why in their Neopixel tutorial, do they suggest a 300-500 ohm resistor instead?https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practicesIt seems like you would want the closest value if only so you get the cleanest edge.Also, how DOES this affect the edges? I would assume a resistor in series would cause the edge to be less sharp, but I also would not have believed a 5V input into a long wire would result in much more than 5V at the other end, so I don't know what will actually happen. Although being somewhat familiar with inductors for use in boost regulators, I should probably have realized this might be a thing, but apparently it's not even something you can pick up on an entry level scope.

author: Zero999
author_rank: Super Contributor
timestamp: April 15, 2017, 09:03:46 am
content: It sounds like someone's confused here.A MOSFET's gate doesn't need to be impedance matched to the source. Normally the gate resistor is fairly low and is only there just to damp and oscillation caused by the parasitic inductance. If the MOSFET is driven at high speeds, via a long length of cable, then transmission line effects could be a problem, but in this case it's only switching LEDs, so the MOSFETs don't have to switch that quickly and there's no need to worry about transmission line effects. The 125R output resistance of the IO pin should be more than enough to dampen any resonances in the cable.

author: eb4fbz
author_rank: Regular Contributor
timestamp: April 15, 2017, 11:26:38 am
content: That's called a damping resistor. It has little to do with impedance matching in constant impedance transmission lines.

author: Dave
author_rank: Super Contributor
timestamp: April 15, 2017, 11:44:43 am
content: The output resistance of ATmega328 is around 25R, not 125R (at 25°C). You need to look at how much the output voltage on the pin drops with respect to current draw, not what supply voltage you're using. Adafruit Mike needs a lesson or two before he starts giving his own.

author: Zero999
author_rank: Super Contributor
timestamp: April 15, 2017, 12:10:49 pm
content: Quote from: Dave on April 15, 2017, 11:44:43 amThen it looks like you need to add a resistor. 25R will not be enough to damp the resonance of a long cable. Try 47R for a starting point.

author: radiogeek381
author_rank: Regular Contributor
timestamp: April 15, 2017, 01:46:39 pm
content: The responses are all on target.1. This isn't about "impedance matching" -- unless the transmission line between the driver and the FET is long, and you really need fast edge rates, who cares about the "efficiency" of power transfer? And, in any case, most designers work to the impedance of the transmission line, not the driver. (See #5 below.)2. Under no circumstances would a prudent designer assume "40mA" for the output current. That is the figure in the "Absolute Maximum Ratings" table (page 313 of he atmega datasheet) While daring folks might chose to push the drive capability, I generally hew to the charts -- notice that Figure 31-353 tabulates Vol vs. Iol from 0 to 20mA. That's a hint that they want you to design in that range. (and remember that the figure is a guide, not a spec -- these are typical numbers...) Figure 31-71 and 31-353 suggest that the "drive" impedance near the rails is about 30 ohms or so.3. Unless designed for the purpose, most FET output drivers are NOT constant impedance. But who cares?4. How long a line do we have to have beforeIwould care? Assuming a 30pF load (which could be low, could be high...) and "constant" current from the output of 10mA (unlikely) we get a rise time greater than 10nS. Is your line longer than half a meter? If so, why? And if all we're doing is lighting an LED, why does the reflection matter?5. If the line is very long, and if you care about reflections, then by all means do some kind of termination. I'm partial to series termination at the source. But here, again, the termination resistor value is set by the impedance of the transmission line, not of the driver. To a first order, the transmission line impedance is 4x the driver impedance, or larger. A 12 mil wide trace might be in the neighborhood of 100 ohms. This dominates the driver impedance, in our simplified model, and suggests a source termination of 80 to 120 ohms more-or-less. The result would be a "half-step" wave that propagates down to the apparently open-circuit FET termination, where it would then be reflected back to complete the swing at the terminator. For a 1m long line (how big is this PCB?) against a 10nS rise time, this won't make a flea's burp worth of difference.6. Finally, note that the datasheet doesn't specify a Trise/Tfall for the general outputs. (I'm using this:http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdfas my source.) That's another hint. This chip isn't meant to be driving fast edges (other than the SPI signals, perhaps) and they aren't willing to provide a spec. That makes a lot of sense. As a chip designer, I don't want to commit to something that is of little value to most of my market and that might proscribe solutions to as-yet-unseen production problems. (Output cells are deceptively complicated. In CMOS processes an output driver can be among the most complex sub-circuits on the chip.)

author: edavid
author_rank: Super Contributor
timestamp: April 15, 2017, 04:06:49 pm
content: Quote from: radiogeek381 on April 15, 2017, 01:46:39 pmThey are not talking about driving a bare LED, but an LED driver IC with a high speed serial interface. It is also common to have a fairly long cable between the controller and the LED assembly. So, there is a possibility that termination would be required.

author: Cerebus
author_rank: Super Contributor
timestamp: April 15, 2017, 06:30:08 pm
content: Quote from: edavid on April 15, 2017, 04:06:49 pmFor reference the 'clock rate' on the WS2812 input line is 1.25us+/-600ns and it's a schmitt trigger input (leastways the data sheet has a hysteresis specification for the inputs of 0.35V). So we are not talking blazing fast here.

author: edavid
author_rank: Super Contributor
timestamp: April 15, 2017, 06:56:40 pm
content: Quote from: Cerebus on April 15, 2017, 06:30:08 pmThe logic 0 pulse width has to be 200-500ns:https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/So not blazing fast, but not impossible to get into trouble either.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 15, 2017, 07:34:42 pm
content: The quoted OP doesn't understand transmission line theory, and only knows enough about impedance matching to be dangerous.1. Most MCUs don't transition in fractions of a nanosecond. If this is an ATmega Arduino we're talking about, it's more like 5ns. Still more than fast enough to get into trouble with, but that's hard to achieve on 30cm runs.2. For an instantaneous step, the pin driver's output resistance (which is actually like 50 ohms, but more exactly, about 70 ohms pulling up, 40 ohms pulling down) divides into the transmission line impedance. For a 100 ohm line, this is around 2/3 Vcc.So we launch a wave front of 2/3 Vcc down the transmission line. One electrical length later, this wave arrives at the "load". (Which was never intended to be, and cannot be, a "load" in the RF sense!) It reflects off the load (because it has a high impedance, give or take the phase shift from its capacitance), and returns to the source.3. When the wave reflects, it superimposes on itself. The transmission line is charged to 2/3 Vcc, and a wave of 2/3 Vcc now launches from the far end. The line charges to 4/3 Vcc. It overshoots.If we have input protection diodes on the load, it will clamp this overshoot (this isn't really desirable, but it can happen). In that case, current is drawn from the transmission line, and somewhat less than 4/3 Vcc propagates back.4. When this new level reaches the transmitter pin, it continues to transmit as a Thevenin source, but instead of a divider into ground, it's a divider into -- whatever level is on the line now, namely, 4/3 Vcc. Current is drawn out of the transmitter, and ((2/3)(1 - 4/3) + 1) = 10/9 Vcc reflects back again.Now, some overshoot can be useful when the transmission line is long and lossy, but you shouldn't count on quite this much overshoot as a normal thing. You usually plan to source-terminate the transmitting pin with 33-100 ohms, to prevent overshoot in most situations.5. This was for a point-to-point link. What if you have many loads along a linear bus? Well... each one sees the transmission line's levels, over time. Only the terminal load jumped from 0 right to 4/3 Vcc in an instant. For all other points on the line, all intermediate levels are seen: 0, 2/3, 4/3, 10/9, etc. This makes the risetime look lumpy, and can cause multiple clock events on input pins, screwing up your data.Incidentally, this circumstance -- source terminated transmission lines -- is what limited Ye Olde PCI bus to a certain number of slots along the length of the motherboard, and a maximum clock frequency of only 66MHz.Tim

author: DimitriP
author_rank: Super Contributor
timestamp: April 15, 2017, 07:44:38 pm
content: QuoteIf the post had started with "Adafruit Mike", I would have stopped reading sooner...