PDA

View Full Version : Prop Controlling Audio With Opto Jfet



T Chap
06-05-2010, 03:04 AM
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.

Beau Schwabe
06-05-2010, 04:01 AM
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 (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Tubular
06-05-2010, 05:27 AM
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 (http://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 Chap
06-05-2010, 07:06 AM
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 Chap
06-05-2010, 08:35 AM
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[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[13] := 1
waitcnt(80_000_000 +cnt)
DAC_STOP(13)
outa[13] := 0

PUB UNMUTE
DAC_START(13)

X := 2_142_450_000
Y := 0
DAC(y)
'outa[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[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