Voltage Divider Calculators - Page 1
Forum section: electronics / projects

author: slugrustle
author_rank: Frequent Contributor
timestamp: April 02, 2018, 02:25:26 am
content: I recently spruced up two voltage divider calculatorshttps://github.com/slugrustle/voltage_divider/releases(two resistor version)https://github.com/slugrustle/high_voltage_divider/releases(three resistor version)that solve for voltage dividers nearest a target ratio using real world resistor values (ones you can actually buy). Each calculator is a single .html file that you can run locally; the calculations are performed with inline Javascript.Comments, feedback, and bug reports are welcome. I've found these useful and hope others do as well.

author: link87
author_rank: Newbie
timestamp: April 02, 2018, 07:29:41 pm
content: Nice work! I like that you account for tolerances on the resistors, too.

author: Simon
author_rank: Unknown
timestamp: April 02, 2018, 08:31:53 pm
content: nice job

author: Vgkid
author_rank: Super Contributor
timestamp: April 02, 2018, 08:55:30 pm
content: Nice job , had a quick mess around with it.

author: xani
author_rank: Frequent Contributor
timestamp: April 03, 2018, 05:19:31 am
content: You can use Github pages (https://pages.github.com/) to host your calculator directlyI've been using ElectroDroid (android app) for that and one thing it has over yours is ability to specify load resistance and include it into calculation. But it doesn't have 3 resistor mode so IMO it's a draw:). And the table output is very nice feature too.Other is personal quirk but entering a ratio as a fraction doesn't seem very convenient, Vi/Vo as an option would be nice. ElectroDroid also had an option where you just entered input and output voltage and it calculated ratio for you

author: slugrustle
author_rank: Frequent Contributor
timestamp: April 08, 2018, 09:15:27 pm
content: Thanks, xani, for the GitHub pages suggestion. I've put a page that links to both calculators athttps://slugrustle.github.io/I also added the ability to download results as a proper .xlsx spreadsheet, in addition to .csv.Edit: A coworker asked for the ability to put a four-function calculator expression in the "Target Ratio" input. I've written a parser but have yet to fully test and integrate it. Your thoughts, xani?

author: slugrustle
author_rank: Frequent Contributor
timestamp: April 11, 2018, 03:33:24 am
content: I just fixed a pretty serious bug that broke searches for minimum and maximum tolerance ratios in the three-resistor calculator. I also updated both calculators to accept mathematical expressions for the target ratio input (operators +, -, *, /, and parens). The latest is always athttps://slugrustle.github.io/.Not much else to do on these besides more testing, and maybe a nicer interface. I might make a calculator for comparator with hysteresis circuits at some point.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 11, 2018, 07:23:48 am
content: Cool!Nice touch to use inline SVG and scripts, I guess, makes it nice and compact. Also didn't realize what's involved in creating (or conversely, parsing) an XLSX, interesting.It's kinda redundant because these exist,http://jansson.us/resistors.htmlhttp://kirr.homeunix.org/electronics/resistor-network-finder/https://www.seventransistorlabs.com/Calc/ResDiv.html(among others)Though it does have a slightly different twist, that's missing from the others, and may be helpful.I noticed the problem, the other night, of having to combine the former two: one, to select resistors by given ratio; the other, to select resistors from a given set (not necessarily E-series, or the full series anyways). Satisfying both, is not a problem solved by either, alone....Kirill lurks around here, maybe he's watching this thread?Tim

author: slugrustle
author_rank: Frequent Contributor
timestamp: April 15, 2018, 03:59:00 pm
content: Just updated the two-resistor divider calculator to make the interface nicer (and the underlying code cleaner). Will update the three-resistor one after I do my taxes.Thanks, T3sl4co1l, for the links. I think jansson's is the closest to the design goals that I have for these calculators.1. Find optimal dividers using resistor values that can be purchased2. Calculator is a single file that can run locally on most computers3. Ability to target minimum, nominal, or maximum ratio over resistor tolerance4. Ability to limit results based on string resistance5. Calculator interface contains all info required to use it6. Results are computed quickly (< 1 second)I had previously made a brute force program that solved two and three resistor dividers in various configurations, but it was command line based and written in python (three resistor case was slow). Rewriting in C++ gave a 30x speedup, but I wanted to use it at work and thought that program would be too difficult to explain or share if someone else wanted to use it. I realized that web technologies could solve both the portability and usability problems of a command line program, while still running locally. Learning to use JavaScript, CSS, SVG, etc. has been quite fun.The spreadsheet output is a response to a feature request from a coworker. He wanted the calculator to compute quiescent current for the dividers. Since that requires information not related to the resistors themselves, I figured he could compute whatever he wanted if I added spreadsheet output. I would have left it at .csv, but I wrote a .docx report generator at a previous job and have wanted to figure out .xlsx spreadsheet generation ever since (they are both part of Office Open XML)."Also didn't realize what's involved in creating (or conversely, parsing) an XLSX, interesting."There are two ways to look at this:1. XLSX is just some .xml files in a .zip archive. Put what you want in Excel, unzip it, and automate the parts that can change.2. Read the ECMA376 standard; it's 6045 pages of interestinghttps://www.ecma-international.org/publications/standards/Ecma-376.htmI did enough of (2) to make (1) efficient, and to be able to only keep in what I needed (e.g. not the standard office themes). ECMA376 is so long because it covers .docx, .xslx, .pptx, the markup for drawings in Office, and some other shared features. It's well organized and helpful and contains the unintentionally hilarious phrase "End of informative text."

author: Kirr
author_rank: Regular Contributor
timestamp: April 24, 2018, 01:18:34 am
content: Nice tool, slugrustle! I'd be curious to see it try other topologies automatically. I.e., three-resistor divider can use one upper and two lower resistors. Reminds me to try making a similar tool some day too. Fun!

author: Kirr
author_rank: Regular Contributor
timestamp: April 24, 2018, 01:29:22 am
content: Quote from: T3sl4co1l on April 11, 2018, 07:23:48 amMy tool unfortunately does not care about ratio, so can't make an optimal divider. You have to fix either upper or lower resistance, and then it will find the fitting counterpart, but it does not optimize the entire divider. But as you say a number of nice divider finders exist already. Still I think much more can be done in this area.QuoteNow noticed it!

author: german77
author_rank: Regular Contributor
timestamp: April 24, 2018, 04:42:49 pm
content: Have a look on minehttp://www.ifs.com.mx/Electric/, it doesn't calculate the value of the resistances. But takes on account tolerances, wattage and load.It's a fantastic tool if you want to see the expected performance, efficiency and temperature. In a dynamic load.It needs more work because it's not 100% reliable, specially calculating max and min values. But in most cases it's spot on.I will be happy to work together and make a complete and reliable voltage divisor calculator, and we can use my domain to leave it public for everyone