Introduction: Audio Flame Feedback
The circuit to create and amplify the sound isn't trivial, but it's made of simple building blocks. I'll show you how to build a light sensor with a CdS photoresistor, a simple op-amp preamp, an oscillator with the classic LM555, and a 5 watt power amplifier with the LM1875.
You can do it if you follow the instructions, I'll try to explain the details.
Step 1: Stuff You Need
I used a bunch of stuff to make this project. I prefer to get stuff from Jameco and Radio Shack because they're super convenient and I do everything at the last minute. You can get everything from Digikey also, or whatever your favorite electronics supplier is, none of the parts are exotic.
A candle and candleholder.
Wire - I like to have around two 3-packs of wire from radio shack, one solid core and one stranded. I prefer 22 gauge.
Perfboard - I like the board number 276-150 from radio shack, it's cheap and useful.
Power supply - I designed this with the Mean Well 24V 1A wall wart from Jameco. You'll need one of the corresponding jacks also if you don't want to solder the supply directly to the board.
Electronics components - You can get all these from Jameco.
1M Audio Taper Potentiometer
Photoresistor (I used Jameco #CDS003-7001)
MC1458 x1 (Any general-purpose dual op-amp is fine, these are cheap)
LM1875 x1 (plus heatsink)
1N4733 x1 (Any 5V Zener diode is fine)
8-pin DIP sockets x2 (DIPs are hard to remove if you blow them up accidentally, best to socket them just in case. The LM7805 and LM1875 are in TO-220s, easier to pull out of your board if necessary..)
Soldering Iron & solder
Pliers, wire strippers, diagonal cutters
Step 2: The Circuit
This is the circuit we'll use. It's got a bunch of parts. If you know how to construct circuits and don't feel like reading a bunch of stuff, you can go ahead and build this. If you're not sure what all the parts are doing, keep reading!
We're going to run the whole thing off of a 24V DC power supply. We need that many volts to get the output nice and loud. The LM555 can only handle 18V before it goes pop, so we're going to run the initial stages off of 5V, generated by a LM7805 regulator as shown in the box labeled 5V Supply. Power labeled 24V connects to the main power supply, power labeled 5V connects to the output of the LM7805.
For the circuit to run properly, there will need to be a fair bit of capacitance between the power supplies and ground, shown in the box labeled Supply Decoupling. Most important is to put a couple of caps on the 24V supply near (i.e. in close physical proximity to) the power supply for the LM1875 and on the 5V supply near the LM555. Probably there should be some on each supply near the LM7805 also. Power supply decoupling is one of those hand-wavy things, but if you don't do it, the circuit won't work.
A cadmium sulfide photoresistor is just a resistor whose value changes based on the number of photons hitting it. The easiest way to turn its resistance into a signal is by making a voltage divider out of it, as shown in the Light Sensor box. This circuit is a little bit more complicated than it might have to be in order to reduce the chance of creating a feedback loop through the power supply.
The 1K resistor, 5.1V Zener diode and 10 uF capacitor are used to create a fairly stable 5.1V reference from the 24V supply. We could use a second LM7805 in place of the resistor and diode, but this is a bit simpler way to do it since there isn't too much current going into the photoresistor voltage divider. The Zener diode I'm using here is a 1N4733, but any old 5.1V Zener should work fine. Actually, really any Zener at all should work fine, the 5.1V doesn't have to be exact. Don't forget to point the Zener in the opposite direction from how you'd use a signal diode!
The 5.6k resistor in series I picked to match the value of the photoresistor in moderate light, you can measure your photoresistor and do the same, or just use a resistor of a couple of kohms. The voltage coming out of the voltage divider is 5.1V*5.6k/(5.6k+R(sensor)). There will be a steady value based on the amount of ambient light, with a wiggle on top of it based on the amount of the light changing.
We want to center the signal coming from the light sensor around 2.5V, so we can amplify it as much as possible before it hits 0V or 5V. The two 10k resistors in the Bias circuit generate 2.5V, and the op-amp wired as shown buffers the signal to make the 2.5V steady regardless of what it's connected to. The op-amps in the Bias and the Preamp circuits are each half of a MC1458 dual op-amp.
The 10u capacitor lets an AC wiggle pass through but removes the nominal DC level, and 10k resistor connected to the bias circuit resets the DC level to 2.5V. The op-amp configured as shown with the 100k and 1k resistor amplifies the signal by (100k+1k)/(1k), or 101. We probably don't need this much gain, you can try the circuit with a smaller resistor in place of the 100k and see if you like how it sounds.
This uses a good old LM555 to make a square wave. The nominal frequency is set by the 5.6k and 33k resistor and the 1u capacitor according to the formula f=1.44/((5.6k+2*33k)*1u) = 20Hz. Oscillations coming in from the preamp will modulate the frequency that the LM555 outputs from pin 3. You can try changing the resistors and see what you think.
You want to use a 1M logarithmic pot here. This simply reduces the signal amplitude as desired.
This has lots of parts, so we'll look at it in more depth in the next step.
Step 3: Power Amplifier Circuit
This circuit is a little complicated but really handy, so I thought I'd spell out all the parts. The LM1875 can put out about 30 Watts if you give it 60 V, enough to really cause some trouble. On the 24 V supply we're using the peak output will be only about 5 W, but that's definitely enough to make some noise. If you want to use this circuit with a bigger supply, you don't have to change anything, just make sure your supply can put out enough current without catching fire.
You'll notice in the upcoming photos that the LM1875 always has a heatsink attached to it; this is essential. It will overheat very quickly without one. They put some fancy protection stuff in the chip so that if it overheats it just shuts off without damage to the chip. If that's happening to you, get a bigger heatsink!
By the way, this circuit is straight out of the LM1875 datasheet.
The AC Coupling capacitors at the input and output let the audio wiggle through but remove the DC level, like we did in the preamp. The lowest frequency that it lets through is determined by the capacitor and the resistance it sees in series. Since the speaker is a low resistance, we need a big cap at the output. At the input, the capacitor sees the biasing network, which is a much higher resistance, so a smaller capacitor can be used.
This is the same idea as the bias circuit used in the preamp, but without the op-amp buffer. We can get away without the buffer here because we're not connecting the bias circuit to the feedback network (the 1k resistor in the preamp). The cap in the bias circuit is used for decoupling, the same way as the supply decoupling caps.
Don't forget to put caps on the power supply right next to the chip!
The resistor and capacitor that make the Zobel Network help to make the impedance of the speaker easier for the amplifier to drive. The speaker acts like a resistor in series with an inductor, putting the resistor and capacitor in parallel with the speaker makes the whole thing act more like just a resistor. This is tricky, but trust me it makes a difference.
The feedback network is like the one in the preamp only with the 10u capacitor added. At audio frequencies, the capacitor acts like a short circuit, and the power amp circuit gives us a gain of 21. At DC, the capacitor acts like an open circuit, giving us a gain of 1. The transition is made at f=1/(2*pi*10k*10u)=1.59Hz.
Step 4: Prototype
I built the circuit on a protoboard. If you have one it's useful to try things out this way first.
Don't try to build the prototype to match the pictures exactly, just try to get the circuit right. I just thought some pictures might help with motivation. And to show that it's really not all that much stuff to build.
Step 5: Lay Out on Perfboard
I try to keep a few extra boards lying around. They're cheap. I'll usually work out the layout one one perfboard and then copy it on the one I'm soldering. A coffee mug is useful here, you can drop part through and it will stay there without you soldering it down.
Here are some pictures of my prototype perfboard after I've finally finalized the layout.
These boards have little three hole buses to wire stuff together. I try to make as many as possible of the connections with those. As much as possible of the rest of the connections are made by folding over the component leads on the backside and soldering together. A few I'll wire together with wires on the top of the board.
I used a few more decoupling capacitors than were on the schematic. There are caps on the 24 V supply right next to the LM7805, to produce a stable 5 V, and another set on the 24 V supply right next to the LM1875, to keep it happy. There's a third set of caps on the 5 V supply.
Step 6: Solder It Down
Building the final thing can be slow, but I find it satisfying to have the finished product in a solid piece and off of the protoboard. This is a great way to hone those soldering skills too.
I'm always scared of messing up my nice pretty board if I make a mistake, but it turns out you can rework almost any mistake on one of these boards if you're careful. Getting the component out usually involves destroying it, but that's okay, components are cheap. Once it's out you can clean up solder mess on the board with some solder wick.
I tried to get enough pictures so you can copy it exactly if you want. If something is unclear I'll try to get more pictures, or you can figure out how to lay it out yourself.
In the picture of the backside, the upper trace running across the middle is ground and the lower trace is 24 V. The LM1875 is on the right side and the LM7805 is on the left side.
Step 7: Put It All Together
Here I have a second perfboard mounted under the first one to protect the wiring on the backside. I used 1/4 inch spacers to hold them apart. The light sensor is wired up to a candle and the output goes to our speaker. It's so simple and happy.
We have a be nice policy.
Please be positive and constructive.