Power and Noise Questions

Hi, I'm nearing completion of building a foot pedal sample player and MIDI controller. It all functions when connected to my laptop by USB, albeit with some noise when playing samples, but when I try to connect it to other USB power, it doesn't function. It does part of the start up, but seems to get stuck before it gets to the point where it can play samples or send MIDI or respond in any way.

So, my questions are:

1) Is the noise an issue with USB power? Maybe a ground loop kind of thing?

2) Is there a way to run it off a USB power brick? Or should I build in a different power option? I was considering setting it up to run on a 9V pedal power supply (stepped down to 5V) so it can integrate with my other guitar pedals.

Here's the internals, and a clip of the noise issues.

2022-03-15 13.13.37.jpg

https://www.youtube.com/watch?v=FkKzRurRfzo
 
Hi, I'm nearing completion of building a foot pedal sample player and MIDI controller. It all functions when connected to my laptop by USB, albeit with some noise when playing samples, but when I try to connect it to other USB power, it doesn't function. It does part of the start up, but seems to get stuck before it gets to the point where it can play samples or send MIDI or respond in any way.

So, my questions are:

1) Is the noise an issue with USB power? Maybe a ground loop kind of thing?
Others can give you more detailed information about this.

2) Is there a way to run it off a USB power brick? Or should I build in a different power option? I was considering setting it up to run on a 9V pedal power supply (stepped down to 5V) so it can integrate with my other guitar pedals.

In almost all of the time, this is caused by code that waits for the Serial USB line to be initialized. Given you are being run off of battery, it never will be initialized. Usually the code looks something like:

Code:
    while (!Serial)
        ;

Instead, you should put a timeout in the loop, such as:

Code:
    // Wait for up to 3 seconds for the USB serial output to finish initializing
    while (!Serial && micros () <= 3000UL)
        ;
 
That's incredibly helpful. Thank you! I'll give that a shot and look into it some more. If nothing else, if I can get it running off other USB power it'll let me troubleshoot the noise more effectively.

Edit: I checked my code and I don't have anything like that, but it does give me a direction to research in. Would something to do with the Audio Shield or SD Card functions be causing it to wait in a similar way?
 
Ok, after some debugging, it seems to hang at the if (!(SD.begin())) step when not connected to my laptop.

Code:
  if (!(SD.begin(SDCARD_CS_PIN))) {
    while (1) {
//      Serial.println("Unable to access the SD card");
      displayE();
      delay(500);
    }
  }

It reaches this point and just sticks on displaying "E" on my 7-segment. If it's connected to my laptop, it gets past this point no problem and everything works. (SDCARD_CS_PIN is set to 10)

Is there any reason SD.begin() would fail when not connected to a PC but work fine when connected to a PC?
 
Last edited:
Is there enough power being fed to the teensy when standalone?

That's my current (no pun intended) theory, as I just had the same problem when I was powering it from my laptop with my laptop running off the battery. It seems like it shouldn't be an issue with the power supply, though, since I specifically bought this power supply, which is what I've been trying to use and should provide more than enough power safely.
 
Back
Top