Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LM386 and DAC0832 with an 8-ohm speaker

Status
Not open for further replies.

mdanh2002

Member
Hi

I am having a project of using the 80C188 to play a wave file (8kHz, 8-bit mono) stored in the EEPROM interfaced to it. The data read from the EEPROM is transferred to DAC0832 digital to analog converter and amplified by LM386 and fed into an 8-ohm speaker. The problem is, although the data read from the EEPROM is correct and output correctly to the DAC, the voice on the speaker side becomes distorted and very different from the original file when played on the computer. I have used the timer interrpupt to program the 80C188 to play the file at the correct frequency. So I am afraid that my connection has some problems.

Any suggestions on a 'good' connection between the LM386 and DAC0832? Datasheets are attached. Thanks!
 

Attachments

  • DAC0832 - digital to analog.pdf
    554.3 KB · Views: 645
  • LM386N.pdf
    255 KB · Views: 432
At the very least you should have a lowpass filter between the DAC and the LM386. Maybe post your actual circuit instead of the datasheets. This will save on many assumptions.
 
1) At only 8 bits and only 8kHz the quality will be worse than an AM radio.
2) The LM386 has an output power into an 8 ohm speaker at clipping of only 200mW with a 6V supply. Do you know how quiet that is? If you turn up the volume then sure it will be distorted.
3) The output from the DAC is at a high level and the input to the LM386 is a low level. Therefore the LM386 is very overloaded.
4) You need an attenuator between the DAC and the power amplifier.
5) You need a power amplifier with much more power output than a little LM386.

Attach your complete circuit's schematic.
 
audioguru said:
1) At only 8 bits and only 8kHz the quality will be worse than an AM radio.

8 bits is plenty, and provides decent quality audio, and at 8KHz will probably sound better than an AM radio - bear in mind the Commodore Amiga only used 8 bit sample sound, and gave more than acceptable performance. This back in the days when a PC could only make a 'beep'.

It won't be HiFi, but it will be reasonable quality.
 
A good automatic-volume-control circuit should have been used when the voice was recorded. Then the entire dynamic range of the DAC could have been used for the full 8 bits. Othewise if the level of the recording was low then fewer bits were used. Fewer bits results in a "digital" sound quality. If the level of the recording was too high then it is very distorted.

To attenuate the 8kHz clock's whistle then a very sharp lowpass filter must be used. It will probably have a cutoff frequency of only 1.5kHz to 2kHz which will make a voice sound pretty bad.

The recorded voice will have a digital and muffled sound quality.
 
Hey Nigel, in the early PC days I found software that would turn a pc 'beeper' into an 8bit 11khz or better 'tracker' or .mod file player. This is back when sound cards cost over 100 dollars, when 100 dollars ment 500, and way before I know anything about electronics or how to create a parallel port DAC (they were popular because sound cards were so expensive). I still have the most crystal clear memory of playing back this ragedy little track and it always brings tears to my eyes because I had no idea a computer could make sounds of this quality using only a single internal timer and bit banging the PC buzzer.
 

Attachments

  • 12th.zip
    95.5 KB · Views: 301
Hi

Sorry for late reply. For the DAC I was using the configuration found at **broken link removed**. This means using pin 8 (Vref) as input to Op-amp, pin 9 (Rfb - feedback) connected to 5V, Iout2 grounded, Iout1 connected to 2.5V (as a replacement for the diode). The data bus pins are interfaced accordingly.

For the op-amp I use the very first configuration (gain=20) found in the datasheet. I feed Vref into pin 3 via a variable resistor in series with a 10uF capacitor served as volume control and low pass filter. All other connections are the same.

When I output a square wave, the sound at the speaker sounds like a square wave, but when it comes to voice, the sound is totally distorted.

Any better configuration?
 
I would suspect you're overdriving it, why do you want a gain of 20?, all you should need is a unity gain low-pass filter, and probably an attenuator to drop the signal level.
 
What opamp? The LM386 is a power amplifier, not an opamp. It won't work if you feed a DC voltage into pin 3, because it is designed for its input pins to have 0VDC. Its minimum stable gain is 9.

A filter capacitor with the very high value of 10uF requires a very low value resistor to maker a 2kHz lowpass filter. About only 8 ohms which is like a dead short to the output of the DAC. No wonder it is distorted.

Please post the complete schematic so we don't have to guess how it is.
 
Hi

Attached is the simplified schematics.

I only drawed the DAC part and the amplifier part. The interface between the DAC and the microprocessor is omitted for simplicity.
 

Attachments

  • circuit.JPG
    circuit.JPG
    32.6 KB · Views: 746
The DAC needs to have an inverting opamp at its output.
The opamp is supposed to be DC coupled and have a very high input resistance. A FET input opamp is recommended.

Your circuit doesn't have an opamp, is non-inverting instead of inverting, is capacitor coupled instead of DC coupled and has a low resistance attenuator instead of the very high input resistance of a FET-input opamp.

Your circuit also does not have a lowpass filter so if it worked then its output would whistle loudly at 8kHz.
 

Attachments

  • DAC circuit.PNG
    DAC circuit.PNG
    13.9 KB · Views: 517
Sceadwian said:
Hey Nigel, in the early PC days I found software that would turn a pc 'beeper' into an 8bit 11khz or better 'tracker' or .mod file player. This is back when sound cards cost over 100 dollars, when 100 dollars ment 500, and way before I know anything about electronics or how to create a parallel port DAC (they were popular because sound cards were so expensive). I still have the most crystal clear memory of playing back this ragedy little track and it always brings tears to my eyes because I had no idea a computer could make sounds of this quality using only a single internal timer and bit banging the PC buzzer.
The problem was that it was so processor intensive that your PC couldn't do anything else whilst playing sound.
 
It was a dos program =)
 
I'm remembering the Windows 3.1 PC speaker driver.

If I remember rightly it worked by sending PWM to the speaker at a high frequency to reproduce analogue sounds, the quality was very poor and the PC would hang whilst playing the music.
 
The quality was pretty good considering the speaker it's coming from and that there was no filtering going on at all.
 
Sceadwian said:
The quality was pretty good considering the speaker it's coming from and that there was no filtering going on at all.

And yet long before this, the Amiga was doing decent quality stereo sampled sound - it took a long time for the PC to catch up.
 
That's true. The PC only won because it was copied by many manufacturers increasing competition and reducing the price; it's just a shame that this didn't happen withthe most popular PC operating system though.
 
Status
Not open for further replies.

Latest threads

Back
Top