Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

tolerance

Status
Not open for further replies.
Hi again,


Hero:
I'll have to keep that in mind next time i have to tune a circuit with resistors.
That looks like it should work pretty good.

Willbe:
Dilbert! Ha ha, that was a cool show! I wish it was still on, and making
new episodes.
 
Here are some curves to look at.
The blue is a single resistor, the red is two resistors in series,
the green is three resistors in series, and the violet is four in series.
The vertical axis is the percent of the population and the
horizontal axis is the tolerance.
Note how much better either of the curves are over the blue (single)
curve. For example, the blue curve shows that 50 percent of the
resistors have a 5 percent or better tolerance, while the red curve
shows that 75 percent of the resistors have a 5 percent or better
tolerance.
 

How did you do that graph?
 
Hi Willbe,


I used a program to generate 10 million experiments for each curve,
where the resistor values were generated using a uniform distribution
random number generator (values 9 to 11 ohms) and added them
in series. The tolerance was then calculated and binned into one of
100 bins, and the bins were added cumulatively to form cumulative
distribution curves for single, double, triple, and quad series resistors.
The results were printed to a file, then read by another program that
can plot data from the file, and that made the graphic in the form of
a bmp file. That was then converter to gif using another program.

What else is interesting is that all these results are obtained by chance,
where we would pick two resistors by chance. If we introduce a little
sanity into the mix in the form of purposeful selection, i think we could
get really good results.
For example, say we purchase 100 resistors and start measuring each ones
ohmic value, and bin each one as to its deviation from the mean. As soon
as we come up with a value that exactly matches the negative deviation
of one of the means we already found, we could bin those as a pair, and
that would form an almost perfect value resistor! For a quick numerical,
say we find three resistors, 9.4, 9.1, 10, and then one that is 10.6. The
dev's would be -0.6, -0.9, 0, and the last one is +0.6, and so we have
found one that is the negative of another, namely, the 9.4 and the 10.6,
and went we combine them into one, we get exactly 20 ohms. Of
course this does require the measurement of every single resistor, something
which might be a bit of a chore.

BTW, if you would like to do some of these programs i can give you
the program if you dont mind using a particular programming language
that i often use, or you could use the language of your choice with
a little modification. You could then look at your LED problems from
this point of view too if you like.
 
Last edited:
Yo! Mr. Al!

the resistor values were generated using a uniform distribution random number generator (values 9 to 11 ohms)
So each value is equally likely?

i can give you the program
As soon as I trash this computer and buy an Apple. Almost all new stuff I try to use gives me weird results, installs that crash halfway through, new pop-up screens, etc..

I figured out the problem with my spreadsheet; it was my (mis)understanding of the bin widths, center points and end points, a problem that doesn't happen with continuous distributions.
Now it seems to be pretty accurate at the end points.
 
Last edited:
Hi Willbe,


Yes, each value is equally likely.

The program is in the form of a text file, not an .exe file.
This means you can easily look at it and see that there is
nothing unusual inside it. It opens in Notepad or other
text editor like any other text file. A typical line
might look like this:

a=b+c

or

for k=1 to 10 do
a=a+1
end for
 
Hi Willbe,


Yes, each value is equally likely.

The program is in the form of a text file, not an .exe file.
This means you can easily look at it and see that there is
nothing unusual inside it. It opens in Notepad or other
text editor like any other text file. A typical line
might look like this:

a=b+c

or

for k=1 to 10 do
a=a+1
end for

Hi, Al. . .
Sure, post it.
I'm going to start writing subroutines that do what my spreadsheet does, and I can use the spreadsheet results to check my program output.
 
Hi again,


That's a good idea. I like to do that rather than depend on some other
program to do what i need.

Here is the program. It's not very long so i posted it here.

I was able to prove the results (after forming a cumulative
version of 'Boxes' below) by noting that each resistor lives in
its own uniform distribution, and when these two are added,
the result is a triangular distribution, and the cumulative distribution
of that triangular distribution is the red curve i posted previously,
and the formula for said cumulative distribution gives the same
curve.

Code:
include misc.e
include file.e
include get.e
include msgbox.e
include uppersort.e

printf(1,"%s\n",{""})

atom T,R

T=0.1
R=10

atom S1,T1,R1,R2,RT,Tx,Tsum

sequence Boxes
Boxes=repeat(0,101)

with trace


function abs(atom x)
  if x<0 then
    return -x
  else
    return x
  end if
end function

function RandResistor(atom R, atom T)
  --This functions distribution was tested.

  atom S1,T1

  S1=rand(1000)
  if S1<=500 then
    S1=-1
  else
    S1=1
  end if
  T1=rand(1000)/1000

  return R+S1*T*T1*R
end function

trace(1)

Tsum=0
for k=1 to 10000000 do
  R1=RandResistor(R,T)
  R2=RandResistor(R,T)
  RT=R1+R2
  Tx=(RT/(2*R))-1
  Tsum+=Tx
  if k/10000=floor(k/10000) then
    ?Tsum
  end if
  Tx=abs(Tx*1000)
  for j=1+1e-6 to 101 do
    if Tx<=j then
      Boxes[j]+=1
      if j=11 then
        ?Tx
        sleep(1)
      end if
      exit
    end if
  end for
end for

Tsum=0
for k=1 to length(Boxes) do
  printf(1,"%d\n",{Boxes[k]})
  Tsum+=Boxes[k]
end for
?Boxes
?Boxes/10000000
?Tsum

atom fno

fno=open("Report.txt","w")
print(fno,Boxes)
close(fno)


sleep(222)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top