(Re-Blogged with permission from Oscium)
Have you ever wondered how music professionals modulate and combine audio signals? They use something called an audio mixer, which takes input from two channels and combines them in a proportion that the user can set. Here’s a fun electronics project for beginners that shows you how to build an audio mixer of your own.
Here’s what you’ll need to build your mixer:
- 1 Microprocessor of your choice (Mine is an M68HC11E9BCFN2, or HC11 for short)
- 1 Digital Potentiometer (MCP4261-103E)
- 1 555 Timer (LM555 pictured above)
- 1 Quad Operational Amplifier chip (LM324, also called an Op Amp)
- 1 1k resistor
- 1 10k resistor
- 3 .01uF capacitors
For this project, we’re going to use a 555 timer to generate the signals, run one of them through an operational amplifier buffer, and then run them to either side of a potentiometer, as shown by the schematic below.
Instead of using an analog one, though, we’re going to use a digital potentiometer, and then program and run it from our microprocessor. Because of this, our schematic that we’ll work from is slightly different, but serves the same purpose.
As with any other project, it’s really important to take things one step at a time. Oscium’s suggestion would be to start out with the timer. It’s connected in astable mode, which means that it should output a square wave. When you hook the circuit up as shown in the schematic, pin 3 is where you’ll want to test, to make sure its output is correct.
As soon as you’re getting the output you expect, go ahead and take a look at the waveform on pin 6. You’ll notice that there’s a nice approximation to a triangle wave coming out there- this is caused by the .01uF capacitor charging and discharging. Our mixing circuit is going to combine this triangle wave with the square wave we got from pin 3 earlier.
The next thing to do is to attach the op amp to pin 6 on the timer. The op amp serves as a buffer, which allows the timer to run without the rest of the circuit loading down its output. This means that by running the output through the buffer, you’ve made it so that no matter how high the resistance of the rest of the circuit, the timer’s output will behave as it should. (Oscium Pro tip: when you place an IC chip down on the board, immediately run power and ground to the appropriate pins, so that you don’t forget to. How many times has an operator spent forever debugging a circuit that otherwise would have worked perfectly, only to find out that they had forgotten to plug in one of the chips!)
Once you’ve run the triangle wave through the buffer, it’s time to start hooking up the potentiometer! If you’ve ever worked with an analog potentiometer, you know it’s essentially just a variable resistor hooked up in a voltage divider configuration. By turning a knob on the component itself, you change the ratio of the resistance on either side of the wiper, and thus the output voltage. If you haven’t ever worked with a potentiometer, here’s a quick tutorial to get you caught up. Working with a digital potentiometer is pretty much the same- the potentiometer still has two input pins, P0A and P0B, and the output is still taken from the wiper, P0W. In order to move the wiper, though, rather than turning a knob, your processor needs to send data through the Serial Data In pin on the potentiometer, telling it where the wiper needs to be. In our particular potentiometer, there is a second set of input pins (P1A and P1B) and a corresponding wiper pin (P1W), but for this project, you really only need the one set.
Once you’ve got your potentiometer wired in correctly, you can program the processor to send it signals and move the wiper to where ever you’d like within its range. Here’s a program Oscium put together that moves the wiper to a point given to it by the user. You can set where the wiper points by changing the value of WiperOut to anything between $0000 and $00FF, to change how much of each signal gets through. The coolest looking waveform found was when it was set to $00AA.
You’re not limited to simply setting the wiper and leaving it, though. For example, here’s another program- this one moves the wiper from one side of its range to the other in 8 equal increments. Try changing the number the program adds in line 58. It’s currently adding 32 ($20), which is 1/8 of the wiper’s total range, but if you had it add 21 ($15) instead, for example, each step would be smaller. This means that you’d have 12 points at which to observe the changing waveform, rather than 8, so that the change would appear more gradual.
Since this circuit can take any two signals (between 0 and 5 volts) and mix them, you could replace the inputs from the astable timer with any number of things. If you were to, say, bring in audio from your MP3 player on one channel, and an amplified signal from a microphone on the other, and then run the output signal from the digital potentiometer through some speakers, you’ve got a karaoke machine! Or if you were to hook the line out from your electric guitar into one channel, then you could put any waveform you like on the second channel, and hook the output to your guitar’s amplifier to create cool sound effects. So there you have it, your own digital signal mixer!