Wanting to detect no sound from a computers sound card to trigger a pin on the
Hello Guys,
I am wanting to detect no sound on a computers sound card when no music is playing so i can trigger a pin on the SX28 or 48. By doing this i can tell the SX what i want it to do at that point. I am wanting to control lighted buttons as a attraction method for my jukebox.
So what i need is a circuit that can detect the absence of the sound and trigger the pin high or low. The SX would have to be programmed with a delay once the pin is triggered so it doesn't get triggered by just a simple break in the music. I didn't want to have to do this by software because i want sequences programmed in the SX and not be controlled by the computer.
Thanks for any ideas!
Kevin
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
Post Edited (DigitalDj) : 10/14/2006 7:06:19 PM GMT
I am wanting to detect no sound on a computers sound card when no music is playing so i can trigger a pin on the SX28 or 48. By doing this i can tell the SX what i want it to do at that point. I am wanting to control lighted buttons as a attraction method for my jukebox.
So what i need is a circuit that can detect the absence of the sound and trigger the pin high or low. The SX would have to be programmed with a delay once the pin is triggered so it doesn't get triggered by just a simple break in the music. I didn't want to have to do this by software because i want sequences programmed in the SX and not be controlled by the computer.
Thanks for any ideas!
Kevin
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
Post Edited (DigitalDj) : 10/14/2006 7:06:19 PM GMT
Comments
What comes to mind that might just do what you want is a VOX circuit. VOX stands for Voice Operated Trans(X)mit. People who use handheld radios for communication often like these circuits because they allow them to simply start talking without having to press a button to start the transmitter when they want to communicate. Basically the circuit detects a certain level of sound and then switches on the transmitter for as long as the sound level persists plus some delay that allows for slight pauses or periods of lower volume.
This sounds like it should do exactly what you desire because the circuit will change its output state based upon whether or not it has detected any (loud enough) sounds recently. Such a circuit can be found at www.rason.org/Projects/basicvox/basicvox.htm, though there are many, many others around. You may want to search for "VOX circuit".
You should be able to connect the PTT ("Push To Talk" - radio jargon) connection in the circuit I referenced directly to an SX pin configured for input since the transistor is simply pulling the connection to ground.
I hope this helps or at least gives you an idea where to look.
- Sparks
If you use the built-in comparitor, you can probably must rectify the speaker output(diode), filter it with a cap, and connect it to the comparitor input through a resistor (10K ?).
Then adjust the other input to the comparitor to the threshold level.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Don't mistake experience for intelligence. And vis-vera.
·
I probably wouldn't want to go over 5 volts on the pins of the SX which i don't think will be a problem. The bad thing i can think of is rectifying the audio out of the sound card would maybe be ok but filtering it will have an effect on the sound quaility unless i use a audio transformer to isolate the circuit.
Bean,
Have you ever programmed anything similar to this with the comparitors?
Thanks,
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
Post Edited (DigitalDj) : 10/17/2006 2:37:28 AM GMT
I was going to suggest an audio transformer originally. Pick up either an 8 ohm to maybe 300-1000 ohm transformer or a 1:1 transformer if you've got a line output and use a bridge rectifier to feed a small filter capacitor. Decide on the time constant you want for the reaction time for sound on or sound off and pick a resistor to put across the capacitor to discharge it based on the time constant. Connect the negative side to ground and use a 10K to 100K resistor between the positive side and the SX pin. The SX will see a high any time the rectified voltage is above roughly 1.4V (without using the comparator). If you want, you could put a volume control somewhere in the circuit to set the trigger level.
Mike
I would not worry about the sound quality when rectifying and filtering the audio signal as long as you take care that the load attached to the soundcard's line out is not too low. Using a tranformer does not reduce the load when you use a 1:1 transformer.
I like Bean's idea using the comparator, as this seems to me the solution requiring a minimum of external components - see the attached schematic. I only estimated the component values, so some experimenting might be in order but using a relatively large resistor in series with the audio signal makes sure that the sound card almost does not "see" this circuit, i.e. there is a minimum load only.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
I will try theseideas and see what i come up with! I am waiting on my SX48 board. I may need help on programming the comparators which i can do with my SX28 f it is not to different from the 48. I went with the 48 because i needed more outputs to control.
Thanks for the ideas guys!
Kevin
Bean,
I·still have a simple led program you helped me with, if i need to repost this i can if·you want to help and show me how to use the comparators.
Thanks,
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
in the schematic I have suggested, decoupling is done by the resistor in series with the audio signal, and not with the diode.
Using the comparator is pretty easy:
; Configuring the comparator
mode $08 ; access CMP_B
mov w, #%01000000
mov !rb, w ;enable comparator, do not enable comp. output at rb.0
; Insert a delay to allow comparator to respond
; Reading the comparator (same as above)
mode $08 ; access CMP_B
mov w, #%01000000
mov !rb, w ;enable comparator, do not enable comp. output at rb.0, and copy comp. result into w
; When bit 0 in w is set (w = 1), the voltage at rb.2 is greater than the voltage at rb.1
When you don't neet port pin rb.0 for other purposes, you could enable the comparator output (write %00000000 to !rb instead of %01000000). You then can directly check the state of rb.0 for the current comparator result, i.e. you don't need to execute the second
mode $08 ; access CMP_B
mov w, #%01000000
mov !rb, w ;enable comparator, do not enable comp. output at rb.0, and copy comp. result into w
in a loop for reading the result.
Assuming the potentiometer is set correctly, the comparator status would be 1 for no audio, and 0 for audio. You can always exchange the rb.1 and rb.2 pins if you like an inverted result, i.e. 1 for audio, and 0 for no audio.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Is there any differences that i need to change when going from the SX28 to the 48 from a simple SX28 program?
I will give this a try thanks!
Thanks,
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
Post Edited (DigitalDj) : 10/19/2006 1:02:27 AM GMT
IMO, the detection should work with a relatively low level on the audio line, as the comparator reacts on the voltage difference between the rb.1 and rb.2 pins. Let's assume, you adjust the potentiometer for 0.5V between Vss and rb.2, the comparator output will change its state when the rectified and filtered audio signal betwwen Vss and rb.1 exceeds 0.5V by some Millivolts. The SX28 data sheet specifies the typical minumum input offset voltage as +-10mV for an input voltage in the range from 0.4V to Vdd-1.5V. So when the rectified and filtered audio signal at rb.1 is 0.5V or more, you are in good shape. Use the potentiometer to adjust the minimum audio level that shall be interpreted as valid audio signal.
When using an SX48, there are some differences concerning the MODE register (besides other differences). Instead of
mode $08
in my previous example, you need to use the instructions
mov w, $18
mov m, w
instead.
Are you planning to write your application in assembly, or in SX/B? When using SX/B, the compiler will handle the differences between the SX28 and the SX48. As I'm not too experienced in SX/B, maybe someone else can bail in with a demonstration how to deal with the comparator in an SX/B application.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Yes i would like to do it in SXB!
Thanks,
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
You know what screw it since Parallax can't put out a book on SX/B i'll just learn Assembly, I should have done it a long time ago. Gunthers book seems very informative. Thanks for the book that comes with the SX Experimenter Board·Gunther
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
Post Edited (DigitalDj) : 10/26/2006 1:52:53 AM GMT
Reference->Compare->Example (in upper right corner)
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·