News:

SMF for DIYStompboxes.com!

Main Menu

iPhone mic jack

Started by Matthew Sanford, January 14, 2023, 09:28:27 PM

Previous topic - Next topic

Matthew Sanford

Has anyone had success building a breakout for an iPhone mic jack? I've tried things I've found online (I think for older models; I now have a refurbished X), mostly 2.2k mic to ground, or with a cap in the mic line, or that with resistors on either side to ground...no avail, I think one bled it in with the mic on the phone but recording apps don't recognize it
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Matthew Sanford

Not to bring it back but just a note in case...

2.2k between signal and mic input got it recognized, and then a 6.8n cap brought the volume up (1uf killed the signal)
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

ElectricDruid

Thanks Matthew. Someone somewhere will do a search for this and find this little nugget of information, and they will bless you! ;)

Rob Strand

#3
I don't know the answer for Apple specifically but maybe you have the wrong picture in your head about what's going on.

Microphone input on PCs and Phone expect a condensor microphone.    The condensor microphone has a built-in JFET preamp.

The Phone/PC supplies power to the microphone from inside the device using a pull-up resistor which goes to a positive supply.  The details of the internal supply voltage and resistor can vary.

The microphone input connection has DC voltage and AC voltage.     The DC voltage is required to bias the microphone correctly, somewhere around 1.2V to 2V.   Inside the PC/Phone there is a capacitor between the mic pin and the internal audio input - you can't access these.  The DC voltage is also used by the phone.  The DC voltage is often used to detect the headset push button.  Pressing the switch shorts the microphone and forces the DC voltage to zero. Some phones also use the DC voltage to detect the microphone.

You can deduce the voltage by measuring the DC voltage by measuring it directly with nothing connected and you can deduce the pull-up resistor by measuring the current to ground, then R = V_open_circuit / I_short_circuit.    Typically the voltage is about 2.2 to 3V and the resistor 2k2 to 6k8.

The condensor mic typically draws about 200uA, or 280uA at 2V.   That means it sort of looks like a resistor 2V/280uA=7k or  2V/200uA = 10k.   The maximum is about 400uA which means 2V/400uA = 5k.

Quote2.2k between signal and mic input got it recognized, and then a 6.8n cap brought the volume up (1uf killed the signal)

That resistor value looks a little low but not unreasonable.  Try 4k7.

The best thing to do would be to measure the DC voltage with the microphone plugged in, then work out what resistor value gives you that voltage.    That means *whatever* the phone/mic are doing you are mimicking it.

The cap needs to connect *between* you external signal source and the microphone pin.   The resistor needs to connect from the microphone pin to ground.   You probably need about 10uF.

Just in case:  There's an added complication adding a cap.  When you first plug into the phone the cap needs to charge up.  The cap causes a temporary short between the microphone pin and ground.   If the phone only looks at the DC voltage for a short time it might not detect the microphone (I don't know).  If that's the case then the simple cap couple might not work.   In which case you will need have the cap pre-charged, or use a transistor or JFET to interface to the microphone pin.   I have my doubts you will need to go that far.


On the last point.  After you tune the resistor, by all means try a large cap.  It's much easier.

If however the big cap causes problems there is a work around.

- keep your resistor to ground on the phone mic input ; whatever value that is
- find the largest cap that doesn't cause problems.  I saw one guy using 200nF,sat 220nF

If you want to record without losing bass you want a lower cut-off frequency below 20Hz, let's say 7Hz.

If the phone + added resistor looks like 1k ohm then you will need a cap,

C = 1/(2*pi*7*1k) = 22uF

If the 22uF cap cause problems and we can only use 220nF then it seems like there's is no solution!  However there is a trick.  With the cap fixed at 220nF, you can add second resistor in series with the cap,

R =  1/(2*pi*7*220nF) - 1k   = 102k.

The downside is that's going to give you quite a large signal attenuation.

Mic inputs are usually too sensitive anyway so we can handle some attenuation however, a factor of 100 loss might be a bit high.  You might have to work a compromise between signal loss and low frequency roll-off.   A 33k ohm would give you a 20Hz cut-off, which is just good for casual work.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

Thank you. I realized I missed writing "voltage divider" after the 2.2k, so two of those, 1 in series and 1 to ground. That is what got it recognized by the phone (most things I found stated it expects 1600k). After adding the 6.8n in series the sound improved greatly, but I know I need to do work on tuning it - for now it was to stop annoying my wife with the desk amp I set up, mainly, but also to get proper audio for front facing video (the volume randomly lowers on it, refurbished mostly)

@Rob thank you for all the maths and examples though, that will help immensely when I set back to it - my senior child is in process of killing it in water polo currently, so all my spare time is gladly used watching them steal and score!

@Tom, that is what I was thinking. I have read this site for years, searching "pt2399" or other things always brings me to the wealth of knowledge here, and I am so grateful to all of you, experts with knowledge and noobs with the same questions I have, so I figured I should put the things on my mind in case there is another seeking too.
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Matthew Sanford

Quote from: Rob Strand on January 16, 2023, 06:06:50 PM


- keep your resistor to ground on the phone mic input ; whatever value that is
- find the largest cap that doesn't cause problems.  I saw one guy using 200nF,sat 220nF

If you want to record without losing bass you want a lower cut-off frequency below 20Hz, let's say 7Hz.

If the phone + added resistor looks like 1k ohm then you will need a cap,

C = 1/(2*pi*7*1k) = 22uF

If the 22uF cap cause problems and we can only use 220nF then it seems like there's is no solution!  However there is a trick.  With the cap fixed at 220nF, you can add second resistor in series with the cap,

R =  1/(2*pi*7*220nF) - 1k   = 102k.



Rob I was wondering if you'd check my math here. Using 20hz as the cut off, considering I used 6.8n and 2.2k in series with the mic, and 2.2k to ground. I'm not sure but believe 8 "0s" after the decimal before 68 to show the cap in farads, so that gives me

R (series) = 1/2*pi*20hz*0.0000000068F)-2200. That gives 1/0.000000854513202 - 2200. So then 0.000002679359143 - 2200, which ends up -2199.x as the series resistor value. That is how it is now, seems right, and signal is coming from breadboard circuits not a guitar directly so possibly balancing attenuation against the gain of the phone.

But does that seem right? Without the addition of the series resistor (if I understand the math correctly) it would be an HPF around 10khz cutoff which is way off, of course I am ignoring any resistance in the line from either the signal source in my circuits and the phones mic input.
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

QuoteR (series) = 1/2*pi*20hz*0.0000000068F)-2200. That gives 1/0.000000854513202 - 2200. So then 0.000002679359143 - 2200, which ends up -2199.x as the series resistor value. That is how it is now, seems right, and signal is coming from breadboard circuits not a guitar directly so possibly balancing attenuation against the gain of the phone.
You are nearly there I think the problem is you aren't doing the 1/x part;  eg. 1/10 = 0.1.   Also you need to do the 1/x part before the subtraction.

2*pi*20*6.8e-9 = 2*pi*20hz*0.0000000068F = 854.5e-9 = 0.0000008545
Then
1/0.0000008545 = 1.170e6 = 1.170 MEG ohm.
Then,
R(series) = 1.170e6 - 2200 = 1.170 MEG ohm - 2200 = 1.1680e6 = 1.168 MEG ohm

When doing circuit calculations it's a lot easier to use exponential notation for the numbers since the zeros will just overwhelm you and make it very easy to make a mistake.   Some old style non scientific calculators will even run out of digits.

For example,
1567 = 1.567*1000 which is written 1.567 x 10^3  but for calculators and computers we use 1.567e3.
0.001567 = 1.567*0.001 which is written 1.567 x10^-3 but for calculators and computers we use 1.567e-3

Most scientific calculators have an EXP or EE button.
In my examples you would press,
1.567 EXP 3, and
1.567 EXP -3 (or 1.567 EXP 3 then the +/- button to get -3)

https://www.youtube.com/watch?v=-ZUpL_rEu5w

QuoteBut does that seem right? Without the addition of the series resistor (if I understand the math correctly) it would be an HPF around 10khz cutoff which is way off, of course I am ignoring any resistance in the line from either the signal source in my circuits and the phones mic input.
Yes that looks right, a very high cut-off.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

Ok, makes sense, and thank you for the help. I did it again and even though I saved 0.000000854513202 to memory (prior to dividing 1 by that) the calculator memory was returning something else entirely, around 375k if my memory serves me correctly. I kept my eye on it this time and it returned what you show.

The strange thing is the recording through it was all there through low frequency, so I'm not sure why.





This is the breadboard, the cap is 682, the yellow from circuit signal and red to it's ground, blue to the terrible headphone plug breakout mic line and purple to ground. I still need to test the phone specs, maybe that's influencing it or the dc? I'm happy it is working, but I want it to add up before I put it in a box for the lab.

For testing the phone, just check the mic and ground on the card board thing for DCV and current? Gotta make dinner and walk the pup, but I'll do the maths and report back. Thank you again!
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

Can't quite work out what is going where.

Are you:
1) recording the an external signal source *with* the phone?, or
2) recording the signal from the phone on a recording device?

I assumed you were doing the first ie. using the microphone input on the phone to record.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

#9
External signal source to the phone, currently from a StompFlo/PT2399/Ring mod w/o transformers thing. I measured:
DC 1.68-1.78 just through cord or to resistor/cap, then 1.813 steady with incoming from the circuit. I couldn't measure current no matter which way it was hooked up though. Did take a different headphone set apart and couldn't find current there, did check resistance on the...op amp? 6 pin smd rectangle, with mic housing as ground. Mostly round 680k except a 15k and a 586k.

I'll come back to it, maybe put it on perf and see if it still works...maybe capacitance from ground/signal copper tape traces? Yea, my brains grasping at straws, come back to it after sleep (and work)...perhaps loading is affecting it




"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

Ok, so recording to the phone the parts should be wired like:


external signal source ---> 6n8 ---> 1M resistor  ---> input wire to phone --> 2k2 to ground

or equivalently,

external signal source --->  1M resistor  ---> 6n8 --->  input wire to phone --> 2k2 to ground

Unless I'm looking at it wrong, your previous photo doesn't seem to follow that ordering(?)
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

External signal source -> 6.8nf -> 2.2k to ground & 2.2k -> phone mic in. Do you think the input impedance of the phone is affecting the lpf cutoff? Maybe the current is lower than the minimum mA setting of my DMM, needs something more to trigger it to allow more current and so make the resistance high?
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

#12
QuoteExternal signal source -> 6.8nf -> 2.2k to ground & 2.2k -> phone mic in. Do you think the input impedance of the phone is affecting the lpf cutoff? Maybe the current is lower than the minimum mA setting of my DMM, needs something more to trigger it to allow more current and so make the resistance high?
That connection is a bit weird.    It's possible to get it to work but with 6.8nF it will *cut* the low frequencies.  That connection presents a 2.2k load to the external source, which may or may not be OK for you signal source.

From the phones perspective, looking back towards the 2x2.2k the phone will see the two 2.2k ohm resistors in series connected to ground.   So from that it looks like 2x2k2 = 4k4 connecting from the phone mic input to ground is *detected* by the phone.   However it may or may not produce the correct DC voltage on the phone plug.   The best way to work that out is to measure the DC voltage at the phone terminal with the apple microphone connected.

To get things started I'd try something like,

external signal source ---> 100n ---> 100k resistor  ---> input wire to phone --> 4k7 to ground

If it still sounds bad try changing the 4.7k to something between 2.2k and 10k.   There will be a range which is detected by the phone and another range which produces clean audio.   You need to pick a resistor to ground which is in the middle of the overlap of those two ranges.

For example:
- phone detects  1.8k  to 6.8k
- audio sounds good 2.2k to 4.7k
- use 3k3

If the signal record signal is too ow decrease the 100k and increase the 100nF cap.


FWIW, the range of values I've seen for the Iphone is 1.6k to 4.7k, 3k3 is in the middle of that, but there's no
guarantee the audio will be OK with 3.3k.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

I'm going to try the ways you suggested after work (well, family permitting). It is working with the values in there, so I'll record a video with it, then other values you've suggested, and try to mash them together with subtitles for values
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Matthew Sanford

Ok, here's how it sounds. In the video I put titles, "->" are the nodes, "/" for on same node, and second R is to ground.

I did 6.8n, 2.2k/2.2k (original), then grabbed a 100u (not 100n, was rushing) so 100u, 2.2k/2.2k, then change to /4.7k (ground), then the other for 100k which made it not recognized so sound is my disfunctional forward mic (you can tell as Stomp/pt noise isn't there, and random reductions in volume). One was pointing up on accident...

https://drive.google.com/file/d/1fwfEWsx95BTENJTQo1Pe_jlc85CIyyyS/view?usp=drivesdk

I realized uf not nf, so I switched it and did 100n, 2.2k/4.7k. I switched 2.2k for 100k again but same, switched to front phone mic

https://drive.google.com/file/d/1PtQQSJddZNxmFLHorFLl-mGnauVZjneP/view?usp=drivesdk

Let me know if issues with drive and I'll put it to YouTube.

My impression, I felt it was ok before but the 100uf (and the nf) really opened it up, raised the volume, and brought the bass forward. I'm thinking 100uf, 2.2k/4.7k gave the best response, but I'll play with the series resistor to lower the volume a bit, but still may be recognized.

Not sure why my original wasn't just rolling it all off, but in researching did find this university diatribe on harvesting the dc from the phone, they talk about a current level requirement to trigger a relay but I was trying to read in short stolen moments, have to take my time with it

https://web.eecs.umich.edu/~prabal/pubs/papers/kuo10hijack.pdf
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

OK it's looking like the phone is still detecting the faked mic regardless of the cap.  So once you get the resistor from the mic pin to ground correct the cap value doesn't affect the detection.


So there's the deal:

The first resistor 100k vs 2k2 changes the amount of attenuation.   In order to compare the two case you would need to crank the signal level a lot more with the 100k.     The samples with the 100k ohm are low because the signal needs to be cranked.  What value to choose here depends directly on the signal level you are putting in.    The value itself shouldn't affect the sound.

The 100nF + 2k2 + 4k7 case is rolling off the low frequencies below 231Hz.   That's why it sounds thinner than the 100uF cap.

Once you chose the input resistor (100k vs 2k2) based on input levels you can choose a cap.

Somewhere around a 1 to 7 Hz cut-off should be OK.  20Hz is a little skimped depending on what the input signal is.

      C  >=  1 / (2*pi*7*R)

If you have 4k7 to ground and 2k2 in series with the input,

   R = 4.7k + 2.2k = 6.9k
   C >= 1/(2*pi*7*6.9k) = 3.3uF

So 10uF would do it.  And 100uF is a bit of overkill.

If you have 4.7k to ground and 100k in series with the input,

   R = 4.7k + 100k = 104.7k
   C >= 1/(2*pi*7*104.7k) = 218nF

So anything from 220nF to 1uF would do.

IF you have 4.7k to ground and 10k in series with the input,
   R = 4.7k + 10k = 14.7k
   C >= 1/(2*pi*7*k) = 1.5uF

So anything from 4.7uF to 10uF would do.

The 10k series resistor case is probably a good choice as it adds a little protection to the phone input.
9V peak to peak in will enter the phone as 2.9V peak to peak.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

The 100k in series was making the phone not recognize it as a mic; I had tested each in Multitrack DAW on my phone, and that set up did not present "headset mic" as an input option. The others all did though. So the 100k portions were just the sound coming from the strings on my electric to the phone's messed up mic.

I will try a 10k to see if it will still recognize it with a value that high...actually, I might as well test to see where the limit is, high and low. I should check if it will take 100k to ground instead, just to know if the phone cares much on that (though you did say the phone will see both resistors as being in series, so likely the same result)

I am thinking to just do 3.3uf, 2.2k/4.7k to ground, though I may test other ways too, but with a new cord cut from headphones so both left and right are still soldered correctly to the plug, as that is way too small for me to fix this one! Right is broken off, and I fear trying to reconnect it would have me melting the whole thing.

Thank you again Rob for all of your help! I'm excited to have another boxed up tool for the desk. If I get the tests done, I'll post it here for posterity
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

QuoteThe 100k in series was making the phone not recognize it as a mic; I had tested each in Multitrack DAW on my phone, and that set up did not present "headset mic" as an input option. The others all did though. So the 100k portions were just the sound coming from the strings on my electric to the phone's messed up mic.
If that's the case you are probably connecting it like your post #7 and post #7 and not like my post #12?

This connection can work but it places an unnecessarily low impedance load on the signal source, and requires a much larger input cap.

In the connection I posted, the 100k should have no effect.  There's just a single 4k7 from the phone's mic input to ground and the 100k through a cap makes no impact on the 4k7.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Matthew Sanford

I think I understand what you mean. I've had the resistor to ground on the cap/series R node, but you were saying it should be on the series R/phone input side, yes? I'll try moving the ground R there and see if 100k gets it recognized that way.
"The only knowledge is knowing you know nothing" - that Sew Crates guy

Controlled Chaos Fx

Rob Strand

In this configuration, the mic detection is only determined by R2, so you only need to get R2 correct.


R1 then sets the attenuation.

C1 then sets the lower cut off frequency.

Reading in between the lines I think an R2 value of 4.7k will be detected.   From various info on the web, perhaps not all relevant to your phone model, I seen as low as 2.2k.    There will be a value in that region the phone can detect and the audio might be cleaner.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.