Having the following diagram, how can I amplify output from pin 3&4 to speaker, using BC547 transistor?
(source: elm-chan.org)
Having the following diagram, how can I amplify output from pin 3&4 to speaker, using BC547 transistor?
(source: elm-chan.org)
Based on the comments and responses, your requirement seems to be:
What you need is an "R-2R" network driven by the two pins. From the diagram you posted:
Connect R15 to Vcc, and R7, R8 and R16 exactly as shown. Keep the values as per the diagram as well, 10k and 20k. Leave out the other resistors in the schematic.
The junction of R16 and R8 will be the DAC output.
This resultant output voltage needs current amplification to drive the speaker:
An 8 ohm speaker with a 5 volt peak-to-peak signal will generate over half a watt of output, which is pretty loud - but will require anywhere from 100 to 300 mA of drive current. The MCU's pins cannot deliver that kind of current (this is with reference to your original schematic), and even the BC547 is rated only to 100 mA.
If distortion of output on the speaker is not a show-stopper, you could make a Common Collector unity gain voltage buffer with your BC547 to generate the speaker output you are expecting. Your speaker will be the load resistor, so no separate resistor is needed there. Your power rail must be able to supply sufficient current for this.
The output will not be a perfect 4-level (i.e. 2-bit) DAC output since we have ignored biasing, but will generate recognizable sound as per the MCU pin values generated.
Common emitter amplifier + Buffer (Emitter follower). If you google these you'll find a site that will tell you how to make them. The common emitter is to amplify the signal and the buffer will simply make sure that the speaker gets most of the signal. Also, don't forget to add caps in between!
Depends on the speaker, and the signal. If it's a piezo, that cct is as loud as it gets without more volts (or a transformer!).
If it's a voice coil, tell us what impedance, and how much power do you want?