Web Oscilloscope via Headphone Jack

Posted on
  • Hello,

    I'm trying to do Experiment 17 from Making Things Smart, which is sending data from a Pico to your computer via the headphone jack and displaying it using the Web Audio app Gordon built here.

    I've tried a variety of different methods to get things connected, but regardless of the setup I cannot get my computer to recognize the input as a valid line-in.

    I am on a 2017 15" Macbook pro running Catalina.

    I have tried connecting with this terminal block audio plug from Adafruit, as well as cutting a pair of iPhone headphones (after the split) and identifying the mic / mic-ground wire. I have tried both of these connectors with and without this splitter from Amazon.

    None of these combinations have worked. When in System Preferences > Sound > Input I never have an option to choose an external input. Also, weirdly sometimes when connecting the circuit using the terminal block connector, closing the circuit would trigger Siri to open on my computer.

    I've uploaded a picture of my circuit, where the white lead goes to the mic line on the iphone headphones (or the sleeve terminal on the adafruit connector) and the black ground goes to the mic ground on the headphones (and the second ring on the adafruit connector). Both resistors are 10k ohms, white leads to B6 and black to GND.

    The code running on the pico is as follows:

    var t=0;
    setInterval(function() { Serial1.write(t); },5)

    Any ideas on how I could get this going?


    1 Attachment

    • IMG_1040.jpg
  • That's really odd. Your wiring seems to match the book just fine to me.

    You could try setting it up as a potential divider - so with:

    • One resistor between the white lead and GND
    • one resistor between the IO pin and the white lead

    The fact that siri gets triggered makes me think it is getting some signal though...

    If you have one, what happens if you plug an actual pair of headphones with microphone in into the Mac? Is the menu different? It may be the input is working but just not showing up?

  • Before cutting the headphones wire I was able to plug them in and select them as the mic source.

    However, after snipping the wire when plugged in they no longer appeared as a mic choice. The computer did acknowledge that headphones were plugged in (the output pane changed to show headphones rather than built-in speaker), but it doesn’t see it as a mic.

    I’m wondering if maybe the MacBook is expecting something that we’re not giving it? Perhaps I need to cut the cable before the Y and connect all of the grounds?

    This is maybe a little silly, but I also have a female terminal block trrs audio adapter and an actual oscilloscope. I could try reading the signal on the oscilloscope which should tell us if the wiring / circuit is ok.

    If it is, then I would assume that there is something magical that the MacBook is looking for to recognize the line in. It’s clearly looking for more than just a trrs cable plugged in.

  • It's great that you were able to check at least. So the headphone cable you have has 4 wires? GND, left, right, and mic?

    Hmm, do you have different resistor values? Maybe you could try removing the Pico for now and just adding a low value (around 75 Ohm?) resistor between GND and the mic wire? It might be the Mac is looking for a more hefty resistance across the line?

  • It actually has more than 4 wires. The GND is split to each of the left/right/mic, so there are six wires total, as shown here:

    I have a plethora of resistor values at my disposal, so will try varying the value between mic/GND and see if that has any effect. Thanks for the idea!

    I'll post back any results I find.

  • You will also probably have better luck with a PC instead of a mac. Macs are really picky about stuff, and they hate people doing anything other the basics with it.

    Also - how confident of your soldering to the mic wires? That kind of wire is insanely hard to solder to - the enamel on the wire is nigh impossible to remove.... we have tried chemicals, a guy I knew (for whom a sololution meant several thousand dollaert of otders) did a chloroform synth (where you mix pool shock solution and ice, in an ice bath, and slowly add acetone to it; if you keep it from getting so hot that it boils off the chloroform (it's highly exothermic solution), when you're done, there's chloroform at the bottom of reaction vessel). it didn't work - I have no idea what the now-banned enamel stripper contained (if anyone knows, please tell me), but whatever it was, it was good stuff!

    The only way that I know that will definitely work to strip it is to melt a pot of eutectic NaOH/KOH mixture and dip the ends in that; you of course need to make sure the container can hold it; it will attack almost anything, including glass (i worked with this doing my masters thesis - it would dissolve the glaze on the crucibles I tried to melt it in, and it trashed a YSZ crucible too). And of course, then you have a pot of molten lye on your desk (and, by the way, when not in use, you need to protect it from moisture in the air, as the hydroxides are extremely hygroscopic..... I have thought a lot about this, and it bites the big one.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Web Oscilloscope via Headphone Jack

Posted by Avatar for RobertMcReed @RobertMcReed