Low Voltage / Audio Pickup

Hi

I'm new to Arduino but learning an awful lot in a short space of time. All this is because I want to learn electronics, with already being an IT specialist so the programming side may be easier for me than most beginners.

I have a project that I want to do, firstly with the Arduino and then see if it is possible to do without it.

Basically I need to use audio as a switch to simply flip a relay or for ease at the moment just light some leds.

The audio socket on the laptop is only sticking out 200ma so I'm guessing I need to amplify this a bit as even a transistor (as far as I know) requires at least 0.6v to trigger. I'm sure it will also be too low for the board to pickup on the pins.

Does anyone have any ideas on how I can get over this? It would be nice if I can get this working with and without the Arduino as the project may go live and require 2 or 3 units to be used and buying extra Arduino boards may make it too expensive.

Oh I have the Uno should you need to know.

Thanks in advance for any help.

Paul

Langy:
The audio socket on the laptop is only sticking out 200ma so I'm guessing I need to amplify this a bit as even a transistor (as far as I know) requires at least 0.6v to trigger. I'm sure it will also be too low for the board to pickup on the pins.

Did you mean 'mV' (millivolts) instead of 'ma' (milliamps)?
Typically you would use an amplifier to raise the voltage. An op-amp (Operational Amplifier) can be set to a specific gain with a couple of resistors. You will probably also want to add a DC bias so the signal doesn't try to go negative.
Is there something specific about the sound you would like to trigger on? Amplitude/volume? Frequency?

Yes, I did mean 200mv.

The project / task is that I have 3 laptops in our call centre which are all running live reports to show the agents the status of their call centres. When certain warnings happen I play an audio was file which is just a boxing ring bell sound that plays once as it is short, sharp and loud.

On the warnings I can highlight fields on the displays that I am running but they are not visible enough for the agents.

I'm planning on playing the sound on either the left or right output which lasts about 1-2 seconds. Then on the other line play a constant audio sound that can be used as a trigger. The bell sound will go to a speaker and the other line to a pub of some sort.

If I need to use that as a full trigger to stay open for as long as I need to do something like illuminate several LEDs or hit a relay to run something bigger then I could just make the audio track longer so that on the trigger channel it plays the constant sound for the required length like 5 or 10 seconds and just one bell sound is played on the other channel for the speaker.

As I say I'm new but learning so what may seem simple to others even the diagrams I may have newbie questions.

I dug out my old electronics bits last night when I last had a play 20+ years ago. At least I have lots of resistors and a few other bits, lol. Things just seem easier to reach now especially with the Internet and the Arduino.

200mV seems a little low for a "full volume" signal but it should be enough for the analog input.

So, the logic would be, "If the analog signal is above the threshold, trigger".

The Arduino's analog-to-digital converter is 10-bits (so it reads from 0 - 1023) with a built-in default references of 5V or an optional internal reference of 1.1V.

So with 200mV the ADC and the 5V default reference, the ADC should read about 40. But, assuming it's 200mVAC RMS, the peak voltage is about 1.4 times the RMS value for a peak reading of about 56.

Now... You can't feed the AC audio signal directly into the Arduino because you are not supposed to feed negative voltages (or voltages greater than 5V) into the Arduino.

The most common solution is to bias the input to 2.5V with a [u]voltage divider[/u] (2 equal value resistors) as show [u]here[/u]. You need also need the 10uF capacitor to isolate the 2.5VDC from the AC signal source (you can ignore the 47nF capacitor).

Then, you can subtract-out the bias from your ADC reading in software or otherwise compensate for it (such as setting your threshold higher, etc.)

The downside to biasing the input is is that you can't increase sensitivity by using the 1.1V reference (because you're already above 1.1V with the 2.5V bias).

So, I suggest you start with building the bias circuit. Then run the [u]Analog Read Serial[/u] sketch. With the bias circuit in-place you should be reading somewhere around 512. Then connect the audio and you should see the numbers jumping around above and below 512.

That will give you an idea of where to set your threshold and you can start working your actual sketch.

As you probably know there is an LED on the Arduino connected to pin 13, so you can test with that and when you're ready to add a relay/transistor/MOSFET, etc., you can stick with Pin 13.

To drive "several" LEDs or anything that takes more than 5V @ 40mA, you'll need a relay, transistor, or MOSFET to "boost" the output.

Many thanks for the reply.
I will take a look at this when i can properly go through it and will post back with any questions or results.

It would be nice if I can get this working with and without the Arduino as the project may go live and require 2 or 3 units to be used and buying extra Arduino boards may make it too expensive.

You can make a comparator from an op-amp to detect a preset voltage threshold, and then, say if you wanted to trigger a buzzer for 30 seconds (or for whatever time) you could use an NE 555 timer. That would all be done in hardware, so no programming.

You'd need a breadboard, perfboard, or custom circuit board to something like that and the hardware design & construction would be more time-consuming than a simple software sketch. The cost trade-off also depends on if your time is free and if you are going to amortize the "engineering" over 1 unit or many-many units, etc.

OK I've now had a proper look at the link you gave and created the attached circuit.

A couple of questions.

On the connection to the speakers do I need to attach the screen to anything?
Basically for testing I've took an old headphone socket from a mobile phone and cut the cable on the left speaker. I'm left with the main live wire and screen wire, what do I need to do with the screen wire.

Secondly I have a bunch of old capacitors from over 20 years ago when I bought them in a packet from Tandy. They are the flat brown disc type, will these be suitable to use?

On the connection to the speakers do I need to attach the screen to anything?

Yes the ground of the arduino.

They are the flat brown disc type, will these be suitable to use?

No those are ceramic types and are not going to be high enough in value, typically they are only 0.1uF which is 100 times smaller than you need.

Yes I've noticed that now as I've dug them out and a bit of searching they are really low value.
I will order some of those up so I can start creating some small stocks.
Looking on eBay the 10uf all seem to be +-20% is this normal or just down to them being so cheap?

DVDdoug:
You can make a comparator from an op-amp to detect a preset voltage threshold, and then, say if you wanted to trigger a buzzer for 30 seconds (or for whatever time) you could use an NE 555 timer. That would all be done in hardware, so no programming.

You'd need a breadboard, perfboard, or custom circuit board to something like that and the hardware design & construction would be more time-consuming than a simple software sketch. The cost trade-off also depends on if your time is free and if you are going to amortize the "engineering" over 1 unit or many-many units, etc.

Back to the non Arduino side as it would be a good project to do some more learning, I have a RC555N chip from when I dabbled 20+ years ago, can someone point me to a diagram for the comparator etc. Will do some searching myself.

10uf all seem to be +-20% is this normal

Yes it is.

Hi

I thought I would give an update as all the components that I required have now been delivered.

It's lunchtime and with limited resources I decided to strip another set of Mobile headphones to et back to the bare wires to run the test as per the wiring diagram.

Using the two resistors and capacitor I connected everything up to the Arduino, initially not connecting the audio line so that I could see what was happening to the voltages and the signal on the AI.

It was sitting just above 500, mainly on 510 and bouncing a little between 508-511.

On with the Audio input and it took some fiddling around until I got some signal as the wire is very thin and I don't have the soldering iron or any clamps here to connect it properly to the board. Eventually with the small 1 second Audio file at full volume and on repeat the signal bounced to over 600 and around 400. With a constant repeat the limits did hit about 200 and 800.

The next stage is to tin the ends of the lead I have and then at home I do have some blank audio connectors which I will try wiring up a mono with some thicker wire to see how it all settles.

I will post back with more updates as I progress.

Oh and when I checked the Audio signal again the 200mv is the full range, on the + side it's actually only about 125mv.

Thanks again for the help.