dc42:
If you just want to amplify tones generated by the Arduino, try the attached schematic. It will deliver about 0.3W into 8 ohms. If you need more volume than that provides and you want to run the amplifier from 5V, then I suggest this chip http://www.ti.com/lit/ds/symlink/lm4871.pdf of someting similar.
It's simple because it only has to amplify square waves of a fixed amplitude, which is what comes out of an Arduino digital pin or PWM pin. It's no good for amplifying general audio signals, or the outputs from the DACs on the Due.
Surely all you need to do is treat your speaker like any other PWMed load selecting appropriate voltage to not blow the speaker. You could use a low pass filter to try and round off the square wave but that could get tricky if your using different frequencies
I use LM386N8's, easy to put down on either perf board or dead bug and DIP8 chip's are available... Just don't hit it with too much audio drive. The fet amp with the 2SK part would be best described as self biased class A (Gate bias is derived from the drain current only). It also draws an inordinate amount of current for what it needs to do.. These guys are semi local to me and the prices are good too http://www.oddwires.com/chip-amps/ I always keep 3 or 4 of the LM386's just for this reason... One unusual use is to make the chip oscillate and rectify the output for a neg bias supply with some current available. All in all, Low voltage use, gains from 20 to 200 and operation from 4 to 12V (use 9V or less, 5V is OK but NEEDS a big supply bypass capacitor (220 to 470 uF) make it a fine choice. For many years I used one as an audio signal tracer and many times was very handy for digital work as well. Use your imagination.
2SK1058 is one type power MOSFET suitable for audio power amplifier, and it has very high Ron (~15 Ohms).
I studied some electronics YEARS ago so I can get a feel for some of his design but I can't see what is gained by dropping half the power across a 40W resistor.
outofoptions:
I studied some electronics YEARS ago so I can get a feel for some of his design but I can't see what is gained by dropping half the power across a 40W resistor.
Advantages of class-A Audio amplifiers
Class-A designs are simpler than other classes; for example class-AB and -B designs require two devices (push–pull output) to handle both halves of the waveform; class A can use a single device single-ended.
The device is never shut off completely there is no "turn on" time, little problem with charge storage, and generally better high frequency performance and feedback loop stability (and usually fewer high-order harmonics).
The point at which the device comes closest to being cut off is not close to zero signal, so the problem of crossover distortion associated with class-AB and -B designs is avoided.
Disadvantage of class-A audio amplifiers
They are very inefficient. A theoretical maximum of 50% is obtainable with inductive output coupling and only 25% with capacitive coupling.
sonnyyu:
The point at which the device comes closest to being cut off is not close to zero signal, so the problem of crossover distortion associated with class-AB and -B designs is avoided.
OK. I think this is the part I was missing. That and forgetting what the basic classes did. Thanks for taking the time to answer this for me.
dc42:
If you just want to amplify tones generated by the Arduino, try the attached schematic. It will deliver about 0.3W into 8 ohms. If you need more volume than that provides and you want to run the amplifier from 5V, then I suggest this chip http://www.ti.com/lit/ds/symlink/lm4871.pdf or someting similar.
[EDIT: corrected transistor types]
I onow this is an old thread, sorry to bother you, but i was wondering: shouldn't there be a resistor between the arduino and the transistors here? And one between the 5v and the cap? I ask because i'm having troubles in my project . The speaker is causing short outs.
I use this in my fencing scoring machines to make a loud 2-tone warble when a touch is scored.
The switch & resistors act as sort of a Hi/Lo volume control (wife says both are too loud).
The box has a bunch of holes drilled in front of it to act as guard against errant things that might be tossed that way.
You can make out the MOSFET and 68 ohm resistors at the lower right of the board. http://crossroadsfencing.com/BobuinoRev17
RobvdVeer:
I onow this is an old thread, sorry to bother you, but i was wondering: shouldn't there be a resistor between the arduino and the transistors here? And one between the 5v and the cap? I ask because i'm having troubles in my project . The speaker is causing short outs.
There is no need for a resistor between the Arduino and the transistors, because the transistors are in the emitter follower configuration. The effective load resistance seen by the Arduino pin is the load resistance (8 ohm speaker) multiplied by the hfe of the transistors (at least 30, and probably much higher than that). I don't understand why you would want to add a resistor between 5V and the cap.
dc42:
I don't understand why you would want to add a resistor between 5V and the cap.
Because it'll create a short between +5 and ground? Even though the speaker is just 8ohm, too much current will flow, it basically fried my 328.
No, something else fried your Arduino. The peak current from the positive rail through the upper transistor will be no more than 500mA, and the maximum average current flow cannot exceed 100mA. You could add another capacitor between +5V and ground to help supply the peak current.