## Introduction: How to Achieve Any Resistance/Capacitance Using Components You Already Have!

*This is not just another series/parallel equivalent resistance calculator! This program calculates how to combine resistors/capacitors that you presently have to achieve a target resistance/capacitance value that you need.*

Have you ever needed a specific resistor or capacitor that you don't have or that doesn't exist? Have no fear! You can probably make that specific resistance or capacitance value using components you already have. Instead of solving a huge multivariable optimization problem with millions of different combinations, use this program!

Just select resistor or capacitor, enter the target value, input the max number of components you would like to use, enter a list of the values of the components you have, and click calculate! The program will spit out what components to use and how to connect them to achieve your target value.

To try out the calculator, visit this web application.

To view the source code, visit this Github repository.

Please let me know if you have any suggestions to further improve the usability of this design tool!

## Step 1: Background

This web application was developed out of necessity. There are many different circuits I construct that demand a very specific resistor or capacitor. A lot of times, I don't have a resistor or capacitor with that specific value. Sometimes they don't even make a component with that unique value! Instead of giving up or settling for something that's less than ideal, I decided to write a program to look at every possible combination of resistors (every possible value and whether they are in series or parallel) and return the best combination.

When designing the circuit for my organ as a part of my Battle of the Bands Instructable Project, I had to try to hand calculate the best combination of capacitors to achieve a specific frequency. This process was incredibly tedious and I eventually just gave up and went with capacitor combinations that produced any amount of audible frequency. Now with this web application, I can design my organ for a specific frequency and tune it to the notes on a keyboard! The equation below is used to calculate the specific frequency and is discussed in the other Instructables project.

f = 1 / (0.693×C×(R1 + 2×R2))

Using this equation where R1 = 100 kOhm and R2 = 10 kOhm, I calculated that a 27.33 nF capacitor will produce an A4 note (frequency 440 Hz). Using my program, I was able to calculate an equivalent capacitance value within .001 nF (much less than the tolerance on a standard capacitor) that I can create using capacitors I already had lying around. The resulting output and configuration is described below. I am now able to much more efficiently and effectively tune my organ to the exact frequencies of standard notes. I wish I had done this to begin with. My demo song on the organ probably would have sounded much better.

Closest Value: 27.329 nF

Difference: 0.001 nF

Capacitor Configuration: C0=0.068 nF || C1=30 nF + C2=300 nF

### Resistor Capacitor Equivalence Equations

For reference, below are the equivalence equations for combining resistors and capacitors in a circuit.

- Resistors in series (R1 + R2): Req = R1 + R2
- Resistors in parallel (R1 || R2): Req = 1 / (1/R1 + 1/R2)
- Capacitors in series (C1 + C2): Ceq = 1 / (1/C1 + 1/C2)
- Capacitors in parallel (C1 || C2): Ceq = C1 + C2

## Step 2: Inputs

There are 4 inputs you will need to provide:

- Whether you are calculating a value for a resistor or a capacitor.
- The target resistance or capacitance value and the units.
- The maximum number of components you would like to use to achieve the target value (i.e. I would not like to use more than 3 resistors to achieve my target resistance value).
- The list of values for the resistors/capacitors you presently have. These values should be in the same units as your target value (i.e. if your target value was 110 nF, all of your values should be provided in nF).

## Step 3: Result

You will get 3 outputs for your result:

- Closest Value - the closest resistance/capacitance value you were able to achieve with your parameters.
- Difference - how far off your closest value was from your target value.
- Resistor/Capacitor Configuration - a list of values of the resistors/capacitors to use and their configuration.

## Step 4: Understanding Your Result

The configuration output uses a standard notation. "+" means the components are in series and "||" means the components are in parallel. The operators have equal precedence and are left-to-right associative meaning you group terms together starting from the left and moving to the right.

For example, take a look at the following result:

**Resistor Configuration: R0=15 Ohms + R1=470 Ohms || R2=3300 Ohms + R3=15000 Ohms**

If you follow the guidelines discussed above, you can see that this is equivalent to the following equation and image above.

**((R0+R1)||R2)+R3**

## Step 5: More Projects

For more projects, visit these links:

## Step 6: Source Code

To view the source code, visit this Github repository.

## Comments