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

Thread: Teensy LC strange power -- HELP!

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    2

    Teensy LC strange power -- HELP!

    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

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,792
    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.

  3. #3
    Junior Member
    Join Date
    Dec 2017
    Posts
    2
    GremlinWrangler you are a legend! Something so simple caused so much wasted time looking in all the wrong places! Thanks heaps.

  4. #4
    Senior Member
    Join Date
    Jan 2015
    Posts
    111
    Quote Originally Posted by GremlinWrangler View Post
    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?

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,879
    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 by Theremingenieur; 12-30-2017 at 08:29 PM.

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,831
    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 );
    // ...
    }

  7. #7
    Senior Member
    Join Date
    Jan 2015
    Posts
    111
    Aha, so simple. Thanks.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,831
    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 );
    // ...
    }

Tags for this Thread

Posting Permissions

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