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

Thread: Slow/ Fast blink LEDs no longer working, teensy will not upload properly.

  1. #1
    Junior Member
    Join Date
    Jul 2018
    Posts
    4

    Slow/ Fast blink LEDs no longer working, teensy will not upload properly.

    So here's the situation. I recently purchased a new teensy 3.2 and I am trying to get it to run its first program for one of my servo motors, titled "sweep" (from the arduino sketch examples). The problem is, once I uploaded the sketch, the servo motor kind of twitched, did a partial sweep, then stopped. I am under the interpretation that this code is supposed to sweep back and forth indefinitely, correct? Aside: How would I stop it from sweeping, or rather how would I end the program's infinite loop?

    Furthermore, the fast and slow blinks for the LEDs, programmed from the tutorial, are no longer working, and whenever I plug in the teensy the LEDs will not turn on at all regardless of whether I am in manual or automatic mode. I am unsure of what is going on and any help would be appreciated.

    I've also went ahead and included a screenshot of the code and my setup with the teensy loader:

    Click image for larger version. 

Name:	Sweep.PNG 
Views:	15 
Size:	100.7 KB 
ID:	14137

    Thanks.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,571
    Can you attach a photo of how your T3.2 is wired to your servo? Servos can consume more power than the USB 5v from T3.2 can provide, so you might need a separate 5v supply with common ground to T3.2.
    https://www.pjrc.com/teensy/td_libs_Servo.html

    If nothing is attached to T3.2, does the simple Blink example flash the LED?

    I don't know what tutorial you are referring to regarding "fast and slow blinks"

    EDIT: FWIW, the Sweep example works on my T3.2 with a hextronik HXT900 servo. The simple sweep consumes around 200 ma with idle about 6 ma. if you stall the motor, power consumption can go to 700 ma. Here is plot of servo current sampled at 100 ms, with servo steps every 15 ms. Y-axis is milliamps (X axis is sample count)
    Click image for larger version. 

Name:	servo.gif 
Views:	13 
Size:	72.4 KB 
ID:	14138
    Last edited by manitou; 07-02-2018 at 10:51 PM.

  3. #3
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,770
    Forum rule... post full code, so that others willing to help might quickly copy and paste it into their Arduino IDE in order to help debugging. Don’t expect volunteers towaste their time googling for specific libraries, demos or tutorials. Help them help by giving all details in the first post.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Quote Originally Posted by Aero View Post
    The problem is, once I uploaded the sketch, the servo motor kind of twitched, did a partial sweep, then stopped.
    Was the motor getting its power from USB?

    This sounds like the sort of problem that happens when a motor tries to draw more power than your USB port can supply. USB ports (and hubs) are supposed to have over-current protection which automatically shuts the power off in emergency situations. How it's implemented varies quite a lot, sometimes very poorly in cheap PCs. Some older Macintosh laptops had very good (perhaps too good/sensitive) overcurrent detection.

    As a first step, disconnect that motor and cold reboot (complete power off, not just the front panel button, physically unplug the cord if needed) your computer. If using USB hubs, cold reboot those too. Hopefully when you boot back up the USB port will work again, and Teensy is hopefully not damaged and can be reprogrammed with the LED blink.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Quote Originally Posted by Theremingenieur View Post
    Forum rule... post full code
    Normally I would wholeheartedly agree, but in this case it's pretty easy to see in the screenshot that he's running the example from File > Examples > Servo > Sweep.

  6. #6
    Junior Member
    Join Date
    Jul 2018
    Posts
    4
    Quote Originally Posted by manitou View Post
    Can you attach a photo of how your T3.2 is wired to your servo? Servos can consume more power than the USB 5v from T3.2 can provide, so you might need a separate 5v supply with common ground to T3.2.
    https://www.pjrc.com/teensy/td_libs_Servo.html

    If nothing is attached to T3.2, does the simple Blink example flash the LED?

    I don't know what tutorial you are referring to regarding "fast and slow blinks"

    EDIT: FWIW, the Sweep example works on my T3.2 with a hextronik HXT900 servo. The simple sweep consumes around 200 ma with idle about 6 ma. if you stall the motor, power consumption can go to 700 ma. Here is plot of servo current sampled at 100 ms, with servo steps every 15 ms. Y-axis is milliamps (X axis is sample count)
    Click image for larger version. 

Name:	servo.gif 
Views:	13 
Size:	72.4 KB 
ID:	14138
    Hey, I will go ahead and post the picture, however, I am aware of how much current would be necessary so I have attached two battery packs of three 1.5V AA batteries (~5V total) in parallel to supply roughly around 2A of current, which should be enough for the four micro-servo motors I will be using in total.

    The fast and slow blinks is from here, in PJRC's teensy website: https://www.pjrc.com/teensy/loader_win10.html. Any clarification you could give me would be great; I have no idea if these LED blinks are still supposed to be running or not. I am confused as to how teensy loader works and how programs work.

    Here is the physical circuit. As you can see, I decided to solder on pins to pinouts 20-23 with the intention of using these for the four signal outputs for my four servo motors. I don't know if this was the correct decision.

    Click image for larger version. 

Name:	Circuit.jpg 
Views:	22 
Size:	122.4 KB 
ID:	14139

  7. #7
    Junior Member
    Join Date
    Jul 2018
    Posts
    4
    Quote Originally Posted by PaulStoffregen View Post
    Was the motor getting its power from USB?

    This sounds like the sort of problem that happens when a motor tries to draw more power than your USB port can supply. USB ports (and hubs) are supposed to have over-current protection which automatically shuts the power off in emergency situations. How it's implemented varies quite a lot, sometimes very poorly in cheap PCs. Some older Macintosh laptops had very good (perhaps too good/sensitive) overcurrent detection.

    As a first step, disconnect that motor and cold reboot (complete power off, not just the front panel button, physically unplug the cord if needed) your computer. If using USB hubs, cold reboot those too. Hopefully when you boot back up the USB port will work again, and Teensy is hopefully not damaged and can be reprogrammed with the LED blink.
    Hi, i'm aware of the issue you are talking about with drawing too much current from the USB, however that is not the case for me; rather, I used two battery packs (see the reply above).

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    In the photo, I don't see any connection to Teensy's GND pin.

    You need GND, the battery negative, and motor GND connected together for things to work.

  9. #9
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,571
    Quote Originally Posted by manitou View Post
    Servos can consume more power than the USB 5v from T3.2 can provide, so you might need a separate 5v supply with common ground to T3.2.
    "... a separate 5v supply with common ground to T3.2."


    "I decided to solder on pins to pinouts 20-23" -- i can't quite tell from the photo, but the T3.2 gnd pin needs to be soldered too. For breadboard work, you can buy a T3.2 with soldered header pins.
    https://www.pjrc.com/store/teensy32_pins.html
    Last edited by manitou; 07-03-2018 at 06:44 AM.

  10. #10
    Junior Member
    Join Date
    Jul 2018
    Posts
    4
    Hey guys, thanks for all the help. Turns out that the common ground issue was correct; this is what was necessary to get the program to work. Also I now understand that the fast/ slow blinks were just separate programs that weren't being run while the servo program was being run; I had gotten confused as to what their purpose was.

    With all of that being said, for my knowledge going forward, could someone explain to me why there needs to be a common ground with the T3.2? I was under the impression that as long as the power source (the two battery packs) and the servos were grounded with eachother, there should be no issue as the teensy only sends a signal to the servo. Is this signal based on voltage? That would be the only way I could explain why the common ground needs to occur.

  11. #11
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,770
    Yes, the control signal for the servo(s) is voltage based. Just hi - lo, but a common reference potential is needed, though.

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Even if the signal were a current (which is rare, except certain industrial sensors which use a 4-20 mA current loop), you'd still need GND or some other wire for the current to flow in a loop.

Posting Permissions

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