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

Thread Starter

SgtWookie

Joined Jul 17, 2007
22,230
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:



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.
 

Attachments

Last edited:

iONic

Joined Nov 16, 2007
1,662
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.
 

someonesdad

Joined Jul 7, 2009
1,583
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.
 

Thread Starter

SgtWookie

Joined Jul 17, 2007
22,230
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.
 

Thread Starter

SgtWookie

Joined Jul 17, 2007
22,230
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:

Wendy

Joined Mar 24, 2008
23,415
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.
 

Thread Starter

SgtWookie

Joined Jul 17, 2007
22,230
Not to be confused with ResCalc.

This is a good example of the problem of a big internet with small file names!
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:

tom66

Joined May 9, 2009
2,595
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.
 

Attachments

Thread Starter

SgtWookie

Joined Jul 17, 2007
22,230
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?
 

tom66

Joined May 9, 2009
2,595
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?
.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.
 

Attachments

someonesdad

Joined Jul 7, 2009
1,583
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.
 
Top