Transformer Ratio Design Tip - Page 1
Forum section: electronics / beginners

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 12, 2016, 08:39:14 pm
content: This is sort of a beginnery thing:Transformers can only be designed for rational turns ratios. That is, you can't have sqrt(2) or pi turns ratios, only 1:2 or 57/64 and such. Often, you need to wind one for an irrational ratio: the most common case being impedance matching, where the turns ratio is sqrt(impedance ratio).Suppose you need to match a 50 ohm transmission line to a pair of 50 ohm transmission lines wired in series: 100 ohms, as seen by the transformer. (This is called a 180 degree splitter or hybrid.) The impedance ratio is (100/50) = 2, so the voltage/turns ratio is sqrt(2) ~= 1.4142... RF transformers need to be wound with the smallest possible number of turns (because wire length limits the upper frequency range), so it would be nice to find the smallest number that gives an accurate ratio.Well... an irrational numbercan'tbe expressed as a rational, but we can try and get close. Let's say the matching needs to be within 10% (which means the turns ratio has to be within 5%). How do we find a ratio? We can brute-force it by incrementing the numbers in (p/q) until the ratio gets close enough, but that's tedious (though, a good way for a computer program!).Is there a better way? Certainly! We can find all* the best points, that we'd get with a brute-force method, using fewer steps in a smarter approach.(*I don't think this is actually true, but there's a theorem about it that relates to this.)Here's the procedure. Grab a standard (non-RPN) calculator and enter the desired number (to an adequate number of decimal places, or compute it first). If the number is < 1, take its reciprocal (hit 1/x). Then repeat:1. Subtract the integral part (everything left of the decimal); write down this number.2. 1/x3. GOTO 1You don't need to loop forever of course, but what you are doing is creating a continued fraction. Each number you subtract off, is another factor into the ratio you'll produce. And at each step of the way, you're getting more and more accurate. For 5% accuracy, you don't need more than about 1/sqrt(5%) steps, or thereabouts.Or, if you happen to get an integral part that's rather large (like 5 or 10 or more), that means the previous step produced a pretty accurate subtraction, and you'll have a pretty good result stopping there. Because, when you're subtracting 5 from a remainder in the range of [0, 1) (average 0.5), then you have a 10% match, in that step alone -- which goes on top of the accuracy already achieved by the previous steps!To compose the transformer ratio, simply reverse the process:Enter the last integer1/x+ (2nd-last integer)1/x+ ......1/x+ (1st integer)= Done!If you follow this process through, on paper (or using an exact calculator), so you get the fraction (p/q) rather than its decimal value, you'll note that each integer alternates between multiplication and addition, and contributing to p or q. The result is that, as you spin off more integers, (p/q) gets closer to the original number.Worked examples:sqrt(2) for the original example. As it happens, the continued fraction expansion starts with 1 (because 1.414...) and goes on infinitely, producing 2 (doing this on a real computer will eventually discover rounding errors, but all irrationals actually have a repeating sequence in this form!). So we can pick ratios of:1 + 1/(2) = 3/2 = 1.51 + 1/(2 + 1/(2)) = 7/5 = 1.41 + 1/(2 + 1/(2 + 1/(2))) = 17/12 = 1.41666...and so on.5:7 turns ratio isn't too bad, so we might settle for that. In a pinch, 2:3 isn't even too bad, giving a +12.5% impedance error.Small ratios are also practical to build using transmission line transformer designs that don't have upper frequency limits. Large ratios get unwieldy though, especially with lots of prime factors, like 5, 7 and 17.Example 2:A vacuum tube amplifier might need an impedance ratio around 6600:8, or a turns ratio of 28.72... A ratio of 28:1 or 29:1 is pretty good, but the high impedance will end up needing quite a lot of turns (a few thousand), so we might as well calculate up to that point and see how accurate we can get!28, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 2, 1, 56, ...These give:282986/3115/4201/7316/11517/182384/83 (this is probably reasonable for a real transformer of this type)2901/1015285/184(more is probably not practical; 5000 turns is a lot of winding!)Example Fun:What if we do pi? We can continue-fraction that quite easily, sure:3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, ...No, there's no pattern in this case: pi is transcendental. (Irrational (algebraic) numbers do have a repeating fraction.) You can see 7, 15 and 292 are pretty damn good steps (the next best is 84, a dozen or so steps later). These correspond to, guess which ratios? Let's write them out...3 = 3/1 = 33 + 1/(7) = 22/7 = 3.142857...3 + 1/(7 + 1/(15)) = 333/106 = 3.141509...Which isn't bad already!The famous ratio 355/113, high by only 85ppb, is produced by this series:3 + 1/(7 + 1/(15 + 1/(1))) = 355/113 = 3.1415929...The next better ratio takes many more digits:3 + 1/(7 + 1/(15 + 1/(1 + 1/(292)))) = 103993/33102 = 3.1415926530... (-0.18ppb)Tim

author: IanB
author_rank: Super Contributor
timestamp: March 12, 2016, 08:53:56 pm
content: I've often found it convenient to set this calculation up in a spreadsheet. Much less tedious than doing it by hand on a calculator, and gives instant results.

author: orolo
author_rank: Frequent Contributor
timestamp: March 12, 2016, 11:22:49 pm
content: Beautiful mathematics. Anyway, with a little brute force is it not easy to find the best approximations to a given limit?If you want to approximate a number x by a fraction a/b, you are looking for a = b*x, and the best approximation is a = round(b*x). So you can scan all the candidates in O(n) time and memory, with an algorithm like this:Code: (Python)from math import *from fractions import gcdx = sqrt(2)limit = input("Denominator limit: ")fractions = []for n in range(1,limit+1):num = round(n*x)eps = abs(x - (1.0*num)/n)if (gcd(num, n) != 1): continue # Remove equivalent fractions.fractions.append([eps, num, n])result = sorted(fractions, key=lambda f : f)total = input("How many fractions? ")print "Best %d fractions in order:" % totalfor n in range(0, total):print "%d / %d (error = %.10f)" % (result, result, result)For sqrt(2), we get:Code:Denominator limit: 30How many fractions? 10Best 10 fractions in order:41 / 29 (error = 0.0004204589)24 / 17 (error = 0.0024488565)17 / 12 (error = 0.0024531043)31 / 22 (error = 0.0051226533)38 / 27 (error = 0.0068061550)27 / 19 (error = 0.0068390692)37 / 26 (error = 0.0088633607)7 / 5 (error = 0.0142135624)10 / 7 (error = 0.0143578662)33 / 23 (error = 0.0205690463)As expected, the continued fractions give the best results. A very interesting electronics use of continued fractions (the other I know about is in filter design.) Many thanks for the idea!Just for the lulz, in the pi approximation:Code:Denominator limit: 1000How many fractions? 10Best 10 fractions in order:355 / 113 (error = 0.0000002668)2818 / 897 (error = 0.0000095990)2862 / 911 (error = 0.0000099809)2463 / 784 (error = 0.0000110209)2507 / 798 (error = 0.0000113564)2108 / 671 (error = 0.0000129218)2152 / 685 (error = 0.0000131858)1753 / 558 (error = 0.0000155927)1797 / 572 (error = 0.0000157380)1442 / 459 (error = 0.0000195468)Zu's fraction for pi isthatgood!

author: IanB
author_rank: Super Contributor
timestamp: March 13, 2016, 12:16:52 am
content: But you need something a little more systematic than brute force if you want to find out that \$\pi\$ can be approximated by 245850922/78256779.

author: The Electrician
author_rank: Frequent Contributor
timestamp: March 13, 2016, 01:03:07 am
content: Quote from: T3sl4co1l on March 12, 2016, 08:39:14 pmYou missed one: 1867/65Quote from: T3sl4co1l on March 12, 2016, 08:39:14 pmThe next better ratio is 52163/16604, not 103993/33102.

author: The Electrician
author_rank: Frequent Contributor
timestamp: March 13, 2016, 02:03:23 am
content: Quote from: orolo on March 12, 2016, 11:22:49 pmThe idea is to find approximations with smaller denominators, not larger:Code:355 / 113 (error = 0.0000002668)333/106 (error = -0.0000832196)311/99 (error = -0.0001785122)289/92 (error = -0.0002883062)267/85 (error = -0.0004161832)245/78 (error = -0.0005670132)223/71 (error = -0.0007475832)201/64 (error = -0.0009676542)179/57 (error = -0.001241782)

author: The Electrician
author_rank: Frequent Contributor
timestamp: March 14, 2016, 06:32:51 pm
content: There's a very detailed write-up on how all this works at:http://www.americanscientist.org/issues/pub/2000/7/on-the-teeth-of-wheels/1The link above is no longer working. The paper can be found here:http://bit-player.org/wp-content/extras/bph-publications/AmSci-2000-07-Hayes-gears.pdf

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 18, 2020, 10:47:46 pm
content: Oh hey, remembered this thread in my post history, and I have an update on the subject -- I've automated the algorithm here:https://www.seventransistorlabs.com/Calc/Frac.htmlWe now return you to your regularly scheduled eternal thread slumber, etc.Tim

author: gbaddeley
author_rank: Regular Contributor
timestamp: February 19, 2020, 01:27:46 am
content: Unless you need high precision, getting the turns ratio to within 1% is good enough. Errors in the source and load impedances and losses in the transformer are quite often more than 1%. However, the posts are an interesting mathematical exercise.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2020, 02:50:57 am
content: Yeah the most useful application, to me, is when the number of turns is constrained, like in RF transformers where the winding wire length is a transmission line length, which sets limits on bandwidth (LL and Cp). Here you prefer a thick core (high A_L) and least turns. So you pick the smallest convergent that gives acceptable accuracy.Typical example: 50 to 75 ohms, or 50 ohms to 25 or 100 (turns ratios of sqrt(1.5) = 1.2247... or sqrt(2) ~= 1.4142...). These aren't very friendly irrationals, so you tend to need a fair number of turns to get a reasonable ratio (e.g. 7/5 = 1.4 ~= 1.4142...).Tim

author: ArthurDent
author_rank: Super Contributor
timestamp: February 19, 2020, 03:19:16 am
content: Where I used to work they made instrument transformers to measure current going through high tension lines. The smaller transformers were toroidal ‘donuts’ with the current carrying conductor going through the center of the transformer and the ratio was determined by the number of turns on the core (secondary). Sometimes these ratios didn’t work out quite right so one of the engineers came up with an idea which he patented. Say you needed 50.5 turns to get the ratio you needed. What was done was the secondary was wound with two windings, one with 50 turns and another with 51 turns and these were put in parallel to give the equivalence of 50.5 turns. It might be a little more inefficient because of the small difference in voltage between the two windings, but it was simple. Of course these are line frequency iron core transformers and not R.F. but it illustrates another way to get odd ratios.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2020, 03:27:13 am
content: Uhhh yikes! That's not how that works!Erm, if you mean "in parallel" as in feeding a common burden resistor, with resistance between windings, or not actually on the same core, that will work however.Possibly the windings had enough resistance to begin with, that external resistors weren't needed.In any case, that sets up a circulating current of one turn over, whatever the impedance of that loop is. Which acts in parallel with the burden resistor (if this is all connected normally). So it's like getting 50.5 turns but you get a burden resistor that's 2% lower than you thought (say if the windings are ~25 ohms each and the burden is 1 ohm).Tim

author: Wimberleytech
author_rank: Super Contributor
timestamp: February 19, 2020, 03:32:14 am
content: Hmmm...I checked out at NON-RPN...lol

author: ArthurDent
author_rank: Super Contributor
timestamp: February 19, 2020, 04:42:51 am
content: Quote from: T3sl4co1l on February 19, 2020, 03:27:13 amThere were indeed 2 secondary windings wound together turn by turn on the same core with the ends of the secondaries connected together and no resistors other than wire resistance in the secondaries. Like I said, losses were a little higher but it worked. That is also basically the description you gave of the variac where you have one or more turns connected to the same point (through the graphite wiper). The patent dated from the 1940s or 1950s and I don't know of any production transformers ever being made.There have been other schemes including one described in this patent from HP called "Transformer providing half-turn secondary windings".https://patents.google.com/patent/US3768055A/en.