| General > General Technical Chat |
| Small and stupid decoder for EIA96 resistor markings |
| << < (2/2) |
| tooki:
--- Quote from: Benta on March 02, 2022, 07:36:57 pm ---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. --- End quote --- This 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 be systematic*, but it’s not obvious. *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… |
| tooki:
--- Quote from: magic on March 01, 2022, 10:59:04 am ---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 against this table. If somebody knows a more authoritative source, I will re-check. --- Code: ---$ eia96 01b 1000 --- End code --- You can even call it with an incorrect code or no argument at all and it will print some nonsense. --- Code: ---$ eia96 hello 98 --- End code --- Full code below. Straightforward stuff. The int(xxx + 0.5) part is rounding to nearest integer. --- Code: ---#!/usr/bin/perl -l my $d = substr($ARGV[0], 0, 2); my $e = lc(substr($ARGV[0], -1)); my $v = int(100 * 10**(($d-1)/96) + 0.5); $v *= 0.01 if $e eq "y"; $v *= 0.1 if $e eq "x"; $v *= 1 if $e eq "a"; $v *= 10 if $e eq "b"; $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; --- End code --- --- End quote --- Neato! 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 |
| magic:
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 E12 are not equally 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. |
| exmadscientist:
--- Quote from: magic on March 01, 2022, 10:59:04 am ---If somebody knows a more authoritative source, I will re-check. --- End quote --- Authoritative 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.) |
| wizard69:
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. |
| Navigation |
| Message Index |
| Previous page |