Saturday, February 26, 2011

Resistor value calculator in HTML5

A resistor is a two-terminal electronic component which implements electrical resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant of proportionality is known as the resistance R, since, with a given voltage V, a larger value of R further "resists" the flow of current I as given by Ohm's law.


Most axial resistors use a pattern of colored stripes to indicate resistance. Surface-mount resistors are marked numerically, if they are big enough to permit marking; more-recent small sizes are impractical to mark. Cases are usually tan, brown, blue, or green, though other colors are occasionally found such as dark red or dark gray.
Early 20th century resistors, essentially uninsulated, were dipped in paint to cover their entire body for color coding. A second color of paint was applied to one end of the element, and a color dot (or band) in the middle provided the third digit. The rule was "body, tip, dot", providing two significant digits for value and the decimal multiplier, in that sequence. Default tolerance was ±20%. Closer-tolerance resistors had silver (±10%) or gold-colored (±5%) paint on the other end.


Four-band identification is the most commonly used color-coding scheme on resistors. It consists of four colored bands that are painted around the body of the resistor. The first two bands encode the first two significant digits of the resistance value, the third is a power-of-ten multiplier or number-of-zeroes, and the fourth is the tolerance accuracy, or acceptable error, of the value. The first three bands are equally spaced along the resistor; the spacing to the fourth band is wider. Sometimes a fifth band identifies the thermal coefficient, but this must be distinguished from the true 5-color system, with 3 significant digits.
For example, green-blue-yellow-red is 56×104 Ω = 560 kΩ ± 2%. An easier description can be as followed: the first band, green, has a value of 5 and the second band, blue, has a value of 6, and is counted as 56. The third band, yellow, has a value of 104, which adds four 0's to the end, creating 560,000 Ω at ±2% tolerance accuracy. 560,000 Ω changes to 560 kΩ ±2% (as a kilo- is 103).

To try out EaselJS (a javascript library for working with the html5 canvas element) and inspired by Resistor Colour Wheel I wrote a small experiment, that can help finding the value of resistors: HTML5 Resistor calculator.




ALERT! This experiment won't work at all in Internet Explorer. You need Chrome, Firefox, Safari or any other browser supporting HTML5.

3 comments:

mesh said...

Great example. I added it to the EaselJS Examples wiki page:

https://github.com/gskinner/EaselJS/wiki/Examples

mike chambers

mesh@adobe.com

Roman said...

I created a google gadget using your script ( http://rm-gadgets.googlecode.com/svn/trunk/resistor-calculator/resistor-calculator.xml )
If you don't mind i'd like to publish it.

Thanks, Roman.

teste said...

+Roman, go ahead :)