# Resistor Color Code Calculator With Arduino

19,260

104

35

## Introduction: Resistor Color Code Calculator With Arduino

This is a 4 band Mechanical Color Code Resistor Calculator, The idea of making this Mechanical Resistor came when I accidentally dropped my box of resistors and all resistors (1300 of them) got mixed up. ooops! . Thank god there's an APP  for that, So while picking them up (the resistors) and soaring them out I was thinking, how cool would it be to have a big resistor that you can actually manually rotate the bands and get the resistor value right away.  If you are into electronics and you are really passionate about it like me, you're always looking for projects and challenges to take on all the time. So, with that idea and a vision in mind I started working  on my new project, of course  with the help of Arduino UNO microcontroller.
HOW DOES IT WORKS?
There are 4 small stepper motors , 4 stepper motor drivers, 4 10K potentiometers and 2 Arduino UNO on a breadboard. As you turn the potentiometer,  the motors rotate displaying a color and a value at the same time.

## Step 1: Material List

SP = www.sparkfun.com ,  YD = www.yourduino.com , J = www.jameco.com , HP = Home Depot
ARDUINO UNO  ON A BREADBOARD COMPONENTS LIST                ( J )

At Mega 328p with arduino UNO boot loader
5v Voltage Regulator 7805-T
LED  (2 red ) and (2 green)
resistor 1/4 w, 10k and 180 ohms
Ceramic Capacitor disc 22pf 50v
ceramic Capacitor disc 0.1uf 50v
Tantalum Capacitor 10uf 25v
16Mhz Crystal low-profile
Pushbutton switch, off/on

Stepper Motor with driver board                                        (YD)
Blue LED light                                                                   (YD)
Panel mount LED holder 5mm                                          (YD)
DPDT On /OFF switch                                                      (YD)
10k small Potentiometer                                                    (YD)
10k Potentiometer chicken head Knob                              (SP)
9v Battery holder (Pack of two)                                         (YD)
9v Battery                                                                          (YD)
6v, AA Battery case                                                          (YD)
AA Battery (pack of 4)                                                       (YD)
40pin flat cable female ends                                             (YD)
Breadboard 16cm with power and Grd busses                 (YD)
Breadboard 8cm with power and Grd busses                  (YD)
Mini Digital Voltmeter 0-30v dc (red)                                (YD)
Hook-up wire, solid (black, Red & Green)                        (SP)
solder tube .031 Inch Dia.                                                 (SP)
Liquid Tape 4FL. OZ                                                        (HD)
Servo Mounts                                                                   (SP)
Screw-Phillips head (1/2", 4-40, 10-pack)                       (SP)
Nut metal (4-40, 10-pack)                                               (SP)

wood screws #6 x 3/4" pan head Phillips                 (HD)
11/32", 2' x 2' Plywood sheet                                    (HD)
MINWAX wood finish stain (provincial 211)             (HD)
Primer spray paint                                                    (HD)
Gold spray paint                                                       (HD)
1/8" Plexiglas 11" x 14"                                             (HD)
Compressed wood                                                   (HD)
Narrow utility hinges 1"                                            (HD)
1/2" x 2' PVC pipe                                                     (HD)
1/2" PVC 90* elbow                                                  (HD)
1/2" PVC coupling                                                      (HD)
2" PVC pipe Blocker                                                  (HD)
2" x 2' PVC pipe                                                        (HD)
3" PVC pipe Blocker                                                   (HD)
3" x 2' PVC pipe                                                         (HD)
Nailed metal bridging                                                  (HD)
4" (10cm) Cable Ties                                                   (HD)

## Step 2: Building the Enclosure

Start by cutting the six pieces that make the enclosure, the first piece would be the base (bottom piece).

1) Grab the 11/32", 2' x 2' Plywood sheet and cut a 14" x 11" piece.

2) Cut the side pieces, (see 2nd picture) for measurements.

3) Cut a 13 1/8" x 2" piece, this is the back part of the enclosure. (See 4th picture)

4) Cut a 13 1/8 x 2 1/2 piece, and drill two 1" hole on each side. This is the top piece of the enclosure.

(see 5th picture) for measurements.

5) Put the enclosure together, use the #6 x 3/4" wood screws.

6) After the enclosure is been assembled, is time to sand and stain the enclosure. (pix 6)

## Step 3: Front Panel

Cut a 14" x 2 1/2 " piece of the compressed wood, and drill 6  1/4" holes for the pots. You may have to check the drill bit size for  the LED holder and switch. Depending of what LED holder and switch you get.
(see 2nd picture). Next paint the panel and let it dry before installing the pots, LED and switch.
(see 3rd picture) for measurements.
Next cut (16)  12" long of hook up wire, solder each wire to each potentiometer terminal, the LED and the switch. Make sure you use electrical liquid tape or shrinking tube to cover the splices. (see last pictures). Last screw the panel to the enclosure.

## Step 4: Motors Support Bracket and Side Posts

Grab the nailed metal bridging bracket and put a line across on each end , right where the curved shape ends (see 1st picture). Measure 1/2" from the first line put a 2nd mark across, then make a 3rd line across 1/2". First bend the bracket 45* on the first line, then make a second 45* bend on the second line. Do it to both sides. (see picture 2,3,4,5).

Next cut the bracket in half, and place on piece on top of each other and tape them together,it should measure 9" from side to side (see picture 6,7,8,9). Last drill two holes on both ends of the bracket (see picture 10,11) and cut the rest of the end of the bracket at the 3rd line across it .

Now we are going to work on the side posts (PVC pipes)that hold the motors support bracket.

cut (2) 2 1/2" of 1/2" PVC pipe, and place the 1/2 " elbow on one side and the coupling on the other. (see picture 12,13,14) Once both pieces assembled is time to paint them. (I used automotive primer spray)

While the two posts are drying get the (2) 3" PVC pipe blocker and place them back to back together and drill a 7/8" hole in the center on both pieces at the same time, so you'll have the center holes of both blocker matching each other and will make the motor support bracket level without any more adjustmentsto make. Last test fit the posts make sure they fit on the enclosure and through the 3" PVC pipe blockers. Do not glue them together at this point. See pictures 15 - 22.

## Step 5: Mounting and Making the Motors Base.

Now we're going to cut a 9 1/2" piece of Plexiglas this is the stepper motor base and drill (8) 3/16" holes (see picture 2,3,4) for measurements. Start by bolting the servo mounts from sparkfun to the stepper motors using the 1/2",4-40 bolts and nuts. Now place the motor on top of the Plexiglas aligning the rear motor mount with the holes previously drilled. Now mark the rest of the motor mount holes and drill them with a 3/16" bit (see picture 5,6,7,8). bolt them down and use 2 #6 flat washers on each hole of the motor mounts (see picture 9,10,11). Now place and center the Plexiglas piece on the motor bracket and drill (2) 3/16" holes through the Plexiglas onto the bracket, one on each side about 2" from each end (see picture 12,13,14,15)and bolt them together using1/2",4-40 bolts and nuts. finally get the motor support bracket and bolt it to the 3" blocker with the 1/2", 4-40 bolts and nuts. 2 per side, as close as you can to the opening in the middle (see pictures 16,17). Now place the posts on the enclosure (see last pictures).

## Step 6: Making and Mounting the Wheels (bands)

For this step you will need:
• 2" PVC Pipe
• 2" Knock out plug (4)
• 1/4" drill bit
• Label roll
• Color sharpies (black, brown, red, orange, yellow, green, blue, violet).
•  A utility knife Glue stick.

Cut (4) 3/4" thick  piece of 2" PVC Pipe (see picture 1,2,3). Next drill a 1/4" hole in the center of the knock out plugs. Place 2 knock out plugs together back to back and drill a 1/4" hole through both of the pieces. Make sure these holes a centered to the knock out plugs. Do the same for the other two plugs
(see picture 4,5,6). Get (4) binding post and cut 1/4" off the top (see picture 7,8), now place the knock out plug on the 2" , 3/4" thick PVC piece and the post through the knock out plug. do not glue jet, this is just to test to fit step (see picture 9,10).

Pull out 4 piece long ,  8 1/2" off label roll, and draw a line across every  3/4" , you should end up with (11) 3/4" sections per piece (see picture 11,12,13). Now put a light coat of stick glue on each band ( I am going to refer to the 2", 3/4" thick PVC Pipe as bands from now on) and wrap the 8 1/4" label piece around each band, you end up over lapping the last section onto the first one  see picture 14,15,16). Grab the utility knife and trim the label as close as you can to the band's outer edge (see picture 17,18).

Now time to color the bands, grab two bands,  color and number them in this order:
• BLACK  0 (use a white or silver sharpie to number the black section)
• BROWN  1
• RED  2
• ORANGE  3
• YELLOW  4
• GREEN  5
• BLUE  6
• VIOLET  7
• GRAY  8
• WHITE  9
The Gray section was colored using a #2 pencil, go over the section with a very light pressure.

Color the 3rd band (The multiplier) and number them as follow:
• BLACK  (Do not number this section)
• BROWN  0
• RED  00
• ORANGE  1K
• YELLOW  10K
• GREEN  100K
• BLUE  1M
• VIOLET  10M
• GOLD  0.1
• SILVER 0.01

The 4th band is the tolerance in percentage, color and number as follow:
• BROWN  1%
• RED  2%
• GREEN  0.5%
• BLUE  0.25%
• VIOLET  0.1%
• GRAY  0.05%
• GOLD  5%
• SILVER  10%
• last section do not color just write the word "plain" an number it  20% under the word plain.
See picture 19,20) and see last picture, is the chart with the color and values of each band, and I purposely taped off one section so it won't confuse you, you don't need that section. That section is for a 5-band resistor.

## Step 7: Wiring the Small Stepper Motors

Time for the fun part. You are going to extend the wires of the motors so they can reach the motor driver boards down in the enclosure. Grab the Cat5e and cut (4) 12" long sections and peel the jacket off, exposing the conductor inside. now grab 5 of those conductors and label each wire on both ends as follow:
• BLUE (1st wire)
• PINK (2nd wire)
• YELLOW (3rd wire)
• ORANGE (4th wire)
• RED (5th wire)

now, cut off the connector of each motor at about 3 1/2" away from the connector. Take the one end of the labeled Cat5e and solder each wire to the wires on the motor to their corresponding color. Cover the splices with shrink tube or liquid electrical tape. Do the same to the rest of the stepper motors.
Once all the motor's wires had been soldered and covered,  tape each motor wires together and label them motor  1, motor 2, motor 3 and motor 4. Run the other end of the wires down into the enclosure through the side post one by one. Make sure you label each bundle, 2 set of wires per side post. Now save the stepper motor connectors,  you'll need them to plug them into the driver boars later. Once done with the wiring, install the band on each motor, just slide he the bands on the motor shaft.
See pictures for reference.

## Step 8: Installing the Electronic Components

I decided to go with the Arduino  UNO on a breadboard to keep the budget low. You can use anything you want as long as you can upload the Arduino sketch.  There is a very good step by step guide on how to put the Arduino UNO on a breadboard together. Here is the link

http://www.jameco.com/Jameco/Products/ProdDS/2151259.pdf

Remember you need to build 2 of these. Once your done, start by placing the stepper motor drivers on the top  inside of the enclosure at about 2 1/4"  center to center apart from each other). Screw the driver boards down one on each side opposite corners. (see picture 1,2,3) . Now place the bread board with the Arduinos on it on the lower left side of the enclosure, get the 2nd small bread and place it on the right side lower corner level  with the first bread board. Peel off  the backing paper exposing the adhesive on the back of the bread boards on place them down and put pressure on it for 2 minutes.
Next place the one 9v battery holder on the left side of the left bread board and place the other 9v battery holder in between both bread boards . Screw them down. And last screw down the AA battery pack on the upper right corner of the enclosure. see pictures for reference.

## Step 9:

here is the schematic of the entire project.

## Step 10: Arduino Sketch

#include <Stepper.h>
#define STEPS 100

Stepper stepper1(STEPS, 9,11,10,12);
Stepper stepper2(STEPS,1,3,2,4);
int previous1 = 0;
int previous2 = 1;
void setup()
{  //How fast will we try to move the motor  //If your motor stutters, its too fast so just lower the value
stepper1.setSpeed(150);
stepper2.setSpeed(150);
delay(500);
}

void loop()
{

int val1 = map(analogRead(0), 0, 1023,0,2046);  //Move motor based off of last recorded position
int val2 = map(analogRead (1),0, 1023,0,2046);
stepper1.step(val1 - previous1);  //Store current position
stepper2.step(val2 - previous2);
previous1 = val1;
previous2 = val2;
}

## Step 11: Wiring

For this step I encourage you to print out the schematic and familiarize with the components, doing so will make it easier for you to wire your components.
we are going to start by wiring the connectors back to the stepper motors . Starting from the 1st motor on the left, grab the end of the cat5e wires that we soldered  to the motors in step 7, and solder them to the motor connectors with their corresponding color. At this point cut the wires short in length, just enough wire to reach the driver boards. Do the same for the rest of the motors.
Now we wire the (2) Arduino boards, start with the first stepper motor driver board on the left and connect a  4 conductor female connector and from there to the first Arduino's pin D1,D2,D3,D4 (see picture 1,2,3,4,5)
Here is the pin order:   1st  Arduino              Driver Board 1      2nd Arduino            Driver Board 3
D4                            IN1                            D4                              IN1
D3                            IN2                            D3                              IN2
D2                            IN3                            D2                              IN3
D1                            IN4                            D1                               IN4
Driver Board 2                                         Driver Board 4
D9                            IN1                            D9                              IN1
D10                          IN2                            D10                            IN2
D11                          IN3                            D11                            IN3
D12                          IN4                            D12                            IN4

Now we need to power the stepper motor's driver boards. Connect a 2 conductor female connector extension wires to the board positive "+" and negative  " - " terminals, then connect the other end to the small bread board's positive and negative bus bars. Positive to red bus bar and Negative to blue buss bar (see schematic and picture 6,7,8).
Next , take the 3 wires coming from the first pot on the left and connect one of the outside terminal wire to the positive bus bar (red) of the Arduino's bread board, and connect the other outside terminal wire to the negative bus bar (blue) of the bread board. Do the same for the other 3 potentiometers. Now take the middle wire of the first potentiometer on the left and connect it to the 1st Arduino pin A0. The middle wire of the 2nd potentiometer to 1st Arduino Pin A1. The 3rd Potentiometer middle wire to 2nd Arduino Pin A0 and the 4th potentiometer middle wire to the 2nd Arduino Pin A1 (see schematic and picture 9,10,11).
Now we are going to wire the SPST switch. Solder the 3 wire to each terminal of the switch.  3 of those wire are going to the power block of the bread boars, one for each Arduino and one for the motor's power supply. Now solder the other 3 wires to each battery positive wire. (see picture 12). Now the LED, solder one wire to the short leg of the LED and connect the other end to the small bread board Negative bus bar (blue). Now solder one wire to the long leg of the LED and connect the other end on the small bread board to a 220 Ohms resistor., and the other end of the resistor to the Positive bus bar (red)of the small bread board. At last upload the Arduino sketch on each Arduino and install the 9V batteries (one for each Arduino) and the 4 1.5V batteries for the stepper motors. Test you  circuit make sure everything works and use tie wires to arrange wires nice and neat in the enclosure (see picture 13,14,15).
CONGRATULATIONS YOU ARE DONE , YOU ARE FINALLY DONE.

## Step 12: Resistor Front Cover

Now to make the resistor cover,  cut a 10 7/8" of the 3" PCV pipe.  Then cut it 2/3 in diameter (see  picture 1,2,3,4,5,6). Place the first 3 motor bands apart from each other at a same distance, and place the front cover in front of them and mark each location of the bands on the cover (see picture 7,8,9,10,11,12,13).
Now cut a 3/4" x 3/4" opening on each location, I used a Dremel  to cut the openings and then a file to make the openings  smooth and square (see picture 14,1,16,17,18,19) . Next place a piece of tape on top and across each band and is ready to be painted. I used a glossy gold color. Once the paint is dried just peel the tape off  (see last pictures 21,22). Now grab the Plexiglas and cut a 14" x 5 7/8 piece, install the hinges on the Plexiglas and then onto the enclosure. (see picture 23,24)

## Step 13: Conclusion

In conclusion, personally  this was a very  good experience for me. I had an idea and a image to start with and how I wanted the project to look like, and it came out really good. It was tedious at times, I had to stop for a week, then come back to it, then stop again and then everything came to a stop when I got to the bands. I  spend so much time to figure out how to tackle this problem. Finally after spending 2 good hours at home depot, I spotted the knock out plugs and from there it led me to the 2" PVC pipe and the 3" PVC pipe to make the cover and so on.. This project took me  two months  to build, at about 42 hours on and off. I hope you enjoy building one like I did and for me It was worth it 100%.
Good Luck.

Participated in the
Arduino Contest

Participated in the
Epilog Challenge V

Participated in the
Battery Powered Contest

## Recommendations

14 1.0K
4 564
147 12K
1 530
• ### Anything Goes Contest

i think i'd go in a slightly different direction, which would be a complete redo, terminals to put a resistor across, the wheels would rotate to the value it reads, with a segmented led backup. 10% resistors could be an increment or two out, a faster way of verifying the values, or perhaps relabelling would be really nice.

This is really cool. Can't tell you how many times I've done that. It took me two days one time to reorganize. Thanks for the tip.

I'd like it better if you could just point the beak of the chickenhead knob on each pot to the applicable color and have it output the value from there. Kind of a different approach, but I'm sure you could have done it just as easy.

Great project, I was thinking of doing something similar to help my son learn resistors (he's autistic so he learns differently) & I was thinking of rotary dip switches w/ the colors & servos instead of stepper motors 'cause it would take less power & it would be allot faster.

All in all great work though.

But this misses the point entirely of having a mechanical resistor! you should have leads sticking out the ends of the resistor, and actually have the indicated resistance across them. Otherwise, you'd be just as well off (if not better) by just having a hunk of PVC pipe with some rings around it that you turn by hand.

I see your point. I'd been talking with some friends about making this project practical and easy to use.

hello its near to be the more useless machine ever build, it expensive to be build, take too much time, and the more important too slow to resolve the resistors value, but, no doubt, it is an excelent project, and well done.
otherwise, the idea of numbers inside the appropiate color, is a good idea to build a simple cilinder with all the rings operated manually, thanks a lot, good luck

I could change the code so it would rotate faster to resolve the resistor value. I want to get a LCD and numeric key pad to replace the pots, that will make it practical.

excelent plan, you give me the idea of a touch screen, with bars for each figure, where you can touch the colours of the bars, and get the value, but i know it could turn in another project, because there will be no electronics and mechanical parts in place, but could be interesting too, good luck!

I learnt them long time ago, but I though of having a mechanical resistor will be kind of cool.

Nice work! It;s just the way I like my projects, overly complicated electronics to do a simple task :)

There is something about complicated projects that I like. The challenge probably.

WOW! You must have a lot of spare time on your hands! :-) Nice job though!

I wish, I started this project back in December, 2012 and finished it on May, 2013.