Shop OBEX P1 Docs P2 Docs Learn Events
Prop Controlling Audio With Opto Jfet — Parallax Forums

Prop Controlling Audio With Opto Jfet

T ChapT Chap Posts: 4,223
edited 2010-06-05 00:35 in Propeller 1
I am going to bread board this later but wanted to get some input. I want to turn on and off both left and right line levels off one Prop pin. The goal is to have the levels ramps by a few mS to avoid pops. I will buffer the Prop output with some spare 4049s gates (not shown in the drawing), so the LEDS will drive not drive off the Prop. Does this look like it will do the job of ramping the audio in and out as the pin changes state? I can't dedicate a cog to PWMing the 2 LEDs, and can't think of a way to let a counter do this without full time cog control. If there is a way to run the pin with a counter so that minimal sporadic cog control is used, that would be ideal. Suggestions appreciated.
869 x 616 - 22K

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-06-04 20:01
    Todd Chapman,

    Looks like you are attenuating the audio signal to ground via a 1K resistor. My only concern would be that when the Propeller is being turned 'on' the Jfet would be off allowing the audio to pass ... Ohhh wait Jfets basically work opposite of a Mosfet, so they would already be ON. You apply a signal to turn them OFF. That said my next concern would be that Jfet's usually can only handle a very small amount of current. If the Audio signal through the 1K is within their capability then you should be ok.

    You could still use MOSFETs if you needed more current. You'd flip the locations between the Jfets and the 1K resistor and replace the Jfet with TWO MOSFETs. You need two in a back-to-back configuration to negate the internal diode, or else it would never turn off. Not to mention clip the audio.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

  • TubularTubular Posts: 4,706
    edited 2010-06-04 21:27
    What optofet did you have in mind? These H11Fx's are great for this kind of thing. I'm sure there are others
    www.datasheetcatalog.org/datasheet/fairchild/H11F3.pdf
    THere are attenuation schematics in the datasheet

    One problem I see with the circuit as you have it is that the LED is not going to turn on until that cap has charged up above the LEDs forward voltage, ie you're going to have quite a delay between activating the prop pin, and any attenuation change. And then after you do exceed Vf things will change quite rapidly
  • T ChapT Chap Posts: 4,223
    edited 2010-06-04 23:06
    I am using the H11F1, I tested it with audio volume control on other projects and it does a good job. Thanks for the info above. What I really wish was that there were a trick to set(ramp) a counter by some means without a loop having to run continuously afterwards so that you could have a pseudo pwm from a counter, then ramp the LED up or down and leave it alone until needed again. Using the cap and an RC configuration before the LED, the idea would be to ramp the LED on and off with the pin change, versus hard switching on/off causing an abrupt audio transition.

    Post Edited (Todd Chapman) : 6/4/2010 11:14:34 PM GMT
  • T ChapT Chap Posts: 4,223
    edited 2010-06-05 00:35
    OK I solved this. I was making the big mistake that I had to dedicate a cog to manage the LED full time but that is not the case. Well, at least in the case where you are going from full ON to full OFF that is. This code allows to ramp to full ON, pause for a second, ramp to full OFF, pause a second, repeat. Watching an LED for feedback it is working perfectly with a .1 only and 220ohm resistor. This method allows a cog to ramp up or down the volume with an optofet at a desired rate, then return the the regular routine without sacrificing a cog. There is a little blip between transitions that needs to be fixed.

    
    CON
      _clkmode               = xtal1 + pll16x
      _xinfreq               = 5_000_000
    
    
    obj
    
    VAR
      long rate, x, y
    
    PUB Start
       dira[noparse][[/noparse]13] := 1
       rate := 500_000
       repeat
         mute      'led on
         unmute    'led off
    
    
    PUB MUTE
        X := -2_142_450_000
        Y := 0
        DAC_START(13)
        DAC(y)
        repeat while x <  2_142_450_000
          x := x + rate
          y := x + 2_142_450_000
          DAC(y)
          WAITCNT(CNT + 10000)
        outa[noparse][[/noparse]13] := 1
        waitcnt(80_000_000 +cnt)
        DAC_STOP(13)
        outa[noparse][[/noparse]13] := 0
    
    PUB UNMUTE
        DAC_START(13)
    
        X := 2_142_450_000
        Y := 0
        DAC(y)
        'outa[noparse][[/noparse]13] := 0
    
        Repeat while x >  -2_142_450_000
          x := x - RATE
          y := x + 2_142_450_000
          DAC(y)
          WAITCNT(CNT + 10000)
        DAC_STOP(0)
        outa[noparse][[/noparse]13] := 0
        waitcnt(80_000_000 +cnt)
    
    
    PUB DAC_START(PIN)
        FRQA := 0
        ctra := %00110 << 26 +  pin
    
    PUB DAC(Value)
        frqa := value
    
    PUB DAC_STOP(PIN)
        'FRQA := 0
        ctra := %00000 << 26' +  pin
    
    
    
    

    Post Edited (Todd Chapman) : 6/5/2010 2:06:03 AM GMT
Sign In or Register to comment.