Author Topic: Fun with resistors  (Read 28281 times)

0 Members and 1 Guest are viewing this topic.

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Fun with resistors
« on: August 12, 2015, 12:03:22 am »
Hello everybody,

I'm not really an electronics engineer. I'm a hobbyist in electronics but i'm a software-engineer as well. Lately I needed to develop an android application, so I installed Qt Creator and all associated android dev-tools on my system.
To get started I decided to develop a small program that I had mind for a long time.
It allows you to synthesize a resistor-circuit based on a given value and the number of resistors to use:
Really funny results can be achieved by constraining the minimum and maximum allowed value to be used. If, for example, you only have 4k7 resistors but you need a 1234.5678 ohm value, you could do something like this:   ;)
I know this is just an academic exercise, but if there is interest in the binary or code:
At https://github.com/theageman/rfun/releases you can get both!

Greetings, Olli!

EDIT:
I started this project in C++/Qt/QML. But I changed it to Delphi XE2 later in the process.
To get the latest version, please have a look at https://github.com/theageman/rfun/releases.
The most recent version at the moment is here : https://github.com/theageman/rfun/releases/tag/0.25.
Have fun,
Olli.
« Last Edit: September 03, 2015, 04:12:30 pm by theageman »
Jazz is not dead, it just smells funny
 
The following users thanked this post: Cliff Matthews

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #1 on: August 12, 2015, 12:14:58 am »
Heh, cool :-+

Would it be possible to add tolerance calculation to that?  That is, assuming each resistor is maybe 3 sigma = rated tolerance (+/- 5%), and adding up the total for the derived network.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #2 on: August 12, 2015, 12:19:06 am »
I think that should not be a real problem (if I get the maths right).
Is there a paper out there regarding that subject?
Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #3 on: August 12, 2015, 12:52:33 am »
You're evaluating an expression, implicitly or otherwise, as you produce the correct value; you need only keep a second expression which contains the derivative.  More math than circuits, at least(?).  I'd have to scratch on some paper to see what the correct formula is (per stage or holistically).

Important note: tolerance is the derivative divided by the nominal value, hence unitless.  The derivative doesn't change for resistors in series, but the tolerance does.

There's also the issue of dependent versus independent; all the derivative contributions need to be summed as RMS, not just added.  And all resistors need to be assumed as independent, so you can't just push in the same derivative and have it come out right (which would give the same total tolerance as rated, which is intuitively wrong).

Worst case max/min might be interesting too, but probably not very useful.

By the way, what method are you using to generate networks?  If it's straight approximation (add until high enough, parallel until low enough, repeat until within spec), it's guaranteed to terminate but not to be optimal.  Not sure what would do that, exactly.  Probably a tree search starting from the final value (which is either composed of series or parallel, which are composed of...), and finding the path of descent along that tree which gives all values within tolerance.  Hmm, that still might not be very fast, there's no obvious way to choose a unique path.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #4 on: August 12, 2015, 01:29:46 am »
You're evaluating an expression, implicitly or otherwise, as you produce the correct value; you need only keep a second expression which contains the derivative.  More math than circuits, at least(?).  I'd have to scratch on some paper to see what the correct formula is (per stage or holistically).

I just asked Wikipedia about 3 sigma ;) (just briefly flew over the presented article)
Standard deviation seems to be the topic.
Give me a few days... ;)

Important note: tolerance is the derivative divided by the nominal value, hence unitless.  The derivative doesn't change for resistors in series, but the tolerance does.

Very interesting!

Worst case max/min might be interesting too, but probably not very useful.

Well, that's the easiest thing to implement

By the way, what method are you using to generate networks?  If it's straight approximation (add until high enough, parallel until low enough, repeat until within spec), it's guaranteed to terminate but not to be optimal.  Not sure what would do that, exactly.  Probably a tree search starting from the final value (which is either composed of series or parallel, which are composed of...), and finding the path of descent along that tree which gives all values within tolerance.  Hmm, that still might not be very fast, there's no obvious way to choose a unique path.

Tim

Sorry, I planned to include some information about the algorithm. (i will write a paper about the implementation in a few days).
Basically we are talking about two algo's, one data-structure and one (designed) limitation here.
The limitation:
There are two operations (|| = parallel, + = serial combination).
So you can say R = R1 || R2 + R3, for example. But this gets evaluated from back to front, so in reality you get R = R1 || (R2 + R3).
The limitation in this app is, that you can't set parantheses in the expression. Everything gets evaluated from back to front.
This limitation leads to the data-structure used:
Just a simple list of:
Code: [Select]
struct entity {
double value;
Operation op;
}

The algorithm used to find a solution works recursivly (pseudo code):
Code: [Select]
double findCombination(double value, double currentError, double min, max etc.)
{
  // serial combinations
  for (resistor=min; resistor<max; resistor++)
  {
      idealValue = value-resistor;
      actualValue = findCombination(idealValue, err, min, max)
      calc err
      if newMinium(err) store result...   
  }
  // parallel combinations
  for (resistor=min; resistor<max; resistor++)
  {
      idealValue = (value*resistor)/(value-resistor);
      actualValue = findCombination(idealValue, err, min, max)
      calc err
      if newMinium(err) store result...   
  }
}



I hope that this makes at least a little sense ;)

Greetings, Olli.

Jazz is not dead, it just smells funny
 

Offline slateraptor

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: us
Re: Fun with resistors
« Reply #5 on: August 12, 2015, 03:18:03 am »
Struck me as relevant to the discussion:
Combining Multiple Resistors to Improve Tolerance - P. Oliveira

TL;DR summary: Assuming identical resistors and normal distribution, tolerance of the Thevenin-equivalent resistor network is proportional to the inverse root of the number of resistors used...relative to specific manufacturer bias, not nominal value.

EDIT: Goofed the URL tag...fixed.
« Last Edit: August 12, 2015, 03:19:59 am by slateraptor »
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7549
  • Country: 00
  • +++ ATH1
Re: Fun with resistors
« Reply #6 on: August 12, 2015, 03:53:14 am »
Olli, great tool, thanks !  :-+

Is it possible to build it as "portable" version ? So no setup hassle and can be run just from a single EXE file.

Offline TiN

  • Super Contributor
  • ***
  • Posts: 4543
  • Country: ua
    • xDevs.com
Re: Fun with resistors
« Reply #7 on: August 12, 2015, 04:31:02 am »
Perhaps add tempco calculation too, but that would need ability to add tempco value to each resistor in array.
Would be nice tool for volt-nuts then.  :popcorn:
YouTube | Metrology IRC Chat room | Let's share T&M documentation? Upload! No upload limits for firmwares, photos, files.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19841
  • Country: gb
  • 0999
Re: Fun with resistors
« Reply #8 on: August 12, 2015, 09:35:04 am »
How about making a program for potential dividers using more than three resistors?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #9 on: August 12, 2015, 10:21:41 am »
For thermistors, this is the (exact) solution for a given thermistor, one resistor in series, and one resistor in parallel.  (Obviously, an arbitrary network could be solved for a limited set of resistor values, but that would be hard. :) )  Or inductors (not that you usually have inductors of very well known value and tempco), or reciprocal for capacitors (which was the original problem I had encountered).
http://seventransistorlabs.com/Calc/Tempco.html

Ed: for two resistor combinations (single and ratios), there's:
http://jansson.us/resistors.html
I also have a divider calculator which may be of interest, http://seventransistorlabs.com/Calc/ResDiv.html

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #10 on: August 12, 2015, 02:09:17 pm »
Olli, great tool, thanks !  :-+

Is it possible to build it as "portable" version ? So no setup hassle and can be run just from a single EXE file.

As soon as I get the static QT libs installed and linked, this should be a single exe.

Perhaps add tempco calculation too, but that would need ability to add tempco value to each resistor in array.
Would be nice tool for volt-nuts then.  :popcorn:

Perhaps I should split this application into a synthesizing and an analizing part. Hmmm....

Here are a couple possible additions :
(1) Include tables of the preferred number series corresponding to a particular tolerance based set of standard resistor values and enable the selection of one of those as the set from which the final values are synthesized.

I don't know if I get this right. Are you suggesting to put a "User set 1" and "User set 2" into the E-Series combo-box?
That will change the traversal in the search-tree. But should be possible.

(2) Support the creation of not a particular value of resistance, but a particular ratio of resistance such as would apply when creating a potentiometer from fixed resistor values and one wants the resulting ratio to be some particular value.  Applicable constraints for this situation would be minimum and maximum values of resistors to be used, which preferred number  series of resistors will be used, and how many series / parallel elements are usable to create the best approximate ratio.  Taking the voltage divider search further one could specify a given input voltage + tolerance and a target voltage to be created and search for the best available resistors to implement the divider.

This voltage divider part seems to be a logical extension to the project.

(3) Given a particular thermistor characteristic, what is the tolerance of resistance values observable for a given temperature.  One could also look at what values and temperature characteristics of associated resistors would produce the best linearization of the thermistor circuit voltage over a given temperature range, and what would be the tolerance vs. temperature.  I don't suppose linearization is nearly as important these days given the usability of MCUs to calculate corrections, but tolerance is always useful.

Wow. To be honest, I didn't plan this to be a professional tool. But the sources are available. Everybody is invited!
But thank you very much for your suggestions.

Olli
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #11 on: August 12, 2015, 02:15:35 pm »
How about making a program for potential dividers using more than three resistors?

Sure, using single resistors or optimized combinations?


Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #12 on: August 12, 2015, 02:25:40 pm »
For thermistors, this is the (exact) solution for a given thermistor, one resistor in series, and one resistor in parallel.  (Obviously, an arbitrary network could be solved for a limited set of resistor values, but that would be hard. :) )  Or inductors (not that you usually have inductors of very well known value and tempco), or reciprocal for capacitors (which was the original problem I had encountered).
http://seventransistorlabs.com/Calc/Tempco.html

Ed: for two resistor combinations (single and ratios), there's:
http://jansson.us/resistors.html
I also have a divider calculator which may be of interest, http://seventransistorlabs.com/Calc/ResDiv.html

Tim

Ok, just to summarize. We need:
1) Single executable version
2) tempco calculations (or estimations)
3) error/tolerance calculations
4) Voltage dividers
5) Multi-tap voltage dividers

Give me a few days. Regarding the temperature coefficient I might come back to you with some questions ;)

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19841
  • Country: gb
  • 0999
Re: Fun with resistors
« Reply #13 on: August 12, 2015, 03:02:51 pm »
How about making a program for potential dividers using more than three resistors?

Sure, using single resistors or optimized combinations?
Optimised combinations.

Something like this web based app but with the option to have more voltages and resistor combinations would be really good.
http://sim.okawa-denshi.jp/en/teikokeisan.htm
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #14 on: August 22, 2015, 07:47:24 am »
Just a little teaser...

I switched back to Delphi development and changed
the layout a bit...

More coming soon.

Greetings,
Olli.

Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #15 on: August 22, 2015, 09:53:06 am »
Ooh :)
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #16 on: August 22, 2015, 02:12:29 pm »
Ok, there is a new version online. By far not finsished.
Voltage divider via ratio not implemented.

But i appreciate your suggestions!

Greetings, Olli.

Download:
https://github.com/theageman/rfun/releases/tag/v0.2
Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #17 on: August 22, 2015, 03:53:56 pm »
Hmm...

In principle, you could have resistors from +V to tap 2, or any inbetween node.

This could be extremely complicated...
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #18 on: August 26, 2015, 12:38:08 pm »
Hmm...

In principle, you could have resistors from +V to tap 2, or any inbetween node.

This could be extremely complicated...

 :scared: I fear this is too complicated for me.
I had to use real netlists. The drawing-algo would
have to deal with crossing nets.
Another problem would be that the load impedances
would affect more than one tap.

But nevertheless this *is* a very interesting problem to
deal with. I will keep this idea in mind.

At the moment i am trying to include tempco's and tolerances.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #19 on: August 28, 2015, 10:20:15 am »
I started implementing tempco-calculations and looked up some typical tempco values at digikey (just to have some default values).
And here is a point I don't understand. (Sorry, I'm just a hobbyist)
In many datasheets the tempco is given by a range (+/- 100ppm/°C) for example. As I understand it, the tempco can only be a single value (either positive or negative).

Can somebody clarify please?

Thanks,
Olli.


Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #20 on: August 28, 2015, 04:34:42 pm »
The tempco need not be a single value:

A given sample of a part number may have some tempco at room temperature, but as temperature changes, so does the tempco (a tempcoco, if you will?).

The tempco may not be reciprocal, i.e., after some cycles, it doesn't end up in the same place.  Or it's history dependent / hysteretic.

Across different samples, the tempcos (and behaviors) may all vary, so that in a statistical sample, a range is the only thing that can be listed confidently.

In practice, the actual or average results may not be so pessimistic; but you'd have to measure them to find out, since the manufacturer does not. 

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #21 on: August 28, 2015, 05:27:28 pm »
The tempco need not be a single value:

A given sample of a part number may have some tempco at room temperature, but as temperature changes, so does the tempco (a tempcoco, if you will?).

The tempco may not be reciprocal, i.e., after some cycles, it doesn't end up in the same place.  Or it's history dependent / hysteretic.

Across different samples, the tempcos (and behaviors) may all vary, so that in a statistical sample, a range is the only thing that can be listed confidently.

In practice, the actual or average results may not be so pessimistic; but you'd have to measure them to find out, since the manufacturer does not. 

Tim

Ok. So in practice a tempco-calculation like the one shown in the picture would be OK?

Olli.
Jazz is not dead, it just smells funny
 

Offline quantalume

  • Supporter
  • ****
  • Posts: 26
  • Country: 00
Re: Fun with resistors
« Reply #22 on: August 28, 2015, 05:39:24 pm »
Hey, thanks for this tool!  :-+ I will get a lot of use out of it. Nice of you to use Delphi. Any interest in using Lazarus so you can create Linux executables?
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #23 on: August 28, 2015, 05:52:08 pm »
Hey, thanks for this tool!  :-+ I will get a lot of use out of it. Nice of you to use Delphi. Any interest in using Lazarus so you can create Linux executables?
I know Lazarus. It's a great IDE. I'm using Delphi XE2 at the moment. As I'm not using super special components, the sources should be compatible to Lazarus. I could upload the sources to Github if you like.

Olli.
Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #24 on: August 28, 2015, 09:14:36 pm »
Yeah, that's probably good enough.
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #25 on: August 28, 2015, 09:29:59 pm »
Yeah, that's probably good enough.

Cool !

There's a new version available at https://github.com/theageman/rfun/releases/tag/v0.21.

new features:

-    added voltage divider via ratio
-    added multi-tap voltage divider
-    added rudimentary tempco calculations
-    added rudimentary tolerance calculations

missing features:

-    gaussian distributions
-    user sets
-    threading (be careful with large sets! UI gets locked during calculations!)

Uploaded Delphi XE2 sources as well. Hope they compile under Lazarus.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Zeyneb

  • Regular Contributor
  • *
  • Posts: 244
  • Country: nl
Re: Fun with resistors
« Reply #26 on: August 29, 2015, 01:31:30 am »
Hi,

Currently I'm using an Excel table for this. Your application might be very handy but something isn't right (yet). I'm using v0.21. I was trying the "voltage divider via ratio". The classic voltage divider is R2 / (R1 + R2). But you wrote R1/R2. Then if I ask to utilize 2 resistors I get an solution with 4 resistors.

So, I would like to see the basic voltage divider getting to work.

Also for basic opamp circuits this is very useful. So entering just a desired gain and then having the application calculate the required resistors for the inverting opamp and separately the non-inverting.
one.

Also if I do single value resistor and utilize 3 resistors I get a presumable divide-by-zero exception.

Anyway nice idea. Keep going.
goto considered awesome!
 

Offline quantalume

  • Supporter
  • ****
  • Posts: 26
  • Country: 00
Re: Fun with resistors
« Reply #27 on: August 29, 2015, 03:15:31 am »
As I'm not using super special components, the sources should be compatible to Lazarus. I could upload the sources to Github if you like.

Olli.

That would be great. I will see what's involved in compiling under Lazarus.
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #28 on: August 29, 2015, 03:29:18 pm »
Hi,

Currently I'm using an Excel table for this. Your application might be very handy but something isn't right (yet). I'm using v0.21. I was trying the "voltage divider via ratio". The classic voltage divider is R2 / (R1 + R2). But you wrote R1/R2. Then if I ask to utilize 2 resistors I get an solution with 4 resistors.

So, I would like to see the basic voltage divider getting to work.

Also for basic opamp circuits this is very useful. So entering just a desired gain and then having the application calculate the required resistors for the inverting opamp and separately the non-inverting.
one.

Also if I do single value resistor and utilize 3 resistors I get a presumable divide-by-zero exception.

Anyway nice idea. Keep going.

Uploaded a new version to https://github.com/theageman/rfun/releases/tag/v0.21/.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #29 on: August 29, 2015, 03:39:25 pm »
As I'm not using super special components, the sources should be compatible to Lazarus. I could upload the sources to Github if you like.

Olli.

That would be great. I will see what's involved in compiling under Lazarus.

Hope it works. If there are problems, I could install FreePascal/Lazarus as well.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Zeyneb

  • Regular Contributor
  • *
  • Posts: 244
  • Country: nl
Re: Fun with resistors
« Reply #30 on: August 29, 2015, 07:54:45 pm »

Uploaded a new version to https://github.com/theageman/rfun/releases/tag/v0.21/.

Greetings,
Olli.
Hi Olli,

Thanks man. You're quick. You as well thought the opamp ones where a nice feature?

Now I tried the voltage divider with a gain of 0.02. You suggested 100k for R1 and 2k for R2 in the E24 series. But I know 330k for R1 and 6k8 for R2 is closer to that gain. Would you be able to get that right?

Also I still can't see your logic behind the amount of resistors to utilize. Why do I need to ask to utilize 1 resistor to get a two resistor voltage divider?

I just have suggestions to make the application better. Well at least in my eyes.

As opamp circuits aren't voltage dividers I would suggest to make them a separate item in the tree view. By doing so you'd remove the type drop-down menu. You don't need to have that small example picture on the top right if your output window display's this already. So for the opamp versions having a separate picture indicating the locations for R1 and R2. After "Go" you can add the values as well.

Greetings Zeyneb

goto considered awesome!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #31 on: August 29, 2015, 09:05:47 pm »

Hi Olli,

Thanks man. You're quick. You as well thought the opamp ones where a nice feature?

Sure  :-+

Now I tried the voltage divider with a gain of 0.02. You suggested 100k for R1 and 2k for R2 in the E24 series. But I know 330k for R1 and 6k8 for R2 is closer to that gain. Would you be able to get that right?

Let me try to explain.
When you type "330k" into the RSum-edit-field with the parameters given above, you get exactly the same 330k/6k8 result.
(Btw. you can actually type resistor values "the engineering way" everywhere, like 6k8, 330, 330R etc. Scientific notation, like "3.3e6" for example, is available as well)
This Rsum-parameter is not just for convenience. It's used to get the total current through the circuit. The R-values are calculated using the total current and the voltage drops across the resistors. I just have no idea how to solve that otherwise.


Also I still can't see your logic behind the amount of resistors to utilize. Why do I need to ask to utilize 1 resistor to get a two resistor voltage divider?

It's simply the number of resistors per branch. It uses the algorithm from the "Single value"-panel. Perhaps I should label it accordingly?

I just have suggestions to make the application better. Well at least in my eyes.

No worries. If nobody would make suggestions, there were no progression. I like feedback!  :-+

As opamp circuits aren't voltage dividers I would suggest to make them a separate item in the tree view. By doing so you'd remove the type drop-down menu. You don't need to have that small example picture on the top right if your output window display's this already. So for the opamp versions having a separate picture indicating the locations for R1 and R2. After "Go" you can add the values as well.

Moving the opamp calculations to a seperate panel could be a possibility. I intoduced these little pictures, because the locations of Rx1 and Rx2 are different for different circuits.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Zeyneb

  • Regular Contributor
  • *
  • Posts: 244
  • Country: nl
Re: Fun with resistors
« Reply #32 on: August 29, 2015, 09:51:08 pm »
Quote
Let me try to explain.
When you type "330k" into the RSum-edit-field with the parameters given above, you get exactly the same 330k/6k8 result.
(Btw. you can actually type resistor values "the engineering way" everywhere, like 6k8, 330, 330R etc. Scientific notation, like "3.3e6" for example, is available as well)
This Rsum-parameter is not just for convenience. It's used to get the total current through the circuit. The R-values are calculated using the total current and the voltage drops across the resistors. I just have no idea how to solve that otherwise.

I don't know about the other eevblog forum members. But I my eyes getting the gain as close as possible is priority #1. The 330k and 6k8 solution is still higher than the 100k Rsum-parameter criterium.

Here is the Excel sheet I'm currently using for this.

Greetings Zeyneb
goto considered awesome!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #33 on: August 29, 2015, 10:31:37 pm »
I don't know about the other eevblog forum members. But I my eyes getting the gain as close as possible is priority #1. The 330k and 6k8 solution is still higher than the 100k Rsum-parameter criterium.

Here is the Excel sheet I'm currently using for this.

I probably used that spreadsheet the wrong way. I have not been able to find a gain of 0.02 in that table.
As I already said, I'm just a hobbyist.
But I'm pretty sure that getting the pure gain does not represent the entire picture.
You are putting a load to your source. That means, "Rsum" matters.
Try, for example, putting a 1M0 into Rsum. You will get a gain of exactly 0.02 (with 1M0/20k)! This even closer
than 330k/6k8, resulting in a gain of 0.02060606.
In the end Rsum defines the load.
Perhaps a more "sophisticated" person could help here.
Don't get me wrong, I don't want to say that you're wrong, I'm just not sure if the problem is fully understood (on my side or on your side)  :-//

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Redcat

  • Regular Contributor
  • *
  • Posts: 74
  • Country: de
  • Ask why not, not why.
    • redcatimaging
Re: Fun with resistors
« Reply #34 on: August 30, 2015, 10:48:56 pm »
I tried to play with your software. Very nice project  :-+ . And very complex task.
But either i'm too stupid or it has mayor bugs... :-\.

Here is an example: if i try to make a 10k resistor with 10 resistors and Rx min and max are 4k7 (i might have a box full of 4k7 resistors left...),
it paints 1R0. If i use 5k for Rx max it uses a 470R and a 680R resistor in addition to the 4k7s, which are not in the range of 4k7 to 5k (not to mention the computation time  ::) ).
Actually, this could be a real world example, making 10k out of 4k7s.
Do i think or using the programm the wrong way?

Painted only 1R0 and "division by 0" show up pretty often at calculations. I guess when i input stupid (not always obvious) values.

Some more ideas:
Is it a good idea, to always try to use the maximum number of given resistors? Hmmm...checkbox - "use alway max" or "use rational number" might be useful? Ok, it's getting even more complex ;).
Maybe there is a point of derivation from the optimum (or you can insert a value) where a use of more resistors is irrational.

Voltage divider does not work too when you use not the whole E-range (lets say only 1k to 10k) and r sum is bigger (in your start example 100k).
I would suggest a drop down box which you can choose only valid resistor values depending on your other inputs...just an idea ;). Or a message box like "Hey...Rsum is too big for the given values".
Or an auto correct function.

What about current sharing? You seem to try to get to the closest result to the given value, but is this always the best or wanted as resistors have tolerances anyway (like 1%, 10%..)?
The reason you use more resistors than only one may be this (current sharing). Which would require a "max current per resistor" field (like "1/2" ...) and so on... (computation reaches hell level ;)  ).
It does not include the size (like 1/4w,1/2W...) into calculation, right?

But maybe your goal really is to get to the closest result. Not practical but for fun be fine too.


Very complex computations  :o (computation time -> :palm:) and very interesting task. I would never be able to program something like this. I'm looking forward how your project will develop  :-+ .
Thank you for sharing and good luck.

Greetings, Tom
Voltcraft 630-2,Tek 2215A,Tek 475,really handy DIY microcontroller component tester (R/C/D/Q...), ZD-915, ZD-931,Voltcraft 1062D - of course hacked :)
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #35 on: August 31, 2015, 12:34:08 pm »
I tried to play with your software. Very nice project  :-+ . And very complex task.
But either i'm too stupid or it has mayor bugs... :-\.

Here is an example: if i try to make a 10k resistor with 10 resistors and Rx min and max are 4k7 (i might have a box full of 4k7 resistors left...),
it paints 1R0. If i use 5k for Rx max it uses a 470R and a 680R resistor in addition to the 4k7s, which are not in the range of 4k7 to 5k (not to mention the computation time  ::) ).
Actually, this could be a real world example, making 10k out of 4k7s.
Do i think or using the programm the wrong way?

Painted only 1R0 and "division by 0" show up pretty often at calculations. I guess when i input stupid (not always obvious) values.

Very embarassing  :palm:
That happened during translation from C++ to Delphi.
Uploaded new version: https://github.com/theageman/rfun/releases/tag/v0.21

Some more ideas:
Is it a good idea, to always try to use the maximum number of given resistors? Hmmm...checkbox - "use alway max" or "use rational number" might be useful? Ok, it's getting even more complex ;).
Maybe there is a point of derivation from the optimum (or you can insert a value) where a use of more resistors is irrational.

Possible approach would be to start with 1 resistor, calculate error, next use 2 resistors, calculate error etc. Then choose the solution with the smallest error. Sounds interesting. Give me a few days ;)

Voltage divider does not work too when you use not the whole E-range (lets say only 1k to 10k) and r sum is bigger (in your start example 100k).
I would suggest a drop down box which you can choose only valid resistor values depending on your other inputs...just an idea ;). Or a message box like "Hey...Rsum is too big for the given values".
Or an auto correct function.

Should be fixed as well. (Not 100% sure, though)
EDIT: no, still buggy
EDIT2: *NOW* it should work.  :-DD

What about current sharing? You seem to try to get to the closest result to the given value, but is this always the best or wanted as resistors have tolerances anyway (like 1%, 10%..)?
The reason you use more resistors than only one may be this (current sharing). Which would require a "max current per resistor" field (like "1/2" ...) and so on... (computation reaches hell level ;)  ).
It does not include the size (like 1/4w,1/2W...) into calculation, right?

But maybe your goal really is to get to the closest result. Not practical but for fun be fine too.


Very complex computations  :o (computation time -> :palm:) and very interesting task. I would never be able to program something like this. I'm looking forward how your project will develop  :-+ .
Thank you for sharing and good luck.

Greetings, Tom

About computation time:
Let's call the number of possible values n (for example in E12-series with Rmin=1k and Rmax=2k2, n would be 5).
Let's call the number of taps t.
Let's call the number of resistors to user per branch q.
Then the number of calculations is approx. (t+1) * 2n^q.
As you can see it gets quite large very quickly.
I am considering to incorporate multi-threading. But that's not easy. The easiest way to use multi-threading would be one thread per branch. But that would not speed up the single-value calculations.

About current sharing/power dissipation.
It's on the list. But with "not that high" priority.

Next improvements will be threading/progress feedback/start&stop calculations.


Greetings,
Olli.
« Last Edit: August 31, 2015, 01:26:26 pm by theageman »
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #36 on: August 31, 2015, 12:36:31 pm »
I've been super busy and haven't had time to check out the program since the last time I posted, but it looks from the thread like you're making good progress, awesome!

Thank you!

One other quite related possibility which might be interesting to you could be attenuator calculations perhaps with the ability to set / report the input impedance, output impedance, topology (unbalanced, balanced, PI, T, ...) and of course series / value restrictions of the components.  You might calculate power dissipation & suggest minimum ratings given the input voltage, as well as input & report the desired / realized voltage and power attenuation in dB & linear ratios. 

https://en.wikipedia.org/wiki/Attenuator_%28electronics%29

I'll investigate this.
Thanks,
Olli.
Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #37 on: August 31, 2015, 03:19:25 pm »
Mmmh, exponential time implies NP-completeness; there ought to exist an algorithm (or at least heuristic) to reduce that to polynomial time (maybe N^2 or so?).

Interesting that it's a discrete-value problem, and a discrete/combinatorial problem.  So it might very well be that this seemingly simple problem is, in fact, NP-complete.

So if you idiots want to do  |O things with your enormous boxes of single value resistors, that's your problem  :box: ... :-DD

I don't think there would be any obvious way to warn the user that the computation will take a long time, but as long as it can be canceled, perhaps giving the "current best guess" but not the provably best answer, that would be fine.

Hmm, speaking of single value resistors, there should be the possible optimization that the network can be represented as a mere continued fraction, which should have O(N) or O(N^2) time.  Seems doubtful to me that such a special case is worth implementing, but it's an interesting thought.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Redcat

  • Regular Contributor
  • *
  • Posts: 74
  • Country: de
  • Ask why not, not why.
    • redcatimaging
Re: Fun with resistors
« Reply #38 on: August 31, 2015, 03:56:53 pm »
Thanks Olly for working on the program.

Quote
That happened during translation from C++ to Delphi.
Uploaded new version: https://github.com/theageman/rfun/releases/tag/v0.21
Now it works fine :). Fantastic.

Yes i almost expected that computation time would be exponential  :-[ , lets hope there is a way around.

I'm not sure of your algorithm, but could you - for example lets take a voltage devider with 2 tabs - cut the problem into 3 pieces...and computate each at it's own?
For example: R sum is 10K. You want a division (arg..my english is not that great, but i hope you can understand what i mean) of 1/4,1/4,1/2. You could computate each at it's own (in the given example 2,5k/2,5K/5K) and as the first and second value are the same you would not have to computate the second one again...Might save time.
I'm not into mathmatics and it's even hard to understand by myself..but this would be a quick Idea... (maybe you are already doning so ;)..).

Quote
Possible approach would be to start with 1 resistor, calculate error, next use 2 resistors, calculate error etc. Then choose the solution with the smallest error. Sounds interesting. Give me a few days ;)
I'm happy looking forward :). Thats what i meant. Of course only up to the maximum Number of Resistors you want to use and maybe as few as possible at a given/acceptable tolerance (user input field).
This were just some ideas. Thought it may be interesting additions.

I will be back for testing  :).

Thanks for your time and happy programming, Tom

Voltcraft 630-2,Tek 2215A,Tek 475,really handy DIY microcontroller component tester (R/C/D/Q...), ZD-915, ZD-931,Voltcraft 1062D - of course hacked :)
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #39 on: August 31, 2015, 03:58:10 pm »
Mmmh, exponential time implies NP-completeness; there ought to exist an algorithm (or at least heuristic) to reduce that to polynomial time (maybe N^2 or so?).

Interesting that it's a discrete-value problem, and a discrete/combinatorial problem.  So it might very well be that this seemingly simple problem is, in fact, NP-complete.

Now we are talking!  8)
The fact that this is a discrete-value problem is because I limited the search-tree to countable values (the E-series). Otherwise this wouldn't be possible. As this algorithm is a search with a finite search-tree in the end, it's probably NP-equivalent. But I'm not 100% sure.

So if you idiots want to do  |O things with your enormous boxes of single value resistors, that's your problem  :box: ... :-DD

To be honest, I started this project to see what it looks like having 10 4k7 resistors to build one 1k resistor. (See first picture...)  :-DD

I don't think there would be any obvious way to warn the user that the computation will take a long time, but as long as it can be canceled, perhaps giving the "current best guess" but not the provably best answer, that would be fine.

In fact, I have been able to pre-calculate the number of computations. That way i was also able to update the progress-bar accordingly.
I will re-implement this feature. Takes a while because it also needs an own thread to do so.

Hmm, speaking of single value resistors, there should be the possible optimization that the network can be represented as a mere continued fraction, which should have O(N) or O(N^2) time.  Seems doubtful to me that such a special case is worth implementing, but it's an interesting thought.

Tim

It sometimes finds these continued fractions (second picture - if this is what you mean by continued fractions) ;)

Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #40 on: August 31, 2015, 04:09:44 pm »
Thanks Olly for working on the program.

Quote
That happened during translation from C++ to Delphi.
Uploaded new version: https://github.com/theageman/rfun/releases/tag/v0.21
Now it works fine :). Fantastic.

Great!

Yes i almost expected that computation time would be exponential  :-[ , lets hope there is a way around.

I'm not sure of your algorithm, but could you - for example lets take a voltage devider with 2 tabs - cut the problem into 3 pieces...and computate each at it's own?
For example: R sum is 10K. You want a division (arg..my english is not that great, but i hope you can understand what i mean) of 1/4,1/4,1/2. You could computate each at it's own (in the given example 2,5k/2,5K/5K) and as the first and second value are the same you would not have to computate the second one again...Might save time.
I'm not into mathmatics and it's even hard to understand by myself..but this would be a quick Idea... (maybe you are already doning so ;)..).

This is actually a good idea! It's on my list now ;)

Quote
Possible approach would be to start with 1 resistor, calculate error, next use 2 resistors, calculate error etc. Then choose the solution with the smallest error. Sounds interesting. Give me a few days ;)
I'm happy looking forward :). Thats what i meant. Of course only up to the maximum Number of Resistors you want to use and maybe as few as possible at a given/acceptable tolerance (user input field).
This were just some ideas. Thought it may be interesting additions.

I will be back for testing  :).

Thanks for your time and happy programming, Tom

Thanks!,
Olli.
Jazz is not dead, it just smells funny
 

Offline Redcat

  • Regular Contributor
  • *
  • Posts: 74
  • Country: de
  • Ask why not, not why.
    • redcatimaging
Re: Fun with resistors
« Reply #41 on: August 31, 2015, 05:32:16 pm »
More ideas to come ;), be prepared haha :).

And you are right, the picture alone of seeing an 10k made of many 4k7s is worth gold. Hmm..maybe a new T-shirt idea ::), i would want one  ;D. Calculated with your software...

As i just saw in the tree on the left side in the program, you are planning -in a far far future- a custom set(s) of resistors next to the E-sets, right?
This will be absolute awsome for people like me, who have a box with millions of resistors, but never (nah, but often) the right value and no complete E series.
You are always short on "the one" resistor value when you need it ;). How many times i have bodged resistors togeter to get a special value.
Your software will be so handy.

No, bodged resistors don't look nice , but when you need it now...And actually, i have seen stacked caps and stacked SMD resistors on PCBs sometimes (for current and voltage reasons)...

Hmm..you could do some pretty nice artwork with SMDs witch is also usable...stop..no more ideas today  ::).

Haha..have a nice evening
Voltcraft 630-2,Tek 2215A,Tek 475,really handy DIY microcontroller component tester (R/C/D/Q...), ZD-915, ZD-931,Voltcraft 1062D - of course hacked :)
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #42 on: August 31, 2015, 05:43:10 pm »
More ideas to come ;), be prepared haha :).

I am, no problem  :)

And you are right, the picture alone of seeing an 10k made of many 4k7s is worth gold. Hmm..maybe a new T-shirt idea ::), i would want one  ;D. Calculated with your software...

You just have to buy 100.000 4k7s from digikey and you could build your own decade-resistor-box  :popcorn:

As i just saw in the tree on the left side in the program, you are planning -in a far far future- a custom set(s) of resistors next to the E-sets, right?
This will be absolute awsome for people like me, who have a box with millions of resistors, but never (nah, but often) the right value and no complete E series.
You are always short on "the one" resistor value when you need it ;). How many times i have bodged resistors togeter to get a special value.
Your software will be so handy.

No, bodged resistors don't look nice , but when you need it now...And actually, i have seen stacked caps and stacked SMD resistors on PCBs sometimes (for current and voltage reasons)...

Yes I'm thinking of 4 user sets.

Hmm..you could do some pretty nice artwork with SMDs witch is also usable...stop..no more ideas today  ::).

Haha..have a nice evening


Ebenso.
Jazz is not dead, it just smells funny
 

Offline Redcat

  • Regular Contributor
  • *
  • Posts: 74
  • Country: de
  • Ask why not, not why.
    • redcatimaging
Re: Fun with resistors
« Reply #43 on: August 31, 2015, 06:01:47 pm »
Quote
You just have to buy 100.000 4k7s from digikey and you could build your own decade-resistor-box  :popcorn:
I see, we understand ;).
But who the hell will be soldering them for me together :o.
Voltcraft 630-2,Tek 2215A,Tek 475,really handy DIY microcontroller component tester (R/C/D/Q...), ZD-915, ZD-931,Voltcraft 1062D - of course hacked :)
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #44 on: September 01, 2015, 12:36:58 am »
Just a little update (v0.22) https://github.com/theageman/rfun/releases/tag/0.22.

added features:
  • worker-thread (you can start and stop computations now)
  • feedback displays number of already checked combinations
missing features:
  • progress bar
  • user sets
  • gaussian distributions

Olli.
Jazz is not dead, it just smells funny
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Fun with resistors
« Reply #45 on: September 01, 2015, 01:54:56 am »
I think the next enhancement is to throw a box of trash resistors at it and come up with the best kelvin-varley divider stages possible.
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #46 on: September 01, 2015, 02:35:56 pm »
V0.23 https://github.com/theageman/rfun/releases/tag/0.23

added features:
  • added the capability to automatically use the smallest number of resistors (thanks, Redcat)

missing features:
  • user sets
  • gaussian distributions

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Redcat

  • Regular Contributor
  • *
  • Posts: 74
  • Country: de
  • Ask why not, not why.
    • redcatimaging
Re: Fun with resistors
« Reply #47 on: September 01, 2015, 05:20:18 pm »
You are really fast working on your program  :-+ and make good progress.

Quote
added the capability to automatically use the smallest number of resistors (thanks, Redcat)
Thanks Olli.
I would definitely make it only an "option" (checkbox or so) and change the text to something like "Utilize up to...resistors (per branch)". And tell the user the number you have used, so that he hasn't to count all the resistors ;). There may be many and he may want to know the number on one look (i know this is absolute easy for you to put in the message box).
You may want to use the smallest possible number, but you may also not always want to. This could be important later for current sharing calculation and i wouldn't take all options away.
Ah..I'm stupid ;). Just found the option checkbox in the Settings...
So..well done  :-+. Thats it.

Start/stop works good - that was really missing - and it shows the number of combinations at the bottom. Wow, really many combinations.

I managed to get the program crash when i calculated a resistor divider with a too small band of resistor values  >:D. But I could not reproduce it.

Also the gain error can get pretty high, but that is normal if I use too few resistors and a small band of min max. That is absolutely right - the user has to use the brain too ;). I noticed gain is precise when u use a wider band and more resistors. So that part of the software is working good too.
Maybe you could output a message like "please use a higher number of resistors or a wider band to obtain a more precise gain"...(maybe shorter) in you message box, when the deviation from the gain is too high.

And it would be nice if the user can set "tolerances" of the calculation results (optional).
And of course try to include as much feedback to the user as possible and at the same time is useful (so also not too much).

Useful feedback is a key in software. Short story from my work: On one of our Photo Roll to Roll laser "printers" (i work in Photo industry) the backprint fails from time to time. Gives out an error message like "error 1234". Even a friend, the engineer who was part of the development team and chief trainer for the machine, does not kow what that means  |O . I have changed out every part of the machine which has to do the smallest amount with the backprint system and the error is still there because i actually don't know what the error message precisely means. And he said to me "I would not like to have your problem". Can be a small screw, but i might never find out.
If i ever meet the software engineer (nah, not really, but mentally)... :box:.

On the "Analyse" Tab..sorry i don't understand the smallest amount and can't test. I'm not an electronics engineer  :-//.

Can't wait to see the next development steps of your program.  :-+

Have a nice evening, Tom


Voltcraft 630-2,Tek 2215A,Tek 475,really handy DIY microcontroller component tester (R/C/D/Q...), ZD-915, ZD-931,Voltcraft 1062D - of course hacked :)
 

Offline alexanderbrevig

  • Frequent Contributor
  • **
  • Posts: 700
  • Country: no
  • Musician, developer and EE hobbyist
    • alexanderbrevig.com
Re: Fun with resistors
« Reply #48 on: September 02, 2015, 12:00:58 pm »
I just made use of your program :) gave you a star on github as well. If I ever feel I should add something I'll give you a pull request.
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Fun with resistors
« Reply #49 on: September 03, 2015, 04:25:32 am »
It's a neat little program. I used it too, so shoutout to theageman! thanks!

I just made use of your program :) gave you a star on github as well. If I ever feel I should add something I'll give you a pull request.

I would like to contribute as well, but the github code is not the correct code, so no pull requests from the current codebase there.  The actual code is in the zip file and is Delphi Pascal.  I haven't used any form of Pascal since 1980, and if I started again I would not know Delphi or what's been added by Borland.

to theageman: Will you be putting the pascal code up on github too so pull requests can be made, in case I feel like an adventure ? :)
 

Offline alexanderbrevig

  • Frequent Contributor
  • **
  • Posts: 700
  • Country: no
  • Musician, developer and EE hobbyist
    • alexanderbrevig.com
Re: Fun with resistors
« Reply #50 on: September 03, 2015, 08:05:15 am »
[...]The actual code is in the zip file and is Delphi Pascal.

I'm seeing Qt/C++... Am I missing something?
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #51 on: September 03, 2015, 01:48:24 pm »
[...]
I would like to contribute as well, but the github code is not the correct code, so no pull requests from the current codebase there.  The actual code is in the zip file and is Delphi Pascal.  I haven't used any form of Pascal since 1980, and if I started again I would not know Delphi or what's been added by Borland.

to theageman: Will you be putting the pascal code up on github too so pull requests can be made, in case I feel like an adventure ? :)

I started this project in C++/Qt to learn programming for my new Android tablet. Then I broke my tablet  |O and rewrote the software in Delphi.
I am more or less about to release a new release with almost all features I wanted to be implemented. There is one bug, that occurs in 1% of the time. As soon as I fixed that bug, I will upload the new release with sources.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #52 on: September 03, 2015, 04:01:13 pm »
Alright.

Version 0.25 is online (https://github.com/theageman/rfun/releases/tag/0.25).
Delphi XE2 sources available as well.

Added user sets.

This release have been quite complex. I hope there aren't too many bugs. But it seems to be running quite well.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #53 on: September 04, 2015, 01:32:52 pm »
I just made use of your program :) gave you a star on github as well. If I ever feel I should add something I'll give you a pull request.

Thanks!

I'm seeing Qt/C++... Am I missing something?

There is a zip-file in the release folder (src.zip). I will try to integrate git into Delphi the next days.
Git is new to me, I used SVN before.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #54 on: September 04, 2015, 06:20:07 pm »
I have included context sensitive help to the project.

https://github.com/theageman/rfun/releases/tag/0.25

Context sensistive means that you can press F1 and get help for current active control.

rfun.chm has to be in the same folder as the application file (rfun.exe).

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Fun with resistors
« Reply #55 on: September 05, 2015, 07:13:36 pm »
Just butting in because anyone that doesn't know this (I certainly didn't for YEARS!) - Microsoft Compiled HTML Help files in the .chm format are default blocked because they could contain malicious code, etc. Of course there is no prompt for this to let you know, you just get a blank help page.

To fix it you have to locate the .chm file, right click and Unblock it in Properties...



 

Offline alexanderbrevig

  • Frequent Contributor
  • **
  • Posts: 700
  • Country: no
  • Musician, developer and EE hobbyist
    • alexanderbrevig.com
Re: Fun with resistors
« Reply #56 on: September 05, 2015, 08:36:39 pm »
Git is new to me, I used SVN before.

Then you should definitely check out http://gitimmersion.com/, it's quick 10-15 minutes of excellence.
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #57 on: September 06, 2015, 12:46:45 am »
Just butting in because anyone that doesn't know this (I certainly didn't for YEARS!) - Microsoft Compiled HTML Help files in the .chm format are default blocked because they could contain malicious code, etc. Of course there is no prompt for this to let you know, you just get a blank help page.

To fix it you have to locate the .chm file, right click and Unblock it in Properties...



Anything wrong with my release?

Quote
Microsoft Compiled HTML Help files in the .chm format are default blocked because they could contain malicious code, etc. Of course there is no prompt for this to let you know, you just get a blank help page.
Jazz is not dead, it just smells funny
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Fun with resistors
« Reply #58 on: September 06, 2015, 01:04:15 am »
Anything wrong with my release?
Of course not. There is nothing wrong with it at all. But .chm files have been abandoned by Microsoft for years - and they default them to untrusted because of a security hole.

Basically nobody but you would be able to see the help files without unblocking them.
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #59 on: September 06, 2015, 01:15:09 am »
Ok.

Alternatives?
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #60 on: September 06, 2015, 01:23:46 am »
I could publish pdf's.
Jazz is not dead, it just smells funny
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Fun with resistors
« Reply #61 on: September 06, 2015, 12:04:40 pm »
PDFs are good. :)


Sent from my Smartphone
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline ralphd

  • Frequent Contributor
  • **
  • Posts: 445
  • Country: ca
    • Nerd Ralph
Re: Fun with resistors
« Reply #62 on: September 08, 2015, 01:26:59 am »
Publishing the android app on f-droid would make it easier.
Unthinking respect for authority is the greatest enemy of truth. Einstein
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #63 on: September 08, 2015, 11:21:58 am »
PDFs are good. :)


Sent from my Smartphone

Ok, pdf attached.

Greetings,
Olli.

Jazz is not dead, it just smells funny
 
The following users thanked this post: Cliff Matthews

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #64 on: September 08, 2015, 11:23:36 am »
Publishing the android app on f-droid would make it easier.

Sorry, but I have stopped android-development of this application.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #65 on: September 08, 2015, 11:42:08 am »
Anything wrong with my release?
Of course not. There is nothing wrong with it at all. But .chm files have been abandoned by Microsoft for years - and they default them to untrusted because of a security hole.

Basically nobody but you would be able to see the help files without unblocking them.

Does anybody have more information about this topic?
I tried to find details via Google, Wikipedia and MSDN without success.
Even at the official Microsoft download page (https://msdn.microsoft.com/de-de/en-en/library/ms669985.aspx). No sentence about security problems.

Greetings,
Olli.
« Last Edit: September 08, 2015, 11:44:16 am by theageman »
Jazz is not dead, it just smells funny
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Fun with resistors
« Reply #66 on: September 08, 2015, 12:00:19 pm »
Have you not tried right-clicking a .chm file and checking its properties - like I posted. Right there at the bottom of the dialog under Security is a brief description and a checkbox to tick to allow the file.

I was just being helpful to others wanting to read your help file because it seems a little known problem with an easy fix. As I said, I had been getting blank help pages for years from various bits of software and put it down to broken installs or something until I found the real reason.

Please just carry on using HTML Help. We have to go through security warnings to run your .exe, which I am sure could be far more malicious, so it's no extra risk having to allow a .chm file too. Just let everyone know how to fix it.

I'm sure there is some way of code-signing it all with an installer to work seamlessly but that probably costs $$$ with Microsoft.
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Fun with resistors
« Reply #67 on: September 08, 2015, 12:12:15 pm »
Plenty of web pages on this topic on google, like this one from National Instruments
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #68 on: September 08, 2015, 01:19:09 pm »
Have you not tried right-clicking a .chm file and checking its properties - like I posted. Right there at the bottom of the dialog under Security is a brief description and a checkbox to tick to allow the file.
There have not been a checkbox probably because that chm-file was built on my computer ;)

Quote
I was just being helpful to others wanting to read your help file because it seems a little known problem with an easy fix. As I said, I had been getting blank help pages for years from various bits of software and put it down to broken installs or something until I found the real reason.

Oh I see. Thanks.
I am using a small tool to write these help files (http://www.helpndoc.com/). It also allows me to build HTML-files. Perhaps that would be an option.

Quote
Please just carry on using HTML Help. We have to go through security warnings to run your .exe, which I am sure could be far more malicious, so it's no extra risk having to allow a .chm file too. Just let everyone know how to fix it.

I'm sure there is some way of code-signing it all with an installer to work seamlessly but that probably costs $$$ with Microsoft.

Right.  It's not cheap.
This one reason why I uploaded the source code as well. You still have to trust the binary though.

Greetings, Olli
Jazz is not dead, it just smells funny
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Fun with resistors
« Reply #69 on: September 08, 2015, 02:11:47 pm »
Yes, I scanned the binary with a hex editor. I'm not sure what

Code: [Select]
64 65 6C 20 63 3A 5C 77 69 6E 64 6F 77 73 5C 73
79 73 74 65 6D 33 32

is doing in there though  ;) :-DD
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #70 on: September 08, 2015, 02:33:22 pm »
Yes, I scanned the binary with a hex editor. I'm not sure what

Code: [Select]
64 65 6C 20 63 3A 5C 77 69 6E 64 6F 77 73 5C 73
79 73 74 65 6D 33 32

is doing in there though  ;) :-DD

Just a hidden usefull feature.
But it only gets triggered once a month ;)
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #71 on: September 09, 2015, 04:43:11 pm »
I implemented tolerance calculations using "propagation of uncertainty" now (https://en.wikipedia.org/wiki/Propagation_of_uncertainty). In parallel combinations the resulting tolerance drops. That seems to be reasonable.

I would like to add graphs for the tempco-thing. Something like temperature on x-Axis and resulting resistance or tap-voltage on Y-axis.
For linear tempco-behaviour this is pretty simple.
For NTC-behaviour there are two possibilities. There is the Steinhart-Hart equation and there is this: , which seems to be a form of the Steinhart-Hart equation with certain constants. For this second form I have been able to find the appropriate values in Vishay datasheets.
But what about regular resistors and PTC's?
Any ideas?

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22288
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Fun with resistors
« Reply #72 on: September 09, 2015, 10:47:31 pm »
Resistors are generally PTC, but with hiccups.  Usually the R(T) curve looks something like a 3rd order rational function, chosen (by chemical composition) so that the slope of that curve happens to be near zero at room temperature (over a local min/max), or stays within bounds over a given range (an inflection point, 2nd order local minima).

I don't think I've seen any R(T) curves actually given.  Possibly in the Vishay Film series, but they're extremely high tolerance (20ppm and down) and come with a price to match!

Physics background:

General material properties for metals, semimetals and alloys give a nonzero resistance at very low temperature (the residual resistivity, a result of impurities disrupting current flow independent of temperature), then linearly (or some power law) increasing at higher temperatures.  The transition from 0TC to PTC occurs at some temperature where the resistance due to thermal disturbance exceeds the residual resistance (in other words, it acts as an ideal PTC in series with a 0TC).  For alloys of high percentages (like nichrome (typically 80% nickel, 20% chromium), the crossover occurs at very high temperatures (near the melting point, above yellow heat!), so the difference in resistance is relatively small over a wide range.  You can imagine this as a zeroth order temperature compensation -- dominating the ideal-metal PTC property with built-in constant resistance.  Nichrome gives a pretty basic 200ppm/C slope, so this method doesn't work out terrifically well, but it's good for the price.

Certain alloys exhibit neutral or negative tempcos at certain ranges, for reasons I don't know about; in any case, these droops can be positioned around room temperature, and at such a concentration as to just oppose the existing tempco effect.

Metal oxides should be broadly similar (I would expect the oxides in question to be low bandgap semiconductors, so that they look largely metallic at room temperature, and exhibit the same sort of "PTC with exceptions" curve), but perhaps with different curves suggesting the potentially richer chemistry (lots of oxides can be mixed, who knows..).

As for NTCs, they are essentially semiconductors with poorly controlled doping and random paths.  You can tell a semiconductor from a metal, because rather than an ideal PTC curve, it has an ideal NTC curve up to the metallic crossover point (where it rises PTC-wise again).  In this case, the residual resistivity acts in parallel, due to doping giving more charge carriers than the semiconductor would otherwise have.  Those doping elements, in turn, have activation temperatures, they're just too low to notice (the effect of "freezing out" dopants is important in the operation of BJTs, which aren't much good below -50 or -100C or so; the Vbe rises and hFE falls so much as to be useless).  So an equivalent circuit might be many semiconductors in parallel, having different cross sectional areas and different activation temperatures.  Which is more or less what the Steinhart-Hart equation is modeling: a series of exponentials in 1/T.

No real NTC approaches this equation, because you're missing all the other impurities, which might be quite many, all with different T_0, B and R_0.  This is why they give an approximate answer, which depends on the range of the approximation: usually B_85/25 is given, or something like that; meaning, it matches at 85C and 25C, and is a best fit for values inbetween.  You're always best off following the R(T) table, however, if one is provided.  Note that tolerance applies to all variables, so a 1% NTC has about 1% uncertainty in everything (making it suitable for about 3C absolute accuracy, or around 1C after a two point calibration).

For practical problems, one might make a voltage divider with NTC and 0TC resistors, in which case the V(T)/Vref varies in a still different manner.  This can be closely approximated as a sum of inverses, but it's generally cheaper to calculate by using a modest order polynomial instead.  (I wrote such a program for AVR, which takes around 200 cycles to complete the conversion from 12 bit ADC into 16 bit temperature.  The rational approximation, instead, takes some 400 or 600 cycles to execute, because there is no hardware divide instruction.)

Tim
« Last Edit: September 09, 2015, 10:59:44 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #73 on: September 10, 2015, 01:33:30 am »
[...]

Wow! Thank you very much for this beautiful explanations.

Resistors are generally PTC, but with hiccups.  Usually the R(T) curve looks something like a 3rd order rational function, chosen (by chemical composition) so that the slope of that curve happens to be near zero at room temperature (over a local min/max), or stays within bounds over a given range (an inflection point, 2nd order local minima).

Yep, the german Wikipedia-article mentions the possibility to approximate the Steinhart-Hart equation using a third-order polynomial.

I don't think I've seen any R(T) curves actually given.  Possibly in the Vishay Film series, but they're extremely high tolerance (20ppm and down) and come with a price to match!

Vishay has tables. And they give you actually all parameters you need to approximate these tables (or graphs if you like).

Quote
[...]
No real NTC approaches this equation, because you're missing all the other impurities, which might be quite many, all with different T_0, B and R_0.  This is why they give an approximate answer, which depends on the range of the approximation: usually B_85/25 is given, or something like that; meaning, it matches at 85C and 25C, and is a best fit for values inbetween.  You're always best off following the R(T) table, however, if one is provided.  Note that tolerance applies to all variables, so a 1% NTC has about 1% uncertainty in everything (making it suitable for about 3C absolute accuracy, or around 1C after a two point calibration).

For practical problems, one might make a voltage divider with NTC and 0TC resistors, in which case the V(T)/Vref varies in a still different manner.  This can be closely approximated as a sum of inverses, but it's generally cheaper to calculate by using a modest order polynomial instead.  (I wrote such a program for AVR, which takes around 200 cycles to complete the conversion from 12 bit ADC into 16 bit temperature.  The rational approximation, instead, takes some 400 or 600 cycles to execute, because there is no hardware divide instruction.)

Tim

Luckily a missing DIV-instruction is not my problem. I even have a vector-unit . ;)

Thanks again,
Olli.
Jazz is not dead, it just smells funny
 

Offline theagemanTopic starter

  • Contributor
  • Posts: 39
  • Country: de
    • My Blog
Re: Fun with resistors
« Reply #74 on: September 12, 2015, 02:45:44 pm »
Just a small preview to what will come in V0.26:

A graph-plotter with
- fully customizable axes
- anti-aliased graphics
- polynomial interpolation
- cursor readouts etc.

Greetings,
Olli.
Jazz is not dead, it just smells funny
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19841
  • Country: gb
  • 0999
Re: Fun with resistors
« Reply #75 on: September 12, 2015, 08:56:29 pm »
I haven't installed/used the software yet.

There's an error in the PDF file posted. It talks about Rsum being the load presented to the source on an inverting and non-inverting amplifier which isn't true. With the inverting amplifier, the input resistor determines the load seen by the source and the feedback resistor, the load seen by the op-amp's output stage in parallel with the load. With the non-inverting amplifier Rsum determines the load connected the op-amp's output stage, in parallel with the load.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf