🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Tab5: disable speaker when headphones are plugged in

    PRODUCTS
    2
    3
    93
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      milaidin
      last edited by

      Dear all,

      I noticed that the hardware demo which comes preloaded on the Tab5 doesn't disable the speaker as soon as headphones are plugged in. Sound plays on both, speaker and headphones.

      However, the pop up telling me that I connected or disconnected headphones works flawlessly, so the headphones are recognized by the software.

      For my upcoming project I need the speaker to be silent while sound plays on the headphones.
      Is there a way do disable the speaker but keep the headphones activated? I couldn't find something in the libraries and examples on GitHub...

      Thanks and kind regards!

      easytargetE 1 Reply Last reply Reply Quote 0
      • easytargetE
        easytarget @milaidin
        last edited by

        @milaidin :
        Poking around in the schematic shows that the Audio jack has a switch pin connected to a line labelled HP_DET on the board. As far as I can tell this line is pulled low via R47&R48 unless there is a plug inserted. when it is pulled high via R49 instead.
        This HP_DET line does not go directly to the P4 chip, instead it goes to U6, which is a I2C I/O expander chip on the system I2C bus.

        If the source for the demo is available look for how this line is read, then turn the amplifier on/off as needed. The code for that should also be in the demo.

        1 Reply Last reply Reply Quote 0
        • M
          milaidin
          last edited by

          Thank you!
          I was not precise enough in my earlier post:
          I had already found the code to detect the connected headphones, the part that I was missing was how to turn off the speaker as soon as the headphones are detected (and if it was possible to turn it off independently from the speaker).

          Thanks to your comment and some poking around on GitHub I realized that I overlooked the GPIO extension. There is a SPK_EN pin there (Pin 1 on the first extension) that connects to the onboard amplifier and, according to its datasheet, can be used to turn the amplifier off.

          Since the headphones are not connected to the amplifier, this should mute the speaker without influencing the headphones - I haven't tried it yet, but that's my guess based on the schematics.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post