5
\$\begingroup\$

As a total beginner, I have a project of creating an alarm device for a sailing boat. The background is the following:

  • a Mac-mini collects, by means of different computer programs, alarms from different sources.
  • in order to make the sound signal loud enough, a simple possibility would be to plug a hifi-system on the sound output of the PC, and set the volume to its maximum. Of course, this solution is far too costly in energy (the boat has limited electrical power).
  • so I'm looking for a workaround. I thought that a static relay, connected to the audio output of the Mac-mini, could activate an alarm such as this one.

There is my question: is it possible to trigger a relay directly from the Mac-mini audio output, or do I have to use a transistor? Some clues are given here but I'm not too sure how to conclude.


EDIT : I just measured the output voltage of an PC audio output (on a PC), and when the volume is at the maximum it reaches from -1V to +1V, with some peaks out of the [-1V,1V] range, if it helps.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ What is your power source and its voltage, for the siren and the circuitry (relay or whatever you choose) for switching the siren? \$\endgroup\$ Oct 25, 2013 at 9:07
  • \$\begingroup\$ The power source is a 12V DC source. \$\endgroup\$
    – anderstood
    Oct 25, 2013 at 9:52

5 Answers 5

6
\$\begingroup\$

I think you could get enough energy from the sound card to trigger a fet and this could turn on a relay. Any sound card should be able to produce a frequency of 10kHz and a few schottky diodes and a couple of capacitors will generate enough voltage for a fet to turn on and activate a relay.

The relay could have to latch (using a spare contact to bypass the fet) and then the problem remains how to turn the alarm off but this can be solved with a manual reset switch. There are other options for disabling the latched relay using left and right audio channels but this may be over complicating stuff.

EDIT - simple audio to relay activator: -

enter image description here

The audio input (let's say 2Vp-p squarewave) gets level-shifted producing a +1.7Vpk and negative 0.3Vpk relative to 0V on the left-hand schottky diode. The right hand schottky diode and 100nF capacitor rectify this to produce a smooth dc level of about 1.4V.

Smaller input voltages will produce lower levels and I reckon with 1Vp-p input it won't produce enogh volts to drive a transistor. Choose schottky diodes with the lowest forward volt drop you can find.

The resultant dc level should be enough to activate the N channel MOSFET - again choose one with a low \$V_{GS(threshold)}\$ - maybe a BSH103 will do the job. I believe it will because the device should be able to activate a 50mA load with 1V on the gate relative to the source: -

enter image description here

50mA to activate a relay should rule-in most PCB mounted 12V relays and there will be less than 1V lost across tthe FET when activating it meaning 11V on the relay coil which should be more than enough. I'm labouring this point because the lower the relay current (EDIT) is, the lower your audio signal can be to activate it. Anyway, it's likely that Anindo Ghosh will point out an even better FET for this (he normally does!!).

The resistor is to discharge the 100nF capacitor across the FET gate and source should the "alarm condition" subside. 1Mohm and 100nF should result in a turn off delay of about 5*CR = 0.5 seconds. You might try and use a 100k resistor to turn it off faster but you'll be limiting the turn on time and possibly starting to eat in to how much voltage can be generated on the FET's gate.

Problems - You know have your sailing boat 0V wiring directly connected to your Mac-mini audio ground and this does concern me a bit. I'd consider two options here: -

  1. Isolating the audio signal with a tiny ferrite/Iron-powder transformer or...
  2. Using an optical isolator that has low forward voltage and produces an isolated voltage out for turning on a FET (just like used in solid state relays).

Photo-voltaic mosfet drivers are not uncommon these days and might be a better route. Here are a few from Dionics that I believe would work well. Most of them produce 6V or more with a LED forward current of 2mA. LED forward voltage is specified at 1.7V, 20mA so it should just about work.

\$\endgroup\$
9
  • \$\begingroup\$ I'd put a basic peak detector with a fairly brief fall-off, then a BJT (to make the switching edge sharp), then a FET to switch the siren. That way, the siren turns on when the computer generates the 10 KHz you suggested, and turns off when the sound card stops pumping out the sound. While I was considering drawing up a schematic earlier today, you're the first responder, so it might be nice if you would :-) \$\endgroup\$ Oct 25, 2013 at 11:22
  • \$\begingroup\$ @anindo out and about on android for a few hours but if I get a chance I will or if you've gotsomething ready to go post it dude or edit mine or whatever you feel appropriate. \$\endgroup\$
    – Andy aka
    Oct 25, 2013 at 12:13
  • \$\begingroup\$ Haha! Same here, mobile-only for now. :-) \$\endgroup\$ Oct 25, 2013 at 12:21
  • \$\begingroup\$ @Andyaka Thank you for your answers. Were you thinking about a scheme such as that proposed by Olin Lathrop? \$\endgroup\$
    – anderstood
    Oct 25, 2013 at 12:57
  • \$\begingroup\$ @anderstood a slightly more refined version with about 2x sensitivity. I'll draw it in an hour. \$\endgroup\$
    – Andy aka
    Oct 25, 2013 at 13:48
5
\$\begingroup\$

Here is a simple circuit that will cause a relay to be closed when a sufficiently strong audio signal is fed in.

A small 12 V relay should only need 10-15 mA to turn on, and then be able to switch a few amps of current. You probably need to turn up the volume on the computer output as high as it goes.

Added:

Here is a circuit that is slightly more complex but will require a lower audio level to trigger it in most cases:

The difference is that instead of just using the positive peak voltage of the input signal, this uses the peak-to-peak voltage (minus two Schottky diode drops). It also relies on the input signal being AC. The two diodes D1 and D3 with C1 form a charge pump that will produce the p-p voltage on C1 minus the two diode drops. For a normal tone of at least a few hundred Hz, that will provide a bit more base drive to the transistor than the first circuit.

I don't think this second circuit is really necessary, and the first one will most likely work fine. I am showing this second option because I see that gain has become a issue. Try this if you have trouble with the first one needing just a bit louder audio than your PC normally produces.

\$\endgroup\$
5
  • \$\begingroup\$ Thanks a lot. I guess what I have to do now is to try it concretely! Do you recommend any particular type of relay (e.g. would a static relay with a minimum tension of 1V suit?) \$\endgroup\$
    – anderstood
    Oct 25, 2013 at 13:11
  • \$\begingroup\$ @ander: I don't know what "minimum tension of 1 V" is supposed to mean. You said you have 12 V power available, so you should get a 12 V relay. Get a small one that only needs 10-15 mA of coil current. Those can still switch a few amps, which should be more than enough for some kind of alarm. \$\endgroup\$ Oct 25, 2013 at 13:44
  • \$\begingroup\$ I see. My comment proved a misunderstanding in the behaviour of a relay, sorry (I thought the change of state of the relay required a given tension). I'll order the electronic components next Monday and accept your answer if it works. Thanks again \$\endgroup\$
    – anderstood
    Oct 25, 2013 at 15:05
  • \$\begingroup\$ Does anything change in this circuit if I have 5v relay as well as power supply? My audio out reaches 3.2V so the 2 circuits must be working well I guess. \$\endgroup\$ Sep 7, 2016 at 9:35
  • 1
    \$\begingroup\$ @nat: The output of the transistor is quite independent of the input. You can use whatever relay voltage you want, as long as the supply voltage matches, and the transistor is rated for that voltage. One problem with lower voltage relays is that they take more current, which requires more base current into the transistor to turn on the relay. That may or may not be a problem, depending on the impedance of the audio signal. You can always use a second transistor for more gain, which would allow for much higher current relays to be driven. \$\endgroup\$ Sep 7, 2016 at 10:44
0
\$\begingroup\$

Looks like the mac mini has a bluetooth interface, and you can buy bluetooth relay modules. Or, USB to a microcontroller (via a USB-UART bridge if necessary), and drive a relay off that.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, but then I have to convert all the sound alarms to bluetooth, which is not easy as the alarms are produced by different closed programs. \$\endgroup\$
    – anderstood
    Oct 25, 2013 at 12:44
0
\$\begingroup\$

Connecting an Arduino and using its GPIOs would be cleaner. Another simpler possibility is to use a simple serial port and activate/deactivate one of the signals (DTR for example) with a simple program.

\$\endgroup\$
-1
\$\begingroup\$

Just connect it via schottky diode (low drop, high enough leakage current) to powerful N-CH mosfet's gate (with high enought gate capacity > 1nF). The mosfet will connect your load. Threshold open voltage of Mosfet should be a little, < 1,5V ex.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.