Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Power supply for Teensy 4 + Audio Adaptor?

  1. #1
    Member Dionysus's Avatar
    Join Date
    Apr 2020
    Location
    Chicago
    Posts
    32

    Power supply for Teensy 4 + Audio Adaptor?

    I've got a teensy 4 hooked up to the Rev D. Audio Adapter. Right now, when I plug it into a desktop computer via USB, it sounds great! (I mean, I'm still fiddling with the bitrate for the audio files, but...)

    However, when I plug it into the wall with a USB connector the overwhelming hum and the raw power drowns everything else out. When I plug it into a MS Surface (the only laptop I have handy) the audio is way too faint to hear. Unless it's charging, in which case the hum takes over.

    I also tried plugging it into a phone charger, that claimed to be giving it 5v / 2.4 A, and it was too faint to hear. My next though was to try jury-rigging some sort of 9v battery thing, but then I realized that a) that was probably a terrible idea, and b) I should just ask you.

    What's the recommended power supply for playing audio from the teensy 4 / audio adapter? Ideally something involving batteries, so it's nice and portable?

    Thanks!!
    -=Benjamin

  2. #2
    It's strange that you get such different behavior from the laptop and the desktop. Most desktop USBs provide around 500ma, and I imagine the laptop should be around the same. Do you have any powerbanks? Are you able to measure the power line with a multimeter?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,513
    Usually these sorts of strange noise problems are a "ground loop". Usually there is another connection, like to an amplifier, where some of the power supply current unintentionally flows through that other path to return to ground.

  4. #4
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    124
    hi Dionysus - can you explain a bit more about your setup and what you're doing - are you powering other stuff from the teensy? - a picture would be ideal.

    A teensy and audio board on it's own would normally work work fine with any of the options you mention, for portability any usb power bank/battery or any battery giving about 5v (3.6v - 5.5v) should be fine (have a look at https://www.pjrc.com/teensy/external_power.html)

    cheers Paul

  5. #5
    Senior Member
    Join Date
    Jul 2020
    Posts
    340
    How are you connecting the audio from the shield, and to what? Are you using shielded cables?

    Normally its bad news to have a ground loop in an audio system using single-ended signals (such as line-out), as that injects significant hum
    directly into your signal. The lower your levels are the worse it will be.

    What amplitude have you set the outputs too, both the line out and headphone volume can be programmed, if you've left them at defaults the
    line-out will be quiet IIRC. checkout the lineOutLevel() method of AudioControlSGTL5000 class.

  6. #6
    Member Dionysus's Avatar
    Join Date
    Apr 2020
    Location
    Chicago
    Posts
    32
    Well, shoot. It sounds like the real question might be "how is it working at all," then.

    Quick, noob question: Could a ground loop be caused by a short? Like, my wiring is pretty messy, but everything is working, and I thought that ground loops were only a problem with multiple audio devices? ...

    My device is an embarassing nest of ugly wires going every which way, but they almost all go out to LEDs (with a few going to the rotary encoders, and fifteen or so going to the display. The connection from the Teensy and the audio board are just stacked, with no wires.

    Power comes in from the USB, and it powers the display, the audio shield, two rotary encoders, and a bunch of LEDs. There's a 3.5mm headphone cable going from the audio shield out to the speakers. It sounds like I've got a lot more testing to do, then. ):

    Thank you!
    Click image for larger version. 

Name:	Capture.jpg 
Views:	9 
Size:	58.2 KB 
ID:	21238
    Click image for larger version. 

Name:	Capture.jpg 
Views:	6 
Size:	90.5 KB 
ID:	21236
    Click image for larger version. 

Name:	Capture.jpg 
Views:	10 
Size:	75.1 KB 
ID:	21237
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMG_20200801_171724.jpg 
Views:	5 
Size:	128.5 KB 
ID:	21235  

  7. #7
    Senior Member
    Join Date
    Jul 2020
    Posts
    340
    Quote Originally Posted by Dionysus View Post
    Quick, noob question: Could a ground loop be caused by a short? Like, my wiring is pretty messy, but everything is working, and I thought that ground loops were only a problem with multiple audio devices? ...
    Only shorts between different grounds

    My device is an embarassing nest of ugly wires going every which way, but they almost all go out to LEDs (with a few going to the rotary encoders, and fifteen or so going to the display. The connection from the Teensy and the audio board are just stacked, with no wires.

    Power comes in from the USB, and it powers the display, the audio shield, two rotary encoders, and a bunch of LEDs. There's a 3.5mm headphone cable going from the audio shield out to the speakers. It sounds like I've got a lot more testing to do, then. ):
    The headphone output is definitely not to be connected to any other ground, this is likely your problem.
    Its intended only for headphones as its not relative to the Audioshield ground. I suspect your "speakers"
    short the incoming audio ground to mains ground, overloading the SGTL5000 and creating a loop.
    (I had to consult the AudioShield schematic and the SGTL5000 datasheet to find this out)

    You need to use the line outs for a line output... They have much more level than headphones too, upto about
    1Vrms. And they use circuit ground.

    [ When I asked what the audio is connected to, "to the speakers" wasn't the level of detail that would be useful,
    I'd expect the model name/number/product page/datasheet... Imagine phoning a garage about your car and
    when they ask what it is you say "a red one"! ]

  8. #8
    Member Dionysus's Avatar
    Join Date
    Apr 2020
    Location
    Chicago
    Posts
    32
    Hah, thank you all, that was 100% the problem, of course.

    I'm sorry for asking such a basic question—that's the problem with not knowing things: you don't know where to look or how to ask, and if it's a *really* basic thing, there's not a lot of chatter about it on the forum. But that's why I love this site—Paul Stoffregen will come take the time to gently tell me "hey, don't plug powered speakers into the headphone jack", along with a host of others.

    Anyway, if I understand correctly, the problem was the my audio device was grounded (plugged into the wall, say) and I was plugging it into speakers (or a mixer) that was also grounded, spearately. And because the headphone jacks aren't wired to take that into account it creates a ground loop, which picks up and amplifies magnetic fields via physics magic (wikipedia, "in effect, the ground loop acts as a single-turn secondary winding of a transformer").

    I didn't have that problem with my headphones, because they aren't plugged in anywhere—they were grounded along with the audio device. And I don't have the problem any more because the Line Out because it's specifically designed for that, and I added a Line Out jack.

    Thanks again!

  9. #9
    Senior Member
    Join Date
    Jul 2020
    Posts
    340
    Quote Originally Posted by Dionysus View Post
    Hah, thank you all, that was 100% the problem, of course.
    It is a bit unusual to see a headphone amp with such a virtual ground arrangement, its probably to avoid the
    need for electrolytic capacitors on the outputs - this kind of chip is designed to fit into tiny devices like
    phones where you can't fit anything larger than an aspirin!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •