external Microphone

Hello,

what is the line in voltage for the ext. microphone?

I guess that with the following circuit[1] Microphones that are pre-amplified could be connected ?

Can you give me an example of an Microphone without “pre-amplified” and more specific how can I search for such one?

Thanks!

[1]

Unfortunately, I need to start off by saying that ultimately we (=Audeme) don’t know. The microphone jack connects directly into the AllWinner chip and whatever proprietary circuit is in there. The only documentation we even have for the chip is this: http://dl.linux-sunxi.org/A13/A13%20User%20Manual%20-%20v1.2%20(2013-01-08).pdf (chapter 23)


Having said that, in working with the chip, we found out that pretty much any electret microphone will work. These are the types of microphones that are usually included in headsets or in cell phones. https://en.wikipedia.org/wiki/Electret_microphone

If you want to connect an amplified signal, you are correct, you need an attenuator. The one you are showing will probably work. I have successfully used the following circuit in the past for a line level signal:


C1
+Line level in --||----R1----±- +Mic level output
+ |
|
±—R2----+
|
Ground (input)----±-------------- Ground (output)

Thank you! will try it out and write back :slight_smile: The circuit draw a colleague of mine who has audio/musk knowledge.


Got the shield today … now playing(talking) with (to) it :slight_smile:

Nice, keep us updated on the progress.

Hello,


I have a related question about using an external microphone. I’m just getting started using MOVI and trying to integrate it into my project. I need an external microphone because the Arduino and MOVI will be tucked away in a place where it is certain to be unable to hear me. I like the microphone that I was using with my “other less capable voice recognition board” because of its long cable, suitable size, and it comes with a clip that works great where I need to mount it.


The trouble I’m having is that when I plug it in, MOVI hears nothing while running the LowLevelInterface example sketch. The problem may be that the plug on my mic is a mono style one. A quick web search suggests that this would only allow the “left channel” to be passed through (if one could say a single microphone had two channels) and the right channel would be grounded.


Is it true that MOVI only listens on the right channel of the stereo jack used for the microphone? If that is so, then is there a way to tell it to listen to the left channel instead or is this hardwired on the board? Baring that, could I cut the plug off the microphone cable and solder on another jack (hints welcome on wiring if this is even possible)? I don’t have room for a bulky adapter, everything in my project is pretty tight already, the rear location of the jacks on MOVI is already presenting me a bit of a challenge.


Thanks in advance for any help or advise!

Dylan.

Dylan,


MOVI has a stereo jack as external microphone input where both channels are put together. So MOVI listens to both the right and the left channel. So if you plug a mono jack into the stereo jack, you’ll short circuit your microphone. This is, among other places, explained here: http://sound.stackexchange.com/questions/25577/stereo-and-mono-cables-and-jacks-what-happens-when-you-cross-them. We need to provide a stereo jack though because most headphones have a stereo jack even though the microphones and our input is mono (again, see explanation at the link above).


Your problem can be most likely solved with a mono to stereo adapter like this one. If you want to do soldering yourself, the easiest way is to cut the cable and solder a stereo plug yourself by connecting GND to GND and the signal to both left and right.


Gerald

Thank you for the info about the short circuit Gerald. I incorrectly assumed that the one channel being short circuited to ground would leave the one channel enabled. I built a little adapter as you suggest and that does work. Now I’m not happy with my cheap microphone’s response as it seems to be clipping off the beginning and end of my commands and cutting off unexpectedly when I use the LowLevelInterface sketch (even with very low values for setThreshold() like 2), but for now I’m going to assume I need a better quality microphone. I may post again if I cannot find a suitable microphone.


FYI - Many (perhaps most?) microphones designed for vehicle usage have a mono connector, so depending on how people plan to use MOVI you may get other people contacting you with the same issue. You can search Amazon for “car microphone” to see what I mean.


I have at least one other question about MOVI’s behaviour but I think I’ll post in a different topic as they don’t relate to the microphone.


Thanks again,

Dylan.

I was just re-reading this thread together with the MOVI user manual trying to get some hints on what sort of specs I should be looking for in a proper external microphone. A few things leave me confused and concerned. The user manual says these things:


“By default, the integrated electret microphone (see Microphone in Figure 1) is used. This

microphone is internally connected to an Automatic Gain Control that will amplify

incoming sounds to standard level independent of the distance. This will work up to

about 15 feet (5 meters), under good conditions sometimes even for wider distances.”


followed by


“Also, the signal that comes through

External MicIn is not amplified.”


Does this mean that I don’t stand a chance of getting as good performance from an external microphone (without additional circuitry) as the integrated microphone? That would be a shame because my Arduino and MOVI need to be tucked away where it could never possibly hear me. But then to add to my confusion, the user manual says:


“Note: Do not connect a Line-In signal or any other signal that is pre-amplified to the

microphone jack.”


So the integrated mic has some sort of automatic amplification, the external microphone port does not, yet I must not amplify the external mic in any way? Would I be best to desolder the integrated mic and hardwire a 3.5mm port to the resulting pads or through-holes so I can connect an external mic that would benefit from the same gain control circuitry that the integrated mic enjoys?


While I am here, I should point out an error in this section of the user manual. Based on my experience and responses above, the following statement is incorrect:


“Note: Only connect 2-conductor (mono) and 3-conductor (stereo) headphone jacks

to MOVI.”


A mono connector plugged directly into the microphone input jack does not work making that statement false for the microphone port.


Dylan.

I’m glad I found this thread, and I’m interested in the responses to the post above.


I also intend to tuck my Movi away behind an entertainment unit and use an external microphone. I was hoping for more accuracy/clarity this way. However I wrongly assumed that a typical (mono) interview mic (the type that would clip onto your shirt) would be suitable for this.


I think I need to know the clarification regarding mono vs stereo and amplification of external mics before I proceed.


A related question though: If the mic-in port is indeed stereo, is it more advisable to bridge the mono microphone across L & R channels, or use TWO of these external microphones (one left channel, one right, common ground) to improve coverage/direct of the microphones? Or would this introduce some kind of latency/echo problems?

Dylan,


First of all: Thank you for the correction. The user manual is indeed not correct. Mono connectors will short circuit your microphone, resulting in a clean 0 energy input. :frowning:


Then, I unfortunately need to repeat my caveat again, that ultimately all we know about the microphone circuitry in the A13 chip is described here: http://dl.linux-sunxi.org/A13/A13%20User%20Manual%20-%20v1.2%20(2013-01-08).pdf (chapter 23)


Whenever you connect a microphone to the external mic jack, you directly connect to the A13 chip and, as said above, in working with the chip, we found out that pretty much any electret microphone will work. These are the types of microphones that are usually included in headsets or in cell phones. See also: https://en.wikipedia.org/wiki/Electret_microphone

Whenever you use the internal microphone, however, the microphone output goes through an Automatic Gain Control (AGC) circuit. This is a circuit that will keep the signal’s low energy ranges low (ignore noise), amplify the middle energy ranges (assuming it’s the signal far away), and dampen the high energy (to prevent clipping). For a description of how an AGC works, check here: https://en.wikipedia.org/wiki/Dynamic_range_compression So the internal microphone isn’t actually amplified (ie., the signal is scaled up proportionally) but it’s dynamic range is compressed.


So now to your question about integrating MOVI into a box. Whether you need dynamic range compression for the microphone that you externally connect to MOVI depends foremost on your application. Speech recognition experts will distinguish two use cases: Far field and near field. Far field speech recognition is the speech recognition MOVI is performing when you talk to it (from a distance) using the onboard microphone. Near field speech recognition is what happens when you use a microphone close to your mouth, e.g. using a headset microphone.


For near-field speech recognition, you just connect a headset-type microphone to the external Mic jack of MOVI and you are done. However, if you want to do far-field speech recognition using an external microphone, it’s a bit more complicated:


First, you need to chose a microphone that will actually allow you to catch the signal over a distance. Obviously a microphone capsule like the one we integrated in MOVI works. Then I would recommend to use a dynamic gain control circuit, just like we did in MOVI. The chip we integrated in MOVI is the MAX9814. It’s very easy to use and Maxim Integrated has an evaluation kit. Also, Adafruit sells a little board with it: https://www.adafruit.com/products/1713 .

The chip, however, like any other of these chips will output line signal. Therefore, you will need a circuit like the one already depicted above to attenuate the signal back to microphone signal:



C1
+Line level in --||----R1----±- +Mic level output
+ |
|
±—R2----+
|
Ground (input)----±-------------- Ground (output)

dmworking,


I would bridge the two microphones across L&R as we only do mono anyways. Be careful though: If you place the microphones too far away from each other, you will have a phase shift between the two microphones. This is due to the speed of sound. This blog post explains it quickly: http://www.uaudio.com/blog/understanding-audio-phase/
Of course, we are not concerned about listening to the signal hear but speech recognition accuracy might suffer if there is too much of a phase shift. I guess you could call these ‘latency’ problems :slight_smile:


When you place your far-field microphone, you should also make sure that they are far enough from the speakers as otherwise, you’ll indeed get feedback loops and echos. To debug those, I recommend using the


MICDEBUG ON

Thank you for the explanation Gerald, I think that explains why I am seeing such a dramatic difference between using an external electret microphone at about a 2-3 foot distance and speaking to MOVI’s integrated electret at a similar or even further distance. I can only get similar results from the external microphone if I speak loudly and clearly into it from a distance of perhaps 1-2 inches. I’m not very hopeful that the microphone I chose from Amazon today will fair any better than the cheap eBay one I already have given your response. I feel it is a bit of an unfortunate design decision to have left the external microphone without any amount of gain control, but that is how it is so at least I now understand it.


I know that you have previously described and stand by the caveat of the external microphone connecting directly to the A13 chip. Unfortunately that left end users still in the dark with respect to the lengthy work that you did to compensate with the gain control circuit attached to the integrated microphone. Your description of the combined adafruit MAX9814 circuit together with the attenuation circuit begins to shed light on what needs to be done to match the performance of the integrated mic when using one plugged into the external port. I have to say, from an end user perspective, this is a very large difference and believe that the user manual doesn’t do enough to emphasize just how different the performance characteristics of the integrated mic differ from a mic plugged into the microphone port without any supporting circuitry.


I don’t think that the circuit you describe is too complicated, it’s just going to be ugly for me to add that physical circuitry to my design. Would you be able to share the model number or specs for the microphone that is onboard of MOVI? It might be cleaner for myself or others to desolder the onboard microphone and simply solder and run a cable to the very same model of microphone, just mounted at a distance.


Dylan.

Dylan,


I can give you the part number (I need to look it up though) but I am not convinced that’s helpful to you. How long is the cable going to be? Depending on the length of the cable you completely change the characteristics of the circuit (microphone impedance and capacity) and then it’s not the same circuit anymore.


Here is my recommendation:

Go and get the Adafruit circuit I mentioned (with the microphone on) and treat the entire circuit as your microphone (it’s pretty small). Then run the cable to MOVI with LINE level signal that comes from the Adafruit circuit (line signal level is made for cables). Then, right at MOVI’s ext mic in plug, you use the little 3-part circuit from earlier in this thread to attenuate the signal to mic level. This way, a gain controlled, line-level signal runs over your cable and at the same time all you need is a 3-component circuit close to the MOVI board (which will not take a lot of space). From an audio perspective, I have a feeling this will work very well!


Do you think this would work for you mechanically?

Gerald,


The cable needs to be somewhere between 8-10 feet long. Is that too long to have any hope of some degree of success? I was all ready to desolder that mic as it really would be the simplest solution just from a physical layout perspective.


In theory your recommendation would work. Two things I’m not sure what to do about. First, the Adafruit board doesn’t come with a case, and fabricating one that is such a small size has me a little stumped. I need for it to look half way decent because it would need to be in view. The second problem is where to put that attenuation circuit. I might be able to solder the 3 components directly to the back of the 3.5mm jack I have mounted on my Arduino box, but I’m not sure that will be robust enough with the components just sort of hanging there. I’ll need to consider it for a bit.


Dylan.

Dylan,


Unfortunately, 8-10 feet is pretty long. The cable shouldn’t be any longer than a typical headset cable. Electret microphone signals are in the tens of milli volts range! Seeing your car application though, I think a headset would be your best bet (just don’t cover the ears of the driver). Once you get that working, you can move on to try other microphone types. The problem with using an AGC is that the car noise will most likely be amplified, so I wonder if you can get your hands on some directional microphone (that’s what cars usually use for speech recognition).


Regarding your case for the Adafruit circuit: A match box would literally do it. I recommend asking a friend with a 3D printer. The three components can literally be as small as you are able to solder them together. They can easily fit into the space between the two audio jacks, for example.


Gerald

Okay, thanks for the advise on the cable length. I had a feeling you’d suggest a headset mic for the car once you saw my video. I figure I’ll try a more suitable microphone circuit at the location I have it now (rear view mirror) but I stand warned that the results may continue to be unreliable without a headset.


I did think about the 3D printer option for the case. I might scrounge around first at the Dollar Store to see what they might have that could work.


Alright, I’ve got some building to do before I move forward - I’ll quiet down for a while now. :slight_smile:


Dylan.

So I’m back with some progress and a whole lot of learning. I have a few more questions, most of them I’m going to put in my other post though because it has more to do with MOVI’s features and behaviour than the microphone.


I got one of those Adafruit 9814 microphone boards, wires, connectors, etc. I built the microphone into a nice small metal mint box. I was able to build the attenuator circuit inside the housing of a larger metal shielded 3.5mm jack. In a non-hostile environment (more on this below) it works just about as well as MOVI’s internal mic. I played with jumping the Gain pin to ground or Vdd to change the Gain but the best results I have found so far are to just leave it unjumpered. Thank you for getting me this far!


Now the hostile environment part. The first section of this post doesn’t really have any open questions, I’m posting it more as info that might be helpful for someone in a similar situation. My Arduino is intended for use in a car as you may recall. I went for a test drive and MOVI was unresponsive. Having a good guess at the issue, I put MICDEBUG ON and started the engine a second time. All MOVI could hear was a nasty snapping buzz; not the noise of the engine but some sort of electrical interference. If I yelled directly into the microphone I could barely hear myself under all the electrical noise. The noise was very reminiscent of the noise I got from my Sparkfun MP3 shield when I was first building my project. To solve that, I added a ground loop isolator between the Sparkfun MP3 shield and the amplifier which drives the speakers. That just about eliminated the noise for the MP3 shield.


So I went and got a second (different brand/design) ground loop isolator to use with the Adafruit mic - this one here:


http://www.amazon.com/Smof-Ground-Isolator-Eliminating-System/dp/B0171PQLB8?ie=UTF8

I learned that not all of these isolator devices are created equal. Even on the “bench” without any engine/ignition/alternator/etc. noise to cause problems, when I put that ground loop isolator between the output from the Adafruit Mic and the attenuator circuit or between the attenutor and MOVI, MOVI essentially cannot hear me. If I yell directly into the microphone it hears me but it sounds like I’m talking into a Kazoo (that’s the best analogy I can think of).


I skeptically swapped the ground loop isolator with the one I use for my Sparkfun MP3. This one here:


http://www.amazon.com/dp/B001EAQTRI/ref=sr_ph?ie=UTF8&qid=1461366180&sr=1

It worked on the bench, yay! At first it did almost nothing to stop the buzz with my engine running if I put it before the attenuator, but after the attenuator it works quite well. The Smof brand device works just fine with the Sparkfun MP3 player. I’m a little confused by why this would be the case, but at least I found a combination of parts that gets me past my electrical noise issue for the most part.


I did a lot of playing around with the LowLevelInterface sketch in order to figure out what MOVI is hearing because I couldn’t seem to find a single THRESHOLD value that would work in all conditions. When there is no engine noise (engine off), I need a THRESHOLD value of about 9 to have MOVI reliably hear me; anything close to 20 and it gets nothing without yelling directly into the mic, and even there it sometimes just gets a clip of what I’m saying in that case. But then to my surprise, I need to bump the THRESHOLD to about 22 to get it to reliably hear me with my engine “idling”. Then with the engine at driving speed, I need to go even further - I’m currently playing with 25. Here’s a snip of how I’ve done this so far, I’d appreciate your comments on this:



#define DEFAULT_MOVI_THRESHOLD_ZERO_RPM 9
#define DEFAULT_MOVI_THRESHOLD_LOW_RPM 22
#define DEFAULT_MOVI_THRESHOLD_HIGH_RPM 25
#define RPM_ZERO 0
#define RPM_LOW 1200

uint8_t MOVI_THRESHOLD = DEFAULT_MOVI_THRESHOLD_ZERO_RPM;

// I call this routine every 100 millis:

void movi_adjust_threshold()
{
uint8_t current_MOVI_THRESHOLD = MOVI_THRESHOLD;
uint32_t rpm = ecm.ecmValue[VALUE_RPM].decodeValue();

if (rpm > RPM_LOW && MOVI_THRESHOLD <= DEFAULT_MOVI_THRESHOLD_LOW_RPM) {
MOVI_THRESHOLD = DEFAULT_MOVI_THRESHOLD_HIGH_RPM;
movi.setThreshold(MOVI_THRESHOLD);
} else if (rpm > RPM_ZERO && rpm <= RPM_LOW && (MOVI_THRESHOLD <= DEFAULT_MOVI_THRESHOLD_ZERO_RPM || MOVI_THRESHOLD >= DEFAULT_MOVI_THRESHOLD_HIGH_RPM)) {
MOVI_THRESHOLD = DEFAULT_MOVI_THRESHOLD_LOW_RPM;
movi.setThreshold(MOVI_THRESHOLD);
} else if (rpm == RPM_ZERO && MOVI_THRESHOLD >= DEFAULT_MOVI_THRESHOLD_LOW_RPM) {
MOVI_THRESHOLD = DEFAULT_MOVI_THRESHOLD_ZERO_RPM;
movi.setThreshold(MOVI_THRESHOLD);
}

if (MOVI_THRESHOLD != current_MOVI_THRESHOLD) {
Serial.print(F("Adjusting MOVI threshold - RPM = “));
Serial.print(rpm);
Serial.print(F(” ; from “));
Serial.print(current_MOVI_THRESHOLD);
Serial.print(F(” to "));
Serial.println(MOVI_THRESHOLD);
}

}

Dylan,


Wow, there is a lot of cool information in your post. Thank you for that. I happened to do consulting a couple months ago for a company where that grounding information would have come in handy!


Regarding your threshold question.

First of all: Threshold is absolutely linear. So higher threshold means less sensitivity. So from a MOVI perspective it would never make any sense to lower the threshold in higher noise conditions. It does make a lot of sense, as you say, to up the threshold in higher noise conditions.


Two things to consider for understanding threshold:

1) The Lombard effect. The Lombard effect is the involuntary tendency of speakers to increase their vocal effort when speaking in loud noise to enhance the audibility of their voice. You will speak louder in a higher noise environment, if you believe it or not. Check the Wikipedia article out. This will make it even more sensible to set higher thresholds in higher noise.

2) However, now that you successfully added your Adafruit 9814, you actually added a non-linearity! Super-loud noise will be dampened by the AGC and low noise might be amplified. This means that your threshold value will indeed behave strangely (ie. non-linear) sometimes.


In general, you ask, is this the right approach?

Not taking MOVI, e.g. if you were working for a car company, your best bet would be to retrain MOVI’s acoustic models using the car environment and/or doing model adaptation. The current version of MOVI doesn’t support that. Future versions might but it will still require a lot of knowledge on how speech recognizers work to actually do that.


With the current version of MOVI your best bet is basically what you are doing:

a) Keep as much of the car noise from entering the microphone as you can by placing and acoustically shielding the microphone (use MOVI’s MICDEBUG ON feature for testing).

b) With that, definitely adjust your threshold based on various conditions.


Hope that helped…

A brief update here and a couple of (hopefully easy) follow up questions.


I was having trouble with MOVI being completely unresponsive at higher engine RPM, and therefore of course more noise. I used MICDEBUG and found that I was getting a loud crackle/buzz/pop that would completely swamp and distort my voice at anything over about 1000 RPM. I tried chasing more electrical noise but nothing seemed to change it. Then I dropped the Adafruit mic down to a max gain of 50db by grounding the Gain pin and the buzz completely (and it was super loud before!) went away in all conditions I was able to reasonably test.


Am I correct in saying that 50db is half 60db in terms of gain? I halved my MOVI thresholds and it seems to be working pretty well but I wanted to validate my understanding. Might I ask - with MOVI’s built in MAX9814, what do you have the max gain set at - 40, 50, or 60? I guess what I’m really trying to understand with that question is if it’s possible that the 60db gain from the Adafruit mic attenuated using that circuit you linked above could be overloading the mic input or if it’s more likely I’m amplifying electrical noise. I imagine if it was the latter that I would still hear the buzz with 50db gain, just at a lower volume, but I am a total amateur with both audio and electronics so there is much I do not know or understand!


One more question for now - suppose I’m half way through saying my callsign or sentence, and my Arduino detects conditions in which it wants to call setThreshold to increase or decrease the threshold due to the expected amount of noise. Does calling setThreshold interrupt/reset MOVI’s listening? Said a different way, I’m wondering if I am better off to be switching thresholds a lot, or if in doing so I will interrupt MOVI’s listening often in which case I might be better off to find some “central value” that works for a wide range of conditions.


Thanks again,

Dylan.

Dylan,


10db is a factor 10. 3db is factor 2. See also: http://www.satsig.net/lnb/db-calculator.htm

We use the lowest setting. AdaFruit has a tutorial on their MAX9814 module (just in case you haven’t seen it) and they are also strongly arguing against using the higher settings.


So I just went through MOVI’s firmware source code for you and the threshold setting is actually updated with a delay of only 1/16 of a second. So you should be fine actually. And no you will not interrupt MOVI’s listening. You will mess up the speech activity model. But maybe that’s not too much of a problem in your case.


MOVI 1.1 will feature a “FINISH” command btw. to force finish the listening.


As usual, hope that helped…

Gerald