Ultra Basic Audio Connection Question

I have a number of iPad applications I run on my sailboat (navigation, radar, etc.). These apps have audio alarms for various reasons (low battery, about to run aground, ship bearing down on you, etc.). It is not always easy to hear the audio alarm, especially when on deck with the iPad below.

I want to take the audio signal from the iPad's audio output jack, feed it to an analogue input pin on an Arduino, and then simply detect when there is ANY audio signal voltage present. If any audio signal is detected, the arduino would activate an existing relay that controls the (loud) signal horn on the boat.

I gather that the iPad audio output is an AC signal of around 1 volt peak to peak but I am not positive about that and know nothing else about the characteristics of the iPad audio output. I do not need to do anything with the audio signal except detect its presence on a pin. I have three questions:

  1. At these voltages, do I even need to rectify the ac signal to prevent harm to arduino from the negative component? If needed can someone suggest a rectifier/diode that would work to protect the arduino pin at audio frequencies?

  2. Is a resistance required to protect the pin? What value would be safe?

  3. I am thinking that a sampling routine with a half dozen iterations would be likely to detect any positive voltage but that is not very rigorous. Numerical integration of the positive component of the audio signal for a few seconds would be more rigorous. I would appreciate any suggestions for the basic concept of programming to detect intermittent audio signal on the pin?

Any comments would be appreciated. Thank you.

The "standard solution" for audio is to bias the input at 2.5V. That requires two equal-value resistors and a capacitor. There is a schematic at the bottom of this post.

Or, in your application a [u]proteciton circuit[/u] is probably a better option. Schottky diodes will conduct before the built-in diodes so the internal diodes are protected. I'd increase the current limiting resistor to 1K or 10K. And, you need a higher-value resistor between the analog input and ground to "pull-down" the input when there is no signal. (You're making a voltage divider and a higher value pull-down resistor means less signal loss.)

  1. At these voltages, do I even need to rectify the ac signal to prevent harm to arduino from the negative component?

Yes. The odds of damaging the Arduino or your iPad probably aren't that high but anything greater than +5.5V or -0.5V can potentially damage either one and it's kind-of dumb to take the chance. ...Especially with anything safety related. :wink:

There are small (low current) "protection diodes" inside the ATmega chip that start to conduct at about 1/2V above Vcc or 1/2V below ground. That creates a "short" and even if nothing gets damaged the audio will be "damaged" (distorted). Those are mostly to provide some static-discharge protection.

If needed can someone suggest a rectifier/diode that would work to protect the arduino pin at audio frequencies?

The problem with a series diode is that it doesn't conduct at less than about 0.5V.

  1. Is a resistance required to protect the pin? What value would be safe?

If the input is not biased yes. With the bias a normal headphone or line-level audio signal is OK. With a 10K resistor the internal protection diodes should be able to handle the current and you can probably rely on the internal diodes. (You still need a higher-value resistor to "pull" the input to ground.)

The iPad has a line audio out, which produces about 1VAC rms at full volume. To connect it to an Arduino you would need to rectify it or bias it by 1.5V or greater.

A much simpler approach would be to use a single transistor to activate a relay, as follows. I would add a 10 uF electrolytic cap from the transistor base to ground.

I doubt most of the tone you are interested in detecting will be at full volume, so the transistor
may not respond at all. But its a simple circuit and worth a try before anything else I guess.

Thanks all. I did not mention in the original post that I want some other unrelated logic for operation of the horn and a "mute" button to silence the alarm for 5 minutes and then resume if the underlying alarm is not resolved. So I will stick with Arduino even though the transistor is simpler.

I will go with the 2.5 volt bias with capacitor as suggested. Thanks to all.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.