Shop OBEX P1 Docs P2 Docs Learn Events
Amplified Audo Quality — Parallax Forums

Amplified Audo Quality

mctriviamctrivia Posts: 3,772
edited 2009-02-09 04:14 in Propeller 1
I have build an audio amplifier to run a little 8ohm speaker I have(Schematic Below) to test it I used the talk demo. The audio is nice and loud now but I get a lot of static. Any sugestions on how to cut the circuit off when not in use to make speaker quiet and save battery power? Also any sugestion how to reduce the noise?

Comments

  • kwinnkwinn Posts: 8,697
    edited 2009-02-07 18:11
    My guess would be that you are clipping the signal unless there is a bad solder joint or component somewhere. Check with a scope. The ~4V peak to peak output from the 2 transistors is not much to drive an 8 ohm speaker.

    If you are using PWM on a pin to drive the circuit you could use the pulse (suitably filtered of course) to turn on a transistor in series with the 5 volts and your circuit. Of course then you have an even lower voltage on the output. A simple switch might be better.
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-07 18:23
    switch will not work because i want to play a note every hour on the hour. fun with reproducing an old grandfather clock.
  • kwinnkwinn Posts: 8,697
    edited 2009-02-07 18:46
    Try using a 555 timer in the "missing pulse detector" circuit to power it (assuming it is PWM from the prop). This circuit will power up your amp on the very first pulse out from the prop. Might need a single transistor also.

    PS - You could also use a prop pin to turn on a transistor if you have a pin available. If you decide to provide a higher voltage to the audio circuit you may want to use an optoisolator for safety.
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-07 18:47
    fixed the noise isue. was due to bad grounding. still cliping the signal though. playing with the wav player obex now. just need to figure out how to reduce the volume from prop or reduce the amplification.
  • LeonLeon Posts: 7,620
    edited 2009-02-07 20:02
    You've got far too much gain. I'd use a TDA7052 - very few components and adequate audio quality.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-07 20:42
    I am running mono so I have an extra pin. I figured out how to lower volume in software but it is not load enough. will have to change to a 9v I think
  • AribaAriba Posts: 2,690
    edited 2009-02-07 21:49
    Reduce the 1MOhm feedback resistor at the second OPAMP to 470 kOhm, so you will have only the half Amplitude at the OP output.
    Or use a Trimmpoti with 1MOhm to find the best gain without clipping.

    BTW: a little strange your Amplifier circuit - can be made much simpler.

    Andy
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-07 21:55
    Andy said...
    BTW: a little strange your Amplifier circuit - can be made much simpler.

    What would be your suggestion for a simpler amplifier that can be run off either 3 AA batteries or a 9V battery?

    I built a simple darlington pair amplifier first but it sucks back to much power.

    thank you for the reminder on how to decrease the amplification.
  • AribaAriba Posts: 2,690
    edited 2009-02-07 22:19
    I would use a LM386 integrated Amplifier.
    But because you have just build your circuit you can try to let away the OPAMP and feed the PWM output direct to the Transistors (see attached circuit).

    Andy

    Edit:this needs min. 5V Supply at the Transistors.
    459 x 411 - 7K
  • AribaAriba Posts: 2,690
    edited 2009-02-07 22:36
    This may work to switch off the whole Amplifier, set the PWM output to Low and the ON/OFF pin to Low to switch it off.
    459 x 411 - 7K
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-07 22:36
    that does work but is extremely quiet.
  • AribaAriba Posts: 2,690
    edited 2009-02-07 22:58
    Can you measure the output voltage of the PWM DAC output? Theoretically you get up to 3.3V peak to peak (if not reduced in software) and this is the maximum with 5 V supply (and 2 diodes/transistors).
    If you have the full amplitide and it is still to quiet, then you need a higher supply voltage and an Amplifier stage before the Transitors:
    592 x 413 - 10K
  • kwinnkwinn Posts: 8,697
    edited 2009-02-07 23:00
    Have you checked the voltage at the junction of the 2 4.7 ohm resistors to make sure you are close to the middle (2.25V) of the supply voltage when the output PWM is near 50% of max. Without the feedback through the op amps you may need to add a 2.2K resistor to the base of the 2n4403. Having a transistor turn it on/off may also create some imbalance.

    Post Edited (kwinn) : 2/7/2009 11:09:36 PM GMT
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-08 00:18
    I have both a multimetter and an osiloscope. I will check the voltage out of the dac as soon as I get back home. the schematic used at beginning does work with 210k resistor for feedback. not the loudest but not bad.

    will try your schematic and also try changing to a 9v battery. any suggestions for making it work on 12v line or 9v battery backup.

    I can
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-08 02:00
    ok how do i set to 50% to test if it is 2.25V? here is the code

    PUB Player(pWav, PinR, PinL):bOK|n,i,nextCnt,rate,dcnt
      'Play the wav data using counter modules
      'although just mono, using both counters to play the same thing on both left and right pins
    
      'Set pins to output mode
      DIRA[noparse][[/noparse]PinR]~~                              'Set Right Pin to output
      DIRA[noparse][[/noparse]PinL]~~                              'Set Left Pin to output
    
      'Set up the counters
      CTRA:= %00110 << 26 + 0<<9 + PinR         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
      CTRB:= %00110 << 26 + 0<<9 + PinL         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)   
    
      'get length
      n:=long[noparse][[/noparse]pWav+40]
      'get rate
      rate:=long[noparse][[/noparse]pWav+24]
      case rate
        8000:
          dcnt:=10000
        16000:
          dcnt:=5000
        other:
          return false
      'jump over header    
      pWav+=44   'ignore rest of header (so you better have the right file format!)
    
    
      'Get ready for fast loop  
      n--
      i:=0
      NextCnt:=cnt+15000
    
      'Play loop
      repeat i from 0 to n
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        FRQA:=(byte[noparse][[/noparse]pWav+i])<<20
        FRQB:=FRQA
    
           
    
      return true
    
    
  • rjo_rjo_ Posts: 1,825
    edited 2009-02-08 02:26
    I love it when you guys talk dirty...

    mctrivia...

    When you get this the way you want it... would you please talk partsman (http://ucontroller.com/) into carrying it in kit form... please.

    He is a great guy and you could both benefit from it[noparse]:)[/noparse]

    Rich
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-08 02:50
    yes I am using spin studio myself. great set up. though having an amplifier that only uses 1 io pin(2 if you include shut off) and requires modifiying the spin studio board is probably not going to happen.

    Currently I am looking at running on 12V to run the amp with a 9V battery backup. Unfortunetly I only have 10k pots so the 500k in ariba last design i am doing in fixed values
  • rjo_rjo_ Posts: 1,825
    edited 2009-02-08 02:53
    SpinStudio is going to migrate to a new design anyway... and it all works with a protoboard. Wouldn't cost you anything and might bring in some cash to some really great people... you being one.

    just a thought
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-08 03:05
    well this can easily be made into a kit. One thing I noticed is that my first schematic removes a lot more of the quiet noise then any of the other designs do to it using the second half of the 358 ic to counter act noise on the ground plane
  • rjo_rjo_ Posts: 1,825
    edited 2009-02-08 03:11
    The reason I'm pushing the issue is that other than the demo board there isn't a ready to go microphone solution and I suspect that your circuit would be very useful... and partsman does a really nice job producing and supporting his stuff.

    It is pretty hard to talk to your robot if he/she can't hear you[noparse]:)[/noparse] And with sensor integration... sound can be a very useful modality.
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-08 03:40
    After playing with this circuit and several others I have decided to buy the TDA7052ATD-T only $0.8693 and will take up a very small footprint on my board. Hopefully the sound quality is good.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-02-08 06:59
    The TDA7052 looks like a good, simple solution. I was going to suggest a "class-D" approach, using a MOSFET driver chip in an H-bridge configuration, along with a differential PWM output from the Propeller. In this approach, no circuitry operates in the linear region, so very little power is wasted. The speaker inductance is what low-pass filters the PWM.

    -Phil
  • AribaAriba Posts: 2,690
    edited 2009-02-08 17:30
    mctrivia said...
    ok how do i set to 50% to test if it is 2.25V?

    To set to 50%: (only Play loop shown)
      'Play loop
      repeat i from 0 to n
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        FRQA:=$8000_0000
        FRQB:=FRQA
    
    



    To set the max. Amplitude:
      'Play loop
      repeat i from 0 to n
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        FRQA:=(byte[noparse][[/noparse]pWav+i])<<24
        FRQB:=FRQA
    
    


    with a left shift of 20, you get only 1/16 of the max. Amplitude - no wonder that the output is very quiet, and the noise part is high. And also the middle voltage is only at ~0.1V with FRQA:=(byte[noparse][[/noparse]pWav+i])<<20.
    If you want reduce the amplitude, but let the middle voltage at 1.6V then use something like this:
    FRQA:=((byte[noparse][[/noparse]pWav+i])-$80)<<23 + $8000_0000 (works also with a shift of 22,21...)

    Andy
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-08 18:29
    realised the 20 divided by 16 was needed for my amp thanks for the write way to do it. used 24 when trying your first schematic
  • mctriviamctrivia Posts: 3,772
    edited 2009-02-09 04:14
    would IRF7101TRPBF work well for cutting off power when speaker is not needed?
Sign In or Register to comment.