Small and stupid decoder for EIA96 resistor markings - Page 1
Forum section: electronics / general

author: magic
author_rank: Super Contributor
timestamp: March 01, 2022, 10:59:04 am
content: I was getting tired of using tables to decode those resistors, so I wrote a Perl script which takes the 3-symbol code and spits out its corresponding resistance value. It is probably mainly of interest to Linux users, because you just put it in your ~/bin and call it from terminal like any other program, but nothing stops one from porting the algorithm to some other language and/or platform. I verified one full decade of its output againstthis table. If somebody knows a more authoritative source, I will re-check.Code:$ eia96 01b1000You can even call it with an incorrect code or no argument at all and it will print some nonsense.Code:$ eia96 hello98Full code below. Straightforward stuff. The int(xxx + 0.5) part is rounding to nearest integer.Code:#!/usr/bin/perl -lmy $d = substr($ARGV, 0, 2);my $e = lc(substr($ARGV, -1));my $v = int(100 * 10**(($d-1)/96) + 0.5);$v *= 0.001 if $e eq "z";$v *= 0.01 if $e eq "y" || $e eq "r";$v *= 0.1 if $e eq "x" || $e eq "s";$v *= 1 if $e eq "a";$v *= 10 if $e eq "b" || $e eq "h";$v *= 100 if $e eq "c";$v *= 1000 if $e eq "d";$v *= 10000 if $e eq "e";$v *= 100000 if $e eq "f";print $v;

author: BeBuLamar
author_rank: Super Contributor
timestamp: March 02, 2022, 03:14:45 pm
content: You can read the resistor values without anything now?

author: Benta
author_rank: Super Contributor
timestamp: March 02, 2022, 07:36:57 pm
content: Nice idea.Downside is that it doesn't solve the problem of undecipherable colours on modern resistors, where blue/green or red/brown are indistinguishable from each other.

author: notsob
author_rank: Frequent Contributor
timestamp: March 02, 2022, 10:09:49 pm
content: just put electrodoc on your smartphone

author: ledtester
author_rank: Super Contributor
timestamp: March 02, 2022, 10:24:14 pm
content: Quote from: magic on March 01, 2022, 10:59:04 amIt's nice to see a perl program these days!

author: tooki
author_rank: Super Contributor
timestamp: March 05, 2022, 01:19:26 pm
content: Quote from: Benta on March 02, 2022, 07:36:57 pmThis has nothing to do with color bands. It’s about the stupid EIA96 codes on some SMD resistors: the code number tells you nothing about the value without a decoder sheet. It’s not like the other type of SMD resistor markings (the ones with a mantissa and multiplier) that are easily decoded without needing to memorize anything.For example, a 3.32k resistor is “3322” (332 x 102, easily remembered as “332 and two zeros”) but “51C” (51 because 3.32 is the 51st mantissa in the E96 series, and C meaning times 104).The EIA96 system may besystematic*, but it’s notobvious.*other than the multiplier starting with Y for 100, X for 101, then rolling around to A for 102, B for 103, all the way up to F for 107…

author: tooki
author_rank: Super Contributor
timestamp: March 05, 2022, 01:22:21 pm
content: Quote from: magic on March 01, 2022, 10:59:04 amNeato!FYI, another page on the same site also lists a few more multiplier codes: it appears some multipliers have more than one letter!https://www.hobby-hour.com/electronics/smdcalc.php#smd_resistor_code

author: magic
author_rank: Super Contributor
timestamp: March 06, 2022, 11:21:38 am
content: I added those alternative codes. Also, Z was missing (values <1Ω).I checked against Yageo RT series datasheet. That's not exactly a standard document but at least something that a real world manufacturer published. Both my script and the table at hobby-hour appear to be right.Which is not to be taken of granted, because some standard series like E12are notequally spaced within each decade, the midpoint being a good example - ideal value is sqrt(10) or about 3.16, but actual resistors are 3.3.

author: exmadscientist
author_rank: Frequent Contributor
timestamp: May 09, 2022, 06:17:10 am
content: Quote from: magic on March 01, 2022, 10:59:04 amAuthoritative source, you say? I may or may not have found this in over in Russian territory, but I guess these days that just means it's mine now? Even if I don't own a tractor?If anyone's looking at E192, be warned that some people use 919 and some people use 920. The correct answer, of course, is to pretend that E192 doesn't exist, because no one stocks it anyway, and just order custom instead because it's the same damn price and lead time.(The corrigendum is pretty worthless, though this one is less trivial than they usually are. There's no need to bother with it. But I post it because some people just have to know.)

author: wizard69
author_rank: Super Contributor
timestamp: May 11, 2022, 01:34:35 am
content: Thanks to everyone. Never really thought much about E96, so this was enlightening. As for the PERL code, it hurts my head, if I ever get a chance maybe a rewrite in Python.