ResCalc - a freeware series/parallel resistor calculator for E12-E96 series

Discussion in 'General Electronics Chat' started by SgtWookie, Aug 6, 2011.

  1. SgtWookie

    Thread Starter Expert

    Jul 17, 2007
    22,182
    1,728
    Ever need an odd value of resistance and want to know what combinations of resistors to use, without having to do all the math?

    Then this little DOS and Windows-compatible utility I wrote is for you. You just tell it what series resistors you have on hand (if you're not sure, use E12 or E24) and then start feeding it the resistance values you need. It will give you up to 80 different combinations of series/parallel configurations that you can use to get close your desired resistance, and roughly what the percentage of error will be, up to 20 results per page.

    Example output from requesting a 62.5 Ohm resistor using E24 series:

    [​IMG]

    It's a bare-bones utility, nothing flashy - just functional. The idea was to write a reasonably compact (260kb) and useful utility program that would run without installation on any Windows or DOS platform; just copy the executable to a convenient location (like your desktop) and click on it to run. Be aware that on slow machines it will take awhile to find all the combinations for E96 resistors.

    I used a freeware compiler called "Yabasic" - Yet Another Basic - that has compilers that will run on Windows and Unix platforms:
    http://www.yabasic.de/
    with the idea that if this works well for Windows users, I'll try compiling it under Ubuntu and see how that goes.

    I'd appreciate it if some of you would give it a try, and post back here if you find bugs with it.

    A known limit is the accuracy of the error percentage when displaying low-value resistors; it's a limitation of the language and I'm not very inclined to come up with a work-around.

    [eta]
    Added rescalc.yab - Yabasic source code to .zip file

    [eta]
    Updated ResCalc.zip - both source code and executable updated:
    1) There was a bug that resulted in higher-value resistance pairs not being calculated; bug fixed.
    2) Improved internal documentation.
    3) Replaced some GOTO statements with while/wend constructs.
     
    Last edited: Aug 6, 2011
    tom66 and PeeSeeBee like this.
  2. pilko

    Senior Member

    Dec 8, 2008
    213
    20
    Nice work Wookie --- simple, fast and accurate.

    Thanks,

    pilko.
     
  3. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Well, seems to work fine. Thanks. If I find a value where it could have found a better combination I'll post it.
     
  4. iONic

    AAC Fanatic!

    Nov 16, 2007
    1,420
    68
    You a few days late! I was just wishing I had something like this. I knew it must exist too, but that it would have taken more time than I had. This will save some time in the future.
    Nice find.
     
  5. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    In spite of SgtWookie's good reputation, I would recommend against using any executable without being able to examine the source code to make sure it doesn't do something malicious. I advise this even after a virus scan. Note I am NOT saying SgtWookie wrote anything malicious; I'm just recommending practicing safe computing. If you don't know how to "vet" software that you haven't written, I recommend you don't use it.

    Wookie, I would recommend you include the source code to your tool in addition to the executable.
     
  6. SgtWookie

    Thread Starter Expert

    Jul 17, 2007
    22,182
    1,728
    Someonesdad, point well taken.
    The source code (it's plain text) has been added to the ResCalc.zip attachment.

    Nothing fancy, violates modern coding standards due to GOTOs; I'd started writing it for another version of Basic, but the other version required packaging a run-time executable with a bunch of DLL's and I didn't want it to be that unwieldy - so in the rather hasty conversion process, I discovered that this Yabasic wasn't as well-behaved in looping structures as the other Basic was (didn't like nested loops) - so the Goto's were a "band-aid". This is the reason I didn't initially package the source with the executable; as it's not all that pretty.
     
  7. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
  8. SgtWookie

    Thread Starter Expert

    Jul 17, 2007
    22,182
    1,728
    I just updated the .zip file; source & exe file both have been updated to fix a bug with not calculating higher value pairs properly; replaced some GOTOs with while/wend constructs, moved some calculations outside of the main loop, and improved the documentation within the source code.

    If you've downloaded the program prior to now, please download the updated .zip.
     
    Last edited: Aug 6, 2011
  9. PeeSeeBee

    Member

    Jun 17, 2011
    43
    7
    Nice little program. I'm sure it will get a lot of use.
     
  10. RRITESH KAKKAR

    Senior Member

    Jun 29, 2010
    2,831
    89
    Can you let me know what is the diff. in these E24...E26..etc.??
     
  11. PeeSeeBee

    Member

    Jun 17, 2011
    43
    7
  12. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    Not to be confused with ResCalc.

    This is a good example of the problem of a big internet with small file names!
     
  13. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    I don't know if this has been mentioned yet or not, but you can measure the resistor you are trying to tweak and get much closer still. The accuracy of the meter becomes the limiting factor.
     
  14. SgtWookie

    Thread Starter Expert

    Jul 17, 2007
    22,182
    1,728
    Argh! Well, I guess I'll have to re-name it. Maybe ResPScalc or R_SerPar...

    [eta]
    Just did a quick search on ResCalc - someone else apparently had a similar idea; but theirs is a GUI, more compact than the one I did but couldn't be ported to Unix, has E24/E96 only, just reports 3 combinations, the results aren't always the closest, but it shows the resistors' colors (selectable # of bands) for the best match.
    http://www.pmillett.com/rescalc.htm
     
    Last edited: Aug 7, 2011
  15. SgtWookie

    Thread Starter Expert

    Jul 17, 2007
    22,182
    1,728
    Ahh, I'm not quite sure what you mean there, Bill?
     
  16. tom66

    Senior Member

    May 9, 2009
    2,613
    214
    That is an excellent utility SgtWookie. It works with Wine (on Ubuntu) too, see screenshot.

    A while back I wrote a program to calculate the output voltage of a resistive divider. Except, in this case I wrote it in PHP and put it on my local web server so I could use it for myself. However I just copied it over to my live web server so now everyone can use it. Please use it sparingly as I am paying the bills (although it is a fixed amount, I might get told off for getting a million hits a month.)

    http://www.tgohome.com/Utilities/VoltDivCalc.php

    It's also useful for LM317 adjustable regulators: just use 1.25V as the output voltage and set R2 to 220-240 ohms. It must be R2 and not R1 as in the LM317 datasheet due to how the program works.
     
  17. SgtWookie

    Thread Starter Expert

    Jul 17, 2007
    22,182
    1,728
    Hey Tom, thanks for testing it under wine. I felt reasonably sure it would work there too, but the laptop with Ubuntu I have here is a tad bollixed; someone replaced the launcher functions with web browsers, and I'm not sure how to fix it.

    Would you mind creating the Unix equivalent of a .zip file (I think it's .tz?) and uploading it so others can try it?
     
  18. tom66

    Senior Member

    May 9, 2009
    2,613
    214
    .zip opens on Ubuntu no problems. I am unable to attach a .tar.gz as it is not an allowed extension, so I have renamed it to a .doc file.
     
  19. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    Just FYI, the resistor.cpp C++ program in this thread does a similar thing besides calculating voltage dividers -- and it lets you enter a table of your resistors on hand (or use E series resistors like Wookie's program). I mention this only because some folks might not know it's there, as all the title says is it's a voltage divider program. In fact, I use it more for getting a resistor value than for voltage dividers.
     
  20. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,575
    230
Loading...