Teensy LC strange power -- HELP!

Status
Not open for further replies.

M0nki

New member
Building a motion reactive LED project and all works well on breadboard, replicated to protoboard and experiencing strange power behaviour. Looking for some troubleshooting advice. Should i expect Vin to be able to power entire external circuit (include 30 LED strip) when connected via USB, i.e. acts as a 5v Vout also? This is what happens when connected to a PC and circuit and everything including LED strip works as expected (obviously is supplying enough current). When powering via a USB powerbank (upto 3.0A out) either through the teensy USB or directly on the power rails i get 5V across the entire circuit (good) but led strip doesnt function, same behaviour when connecting Desktop power supply to rails (only drawing 20mA). Doesnt appear to be any shorts anywhere and I'm really not sure whats going on. Any guidance would be appreciated. Thanks
 
You didn't post any of the running code, but do you have any while (!Serial()) lines or similar in setup?

Normal cause of this sort of thing is USB waiting to init before serial finishes.
 
GremlinWrangler you are a legend! Something so simple caused so much wasted time looking in all the wrong places! Thanks heaps.
 
You didn't post any of the running code, but do you have any while (!Serial()) lines or similar in setup?

Normal cause of this sort of thing is USB waiting to init before serial finishes.

Yes, very astute remote debugging on GW's part!!

I had the same problem. I would use USB-serial with my T3.x boards, which required the ... while (!Serial()) ... line in the setup() in order to get the Terminal to come up. However, when I ran the boards "standalone", of course, the program hung just like M0nki said. Therefore anymore, I always use FTDI on Serial1 and completely avoid using USB-serial.

Is there an easy way to deal with the while (!Serial()) bootup problem short of commenting that line out when doing the final compile for standalone boards?
 
A commonly used approach is while(!Serial && millis() < 2000); which would wait up to two seconds after boot if the Serial comes up and if not, it would go on without.
 
Last edited:
Last week Windows had the IDE SerMon reconnecting in 2 to 2.5 seconds after upload - I updated to the latest IDE with TD beta and didn't try again. But putting it toward 4 secs may start better on Windows to not miss first messages.

Code:
void setup() {
  while (!Serial && millis() < 4000 );
// ...
}
 
Should have added this to show it is alive by powering the LED at start:

Code:
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
  while (!Serial && millis() < 4000 );
// ...
}
 
Status
Not open for further replies.
Back
Top