Micro USB b connection detector
MAYBE, just MAYBE you could use shield for that. In normal circumstances, shield is ground, but the most important thing is that the ground pin of microusb is ground, shield doesn't exactly have to be ground.

I'm not sure if there is a correct way to do that, it requires testing, but, here is something I would try and see what happens: 


So when there is nothing connected, detector line will have like 4.5V (logic HIGH), and when you plug something in, the shield is connected to ground via cable or target device, so detector line is 0V (logic LOW). Will that work with all cables? Do all cables have shield and ground internally connected? Or are they only connected internally in target devices like phone? No idea. You'll have to try that. If you get some noise on detector, divide resistors by 10 (both of them). I just picked those values to minimize current loss, but we are in the microamp area here, you probably won't care. Anyway, I would give this design a shot. Just measure with the multimeter output on DETECTOR line and see if it works.