Just a pretty basic electronics question here. I’m making a Teensy based musical synthesizer project which has a USB Host board attached to it so I can plug in USB keyboards into the synthesizer. These keyboards will be powered by the USB Host board (SAM21 Seeduino XIAO with the Arduino USB SAMD Host Library), which is powered from the Teensy, which is powered either via USB 5V or a 5V power adapter.
Apparently, plugging in a USB Device can cause a quick current spike which could restart the Teensy, so it’s advised to add in a 120uF capacitor near the power line. My question is pretty basic: does it matter where along the power line I place the 120uF capacitor? Should I put it in front of the USB Host Board 5V input, or the Teensy VIN? Or both, or does it matter? Just want to get everything right before I get a PCB printed. Thank you!
As a general rule, decoupling capacitors should be as close to the load they are designed to decouple as possible, so I would place it as near to the USB host port as you can. If possible I would also avoid daisy chaining the power through your modules as you describe. If you’re building a carrier PCB, do power distribution there. Ground matters just as much.
Compliant USB devices should only have a maximum of 10uF on their inputs IIRC, so inrush shouldn’t really be a problem, but I am sure there are plenty of noncompliant devices out there, I have built some myself .
I’m not really an Arduino person, but doesn’t the Teensy 4.0/4.1 have USB host on board, obviating the need for the 2nd Arduino?
Not totally sure I understand the problem statement, but let me take a stab at it:
The XIAO / Teensy combination is usually plugged into power, correct? And then something external (not mentioned in question) gets plugged in, and parts of the host combo brown out.
Put the capacitor right in front of where ever the external device gets connected. Imagine it like a bucket - You want that bucket to normally be full, but when something thirsty plugs into it quickly, the bucket gets depleted first, instead of the hose before the bucket.
Thank you very much @ktims and @Jarrett ! That answers my question perfectly.
Oh whoops I’m not actually daisy chaining the power, I just explained my circuit poorly, the 5V USB is separated before it goes into the Teensy’s 3.3V regulator
but doesn’t the Teensy 4.0/4.1 have USB host on board, obviating the need for the 2nd Arduino?
This is correct. However I’m using the Teensy 4.0, which unlike the 4.1, the USB Host is only available awkwardly on the underside via surface mount pads. I’m planning to turn this project into a kit and I don’t want any finnicking with wires or SMT soldering. The cost of a XIAO plus the Teensy 4.0 is still cheapter than the just the Teensy 4.1. But who knows, I might switch to the 4.1 just to simplify.
This is the key - and in my experience can be very important for compatability. A smaller thing to note is that there’s also a minimum of 1uF required. Simply adding 120uF onto your Vusb is way outside the USB2 spec; it is not the right solution. What you need to do is to limit the inrush current from Vusb, but if your downstream devices aren’t doing the same, you’ll need to do it for them too (so they don’t pull your power rail down).
I’m attaching a PDF, as the website I got it from is unfortunately long-gone, that goes into great detail about this, and is what I do for pretty much all my devices. The PDF isn’t specific to USB, but the worked example at the end is for a USB device.
Just to clarify I am not looking to build a USB device, I’m looking to add USB Host capability to the Teensy which already functions as a USB Device as is.
Regarding the USB spec for hosts the minimum is apparently 120uF, and in most cases many hosts have more according to the documentation on the Teensy website. USB Host Shield
I’ll check out the PDF though thank you, looks like stuff I should read up on.