Voltage Dividers

Voltage Divider Circuit

In many of my past projects I have made use of a circuit component (or set of components) called a voltage divider. I realized however, I’ve never really spent time talking about what these were or how they work. For that reason I wanted to spend some time showing this trick and how you can use it yourself.

So What Are They?

A voltage divider divides voltage! Brilliant analysis I know, but what does that mean? And why is it useful? Simply put a voltage divider is a way to get a smaller voltage from a larger one. For example lets say you are trying to power a chip which requires a 5V power source from a 9V battery. In this situation you could use a voltage divider at the power pin to lower your 9V supply to the required 5V. Another important use is signal attenuation. As we’ll soon see the output of a voltage divider is a linear function of the input voltage. That’s a fancy way of saying the voltage you get out will always be a specific fraction of the voltage you put in (Based on the resistor values). That means if you have a waveform or audio signal you can reduce its amplitude while still maintaining the original waveform.

Note: Voltage Dividers are a cheap and easy way to reduce voltage however they are not highly stable or accurate. If you require a stable supply it is better to use a voltage regulator IC or Buck Converter

Math Time!

Voltage dividers are an excellent illustration of Kirchoff’s Loop Law and we can use this along with Ohm’s Law to calculator our output voltage given the values of R1, R2 and the input voltage.

Voltage Divider Drawn as Loop Circuit

To clarify how these calculations are done I have drawn the divider as a loop with a voltage source V1. We know from Kirchoffs Laws that the Sum of the voltages around any closed loop is zero. This means V1 minus the voltage lost across the two resistors is 0. This also means the voltage V2 will be equal to V1 minus the voltage lost across R1:

To determine the voltage dropped across R1 we can rely on Ohm’s Law. Ohm’s Law states that V = IR. From this we know the voltage dropped across R1 is equal to the product of the resistance and the current. Unfortunately we still need the current for this equation. Looking at the loop as a whole though we can solve for it:

Now that we have an equation for current we can substitute this into the equation for the voltage drop through R1:

Finally we can input this new function into our original equation to solve the ratio between V1 and V2:

We can divide both sides by V1 to clean this up a bit:

For good measure we can do a little more simplification to come to the final voltage divider equation:

And there you have it! using this equation you can take any input voltage and any desired output voltage and calculate the values of R1 and R2 you will need to accomplish that reduction.

40106 Oscillator Continued

40106 Oscillator Schematic

I left my last post (40106 Triangle Waves) on a bit of a cliff hanger. I had shown how to pull a triangle wave from the circuit and identified some issues with the oscillator as it stood. Today I’d like to go over those issues and how I corrected them to get this oscillator up and running.

I do want to mention the oscillator design above is still in a somewhat rudimentary form. I expect there will be quite a bit of optimization that can be done on it as time goes on.

Buffering

Since we are pulling our outputs directly from the loop which sets the frequency, any elements we add to the circuit which draw current will affect the frequency. This is not ideal. What we need to do is isolate the oscillator circuitry from any further additions to the circuit. For the square wave this is extremely straight forward. Since the signal is binary (digital) we can simply send the output through a second inverter on the 40106 chip. Take note: this will invert the signal (when the original oscillation was high the buffered oscillation will be low) however since this is a repeating signal it won’t cause any impact.

The triangle is slightly more difficult to buffer since we need to concern ourselves with a range of analog values. I accomplished this by feeding the signal through an LM324 op-amp set up as a voltage follower with an additional 10uF capacitor on the output.

Amplification

After the buffering stage I was still left with dramatically different amplitudes for the two wave forms. The square wave after the buffer sat at almost 9V while the triangle was only 1.4V (The output voltage of the LM324). There’s a number of ways you can approach this inconsistency however I found myself somewhat limited by the parts I had on hand and by my decision to run this oscillator on a single 9V battery supply.

How I ended up overcoming this was by using voltage dividers to lower both signals to about 1V peak to peak. From here the selected input is sent into a very basic LM386 power amplifier.

This solution does introduce a large amount of noise into the square wave signal so you may choose to bypass the amplifier with the square wave and only use it on the triangle.

Set up this way I got both signals to reliably output approximately 5Vpp.

Decoupling

One issue I ran into a lot with this circuit, especially building on breadboards was noise. The frequency would bounce around and the wave-forms would not be crisp. This can be largely overcome by adding decoupling capacitors between the negative and positive supply lines. An excellent overview of decoupling (and many other common capacitor uses) can be found over at SparkFun.

40106 Triangle Waves

Recently I completed a post discussing the 40106 Inverter and a simple square wave oscillator. I wanted to build on that post a little more today and look at how we can modify this same oscillator to output triangle waves along with square. These triangle waves will sound profoundly different than square waves in the audible range, giving our oscillator 2 distinct voices. Additionally, we can use the oscillator at a low frequency to drive a voltage controlled amplifier or filter. We can get much more variance from the rising and falling triangle wave in these applications than we would with the simple switching of a square wave.

So Where Are These Triangles?

40106 Oscillator with Triangle Output

If you read my previous post you may remember that this oscillator works by charging and discharging a capacitor. As the capacitor charges and discharges it allows the voltage to rise and fall at the input. This rise and fall causes the output of the inverter to turn on and off producing the square wave. What we can also do is take an output at the input of the inverter where the voltage is rising and falling to produce a triangle wave!

An Amplitude Problem

If you try building this circuit as is you’ll very quickly notice an issue with the design. Connecting a speaker to the output of the square wave sounds great but the triangle is barely audible! If you look at the two waveforms above you’ll see that the square wave has a peak to peak voltage of 6.32V. The triangle however is only registering a fraction of that at 1.22V. This is because the output of the inverter (where we draw the square) always outputs a full digital signal. Meanwhile the voltage at the input only rises until it reaches a threshold voltage. At that point the inverter changes state and the capacitor begins discharging again. In this case (running the 40106 on 9V) that threshold appears to be 1.22V.

So What Now?

In my next post I’ll be exploring the use of op-amps to buffer these outputs and equalize them to a usable voltage. Once we’ve accomplished this we’ll be able to start using this oscillator in all kinds of awesome projects. See you all soon!

40106 Hex Schmitt Inverter

The 40106 Hex Schmitt Inverter is an incredibly useful and popular IC in the world of DIY synthesis. It is cheap, easy to use and is central to one of the simplest oscillators around. Today I’d like to have a look at this chip, explain how and why it works and show you how you can use it to start making some noise.

A Hex Schmitt What-Now?

As the name suggests the 40106 chip is a Hex Schmitt Inverter (Or 6 Hex Schmitt Inverters) on a 14 pin chip. An Inverter is a digital component which takes an input (0 or 1) and outputs the opposite value. Typically in digital electronics these would be represented as 0V or 5V meaning if 0V is sent to the input 5V will be output by the output and vice versa. What makes a Hex Schmitt Inverter special is its capacity to take analog inputs rather than just 0 or 5V. The way this is accomplished is by setting a threshold voltage where the output changes. Looking off the datasheet for the 40106 we can see that in typical operation this happens at 0.9V when the chip is being powered with 5V or 2.3V when being powered with 10V. When the voltage on the input goes above that threshold the output turns off. When the input goes below that threshold the output a digital high voltage (usually 5V).

Dividing By Zero?

This Isn’t Going To Work

That probably all sounds as clear as mud so lets go over a simple use case to see if we can make some sense of it. We know that when you input a high voltage to an inverter it outputs a low voltage and vice versa. So what would happen if we connected the output back to the input? Now we’ve built a bit of a paradox! When the output is high it sends that high signal back to the input which makes the output low which makes the input low which makes the output high which makes the output low which makes…. you get the idea. The problem is since this is happening instantly its faster than the chip can handle and the whole thing breaks down.

Capacitor To The Rescue!

Simple 40106 Oscillator

What we need is a way to delay the signal traveling from the output back to the input so we can get a consistent oscillation. We can accomplish this by adding a capacitor between the input and the ground and a resistor between the output and input. The capacitor is initially in its uncharged state and the input is low. This low input voltage causes the output to go high, however an uncharged capacitor provides no resistance between the input and ground so all current flowing out of the output goes to ground and the voltage stays at 0V at the input.

As current flows into the capacitor it begins to charge which in turn resists more current traveling through it. This new resistance allows the voltage on the input to begin to grow proportional to the resistance provided by the capacitor. Eventually this voltage will reach the threshold voltage of the inverter and cause the output to go low. Then the whole thing happens in reverse, as the capacitor discharges the voltage drops until it falls below the threshold voltage and the output switches back to high.

The resistor functions to limit the current traveling from the output to the capacitor which slows the charging of the capacitor.

So How Do We Control This Thing?

Simple 40106 Oscillator with Control Pot

The key to taking this from a curiosity to something useful is control, we need to be able to select a frequency range and modify it in real time. Since the speed the inverter flips from high to low and back is governed by the charging and discharging of the capacitor we can control the frequency by controlling the speed the capacitor charges and discharges.

The first way to do this (as you may have guessed) is by changing the size of the capacitor. A smaller capacitor will charge quickly providing you a very high frequency while a larger capacitor will charge slower and provide a substantially lower frequency. Choosing the right capacitor is a great way to select a range of frequencies for your oscillator however as variable capacitors are rare and expensive this is not an ideal method for making real time changes to the frequency.

This leads us to the second method which is adjusting the resistance. This resistance limits the current flowing to the capacitor. The less current flowing to the capacitor the slower it will charge. Further since potentiometers (variable resistors) are common components we can add a knob to adjust the frequency of our oscillator on the go.

An easy way to calculate the approximate frequency with any resistor capacitor combination is using the equation f = 1.5/RC

It’s Been A While

I wanted to write a post to touch base with you all and provide a bit of an update on where I’ve been, what I’ve been up to and the future of this site. I know its been a long time since I’ve provided any new content and I apologize for this. I want to be clear though that this project has not been abandoned, it has very much been on my mind and I hope to begin getting back to it moving forward.

For those of you who don’t know about 4 years ago I made the decision to return to school as an adult and begin studying engineering. I am happy to report at this time I am approaching completion of my second year in the Mechatronics Engineering program at a major Canadian University. Getting myself here though has filled most of my time and left me with limited resources to work on external projects.

That being said this site and my audio projects as a whole have been very much on my mind and I have been working towards a time when I felt I could begin producing content again. At this point the demands of my academic career and my other projects are beginning to feel more manageable and it is my hope to once again begin building this site.

I plan to begin by reworking and expanding the “Basics” area of this site to provide more detailed introductions to techniques of circuit analysis, design and the practical skills necessary to implement your designs. By focusing first on this area I hope to give you guys a strong foundation to understand electronics better and also which I can use as references for the more some more interesting projects I am hoping to undertake in the future.

DIY Drum Kit with Circuit Bent Pedal Effects

I was down in my basement playing with a few of my older projects today and took a quick video to share with you all. In this video I use my 4017 based gate sequencer to control a set of circuit bent Kawasaki drum pads. I took advantage of the stereo output on the Kawasaki drum kit to use a stereo spliter cable to separate the left and right audio channels. I sent the left audio channel directly to my PA system while I ran the right through some circuit bent Danelectro pedals I had laying around. The result Is a clean channel and a distorted/echo channel which I can mix separately on my PA system. If you are interested in learning more about any of the projects used in this video don’t hesitate to visit the following links:

4017 Gate Sequencer
Kawasaki Drum Pad With Triggers
Circuit Bent Danelectro T-Bone Distortion
Circuit Bent Danelectro BLT Slap Echo

Intro to Bipolar Power Supplies

As you begin to tackle more complex and interesting synthesizer components you may begin to encounter schematics for circuits which require both a positive and a negative power input to operate. As an example Eurorack synth modules use plus and minus 12V power supplies. As a result many DIY synth enthusiasts will also use +\- 12V so that they can interface with their Eurorack Modular set-ups. This is referred to as a bipolar power supply and is necessary for circuits which include operational amplifiers.

Unfortunately this can cause something of a tripping point for electronics or synthesizer beginners. When I first came across this it took me far longer than I like to admit to wrap my head around it. How could a voltage be negative? Do I need special equipment to power these circuits? This confusion was primarily caused by two misconceptions I held at the time:

Voltage is a measurement of force not quantity:
When we think about voltage we tend to think of it as a quantity. We assume that the voltage of a battery is the number of volts which that battery contains. This is perpetuated by the way we refer to voltage ; “This battery is 9V.” This is however not correct. The voltage we refer to with batteries, power supplies and circuits is actually the voltage difference between the positive and negative poles. If you are familiar with the water analogy for describing electricity you may have heard that voltage is the pressure which pushes the electricity through the circuit. If you had a pipe where you applied equal pressure to both ends the water would not move through it. If however you had a pipe where you applied a greater pressure to the water at one end of the pipe, the water would begin moving. Further the force with which the water moves through the pipe would be equivalent to the difference in pressure between the two ends of the pipe. Similarly with a 9V battery the voltage at the positive pole is 9V higher than the voltage at the negative pole which pushes the electricity from the positive pole, through your circuit, to the negative pole.

Consider then if you turned the circuit upside-down. This would mean the same 9V of force was still moving through the circuit. However now it is moving through the circuit in the opposite direction. The 9V of force would now be pulling electricity from the ground connection and pushing it to the power bus. This is what would be referred to as a negative voltage.

Ground is a reference point:
When I started working with electronics I did not have a firm grasp on what exactly ground was. I got used to using the negative pole of a battery as ground and began assuming that it was the lowest pole of the battery or power supply. This understanding served me fine with basic circuits but became a problem as I began working with op-amps and more complex circuitry. The truth of the matter is though that the ground is not an intrinsic point on the power supply and has more to do with the circuit itself than your power supply (That being said some power supplies include circuitry to anchor or shield their ground to make it more stable). The ground ultimately serves as a reference point from which the voltage of the circuit is measured. With some basic components you could set up a ground anywhere between the maximum voltage of your power source and 0V.

Consider the circuit above. The most intuitive way to approach this would be to say that ground is point C. In this case we would measure the voltage difference between B and C to determine that the voltage at point B is 9V. Similarly by measuring the voltage difference between A and C you can determine that the voltage at point A is 18V.

However if you approach the circuit differently you will see very different results. Lets say that we assign point B as ground in the circuit. In this case by measuring the voltage A and B to find that the voltage at point A is 9V. Next we would measure the voltage between C and B and find that the voltage at point C is negative 9V. This means the voltage at point C is 9V less than the voltage at ground (point B). The schematic shown above is the most basic bipolar power supply you can create and is perfect for developing familiarity with these types of circuits.

To make my life easier I soldered this small bipolar power supply together on a scrap of perf board I had on hand. I’ve added two large capacitors (330 uf electrolytic) to provide some decoupling for simple circuits. Additionally I placed leads on the positive, ground and negative traces so I could easily connect this supply to my breadboard.

If you are looking to free yourself from batteries I would strongly suggest looking into MFOs Wall Wart Bipolar Power Supply as an option for moving to a more permanent voltage source (along with the wonderful documentation provided with all of MFOs projects). Alternately if you have a traditional bench power supply there are many projects available to help you create a bipolar supply using the monopolar output these provide.

555 Based Drone Synthesizer With LFOs

Today I have an update to the 555 Based Drone Synthesizer which I posted last week. I was having a lot of fun with my Drone synth but wanted to expand on it to get a bit more variation from the sound. To do this I added a set of LFOs to modulate the frequency of the drone oscillators.

To accomplish this I built a second set of three 555 based oscillators. These new oscillators are identical to the ones in the drone synthesizer except for a change to the capacitor between pin 2 and ground. By increasing this capacitor from 0.01uf to 1uf I was able to lower the frequency of the square wave they produce. This makes them perfect for use as LFOs.

I then connected the output (pin 3) of each of these new oscillators to the control voltage input (pin 5) of the corresponding oscillator in the drone synthesizer through a 1K resistor. An additional modification that can be made to this circuit to provide further control would be to replace this 1K resistor with a 10K or 50K ohm potentiometer which would allow you to modify the amount which the LFO modulates the oscillator in the drone synth.

In this experiment I have used LFOs but you could easily control the drone synth in other ways as well by providing a control voltage to pin 5. I am interested to see how this set-up would react to a control from a sequencer or keyboard and may try this in the future.