Function Repository Resource:

FromResistorColorCode

Source Notebook

Determine the resistance of an electronic resistor from a specified list of colors

Contributed by: Jeff Bryant

ResourceFunction["FromResistorColorCode"][colorlist]

determines the resistance of an electronic resistor from the specified colorlist.

ResourceFunction["FromResistorColorCode"][colorlist,tolerance]

determines the resistance of an electronic resistor from the specified colorlist and tolerance.

Details and Options

Depending on its input, ResourceFunction["FromResistorColorCode"] may return a pair of values when there are equivalent representations.
Values for tolerance must be one of 0.05%, .1%, .25%, .5%, 1%, 2%, 5% or 10%.
tolerance can only be specified when the colorlist has three or four values.
For a list of five colors, the last color is the tolerance.

Examples

Basic Examples (3) 

Specify a list of colors to obtain the resistance and/or tolerance:

In[1]:=
ResourceFunction["FromResistorColorCode"][{Red, Red, Blue}]
Out[1]=
In[2]:=
ResourceFunction[
 "FromResistorColorCode"][{Red, Red, Blue, Brown, Brown}]
Out[2]=
In[3]:=
ResourceFunction[
 "FromResistorColorCode"][{"Silver", Red, Blue, Brown, Brown}]
Out[3]=

A list of 4 colors is ambiguous since its not clear if the last color is part of the resistance or the tolerance:

In[4]:=
ResourceFunction["FromResistorColorCode"][{Red, Red, Blue, Brown}]
Out[4]=

Specify the tolerance color explicitly:

In[5]:=
ResourceFunction["FromResistorColorCode"][{Red, Red, Blue}, Brown]
Out[5]=
In[6]:=
ResourceFunction[
 "FromResistorColorCode"][{Red, Red, Blue, Brown}, Brown]
Out[6]=

Properties and Relations (1) 

FromResistorColorCode can take the result of ResistorColorCode as an argument. To get a unique result, you may have to select which color list item you wish to use in cases where ResistorColorCode returns multiple color lists:

In[7]:=
ResourceFunction["FromResistorColorCode"][
 ResourceFunction["ResistorColorCode"][Quantity[22000, "Ohms"]][[1]]]
Out[7]=

Possible Issues (2) 

The color list must have at least 3 colors and less than 5:

In[8]:=
ResourceFunction["FromResistorColorCode"][{Red, Red}]
Out[8]=
In[9]:=
ResourceFunction[
 "FromResistorColorCode"][{Red, Red, Blue, Brown, Green, Red}]
Out[9]=

Silver and gold are not a System colors so referencing them by name requires using a string:

In[10]:=
ResourceFunction[
 "FromResistorColorCode"][{"Silver", Red, Blue, Brown, Brown}]
Out[10]=

Version History

  • 2.0.0 – 14 November 2019
  • 1.0.0 – 25 September 2019

Related Resources

License Information