Pages: [1]   Go Down
Author Topic: Detecting Microphone Use  (Read 1812 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Everyone,

Any practical suggestions for detecting microphone use before an amp? I have a lot of microphones that I would like to be able to detect which individual one is being used, before they go into a marshaling board, as after that point, i cannot tell at the level of detail that I need.

And yes, these mics are already in place, and adding an extra wire to the switch on the mic is not a practical option, although it would be nice. So it has to be monitoring for a signal. I have around 60 inputs to monitor.

Thanks in advance for any suggestions!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-cry
Has anyone got any ideas?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34572
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You might get a better responce if it was clearer what you wanted to acheave.
What do you mean by microphone use? Please give an example.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right you are - sorry about that!

These are hand-held mics (similar to a cb microphone used on mounted units on trucks etc except without a speaker), and they have a switch on them that is depressed to activate the mic. There is no way of running another wire to the switch on the mic, which would be the ideal way to do it. I was hoping I would be able to detect somehow the AC signal that the voice generates. I want to light an LED when the mic is in use. If it flickers on an off between words etc, that is fine (well a delay would fix that, actually smiley )

Hopefully, that is enough information? Let me know if its not.

Thanks!
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i had this code to an other projrct of mine,

adjust the thresshold value to your mic.

it will work for all analog ins in any arduino .


Code:
/*
microphone sketch
 
 SparkFun breakout board for Electret Microphone is connected to analog pin 0
 */

int           currentState = 0; //the default state
int           wait         = 100; //no need to wait, nothing has happened yet
int           flag         =0;
const int ledPin = 13;            //the code will flash the LED in pin 13
const int middleValue = 512;      //the middle of the range of analog values
const int numberOfSamples = 16;  //how many readings will be taken each time

int sample;                       //the value read from microphone each time
long signal;                      //the reading once you have removed DC offset
long averageReading;              //the average of that loop of readings

long runningAverage=0;          //the running average of calculated values
const int averagedOver= 4;     //how quickly new values affect running average
//bigger numbers mean slower

const int threshold=32000;        //at what level the light turns on

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  long sumOfSquares = 0;
  for (int i=0; i<numberOfSamples; i++) { //take many readings and average them
    sample = analogRead(0);               //take a reading
    signal = (sample - middleValue);      //work out its offset from the center
    signal *= signal;                     //square it to make all values positive
    sumOfSquares += signal;               //add to the total
  }
  averageReading = sumOfSquares/numberOfSamples;     //calculate running average
  runningAverage=(((averagedOver-1)*runningAverage)+averageReading)/averagedOver;

  if (runningAverage>threshold){         //is average more than the threshold ?
    digitalWrite(ledPin, HIGH);    //if it is turn on the LED
  }
  else{
    digitalWrite(ledPin, LOW);           //if it isn't turn the LED off
  }
}
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34572
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A switch in the microphone will disconnect something. However, that something depends on what type of microphone you have.
It should be possible to detect the effect of that switch on the impedance of the line and not have to rely on and signal from speaking. I would do some measurements with a voltmeter and oscilloscope to determine what effects you can see with you your specific microphone.

Detecting a minimum signal to activate something on a sound system is known as a squelch circuit.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot everyone, this gives me a lot to work with. I will report back!
Logged

Pages: [1]   Go Up
Jump to: