-->
Page 1 of 1

Color Code of Resistor

PostPosted: Tue Jan 18, 2022 4:27 am
by Nigella
Hey, guys!
I created a resistor program that calculates resistance from colors, but I'm not sure how to convert resistance to color. Can you assist me with putting this together?
For example, if I enter 100 ohms and a 5% tolerance, the hues brown, black, brown, and gold appear.
I’ve read some articles like https://www.apogeeweb.net/electron/a-guide-to-color-code-of-resistor.html, but I still have no idea.
Thank you so much for your assistance!

Re: Color Code of Resistor

PostPosted: Thu Jan 20, 2022 10:56 am
by rpiloverbd
Hello,

What is your plan? Will your programme output the resistor's picture with clearly shown colour bands? Or only the names of the colours?

Re: Color Code of Resistor

PostPosted: Thu Jan 20, 2022 11:26 am
by btidey
Resistors normally conform to values in the E series of standard values (E6, E12,E24,E48,E96,E192) where the number is the number of values in a decade of resistance e.g. between 10Ohm and 100Ohm. The E range used correlates to a large extent with the tolerance of the resistor. E.g 5% will be normally use for E12 values, whereas 1% could choose to use E96.

See https://www.electronics-notes.com/artic ... 48-e96.php

for a good background including the values in each E range

One strategy would first normalise the resistor value to a particular decade (say 100 to 1000Ohm) by multiplying or dividing by 10 (and remembering the overall normalising factor. Then look up the value in the various E tables of standard values. If you are inputting a free form resistor value then you would have to find the nearest standard value.

The looked up value now gives you the standard digits for the resistor value which can be mapped onto the colour values while the normalising factor will allow you to assign the colour for the multiplier band.

One extra complication here is that lower tolerance resistors will use E6,12,24 ranges and will have two colour bands to represent the digits + 1 for the multiplier but higher tolerance resistors using E48,E96 will use 3 digit colour bands + 1 for the multiplier.

Depending on how you are displaying you could potentially show the colour codes for each E series separately.