1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

TLC5940NT Mal-operation???

Discussion in 'Arduino' started by ecaits, Aug 19, 2015.

  1. ecaits

    ecaits New Member

    Joined:
    Aug 25, 2014
    Messages:
    10
    Likes:
    0
    As I have to control servos by TLC5940NT in Arduino Uno.
    During testing, the servos are not rotated as per command and sometimes it stopped and not working.
    The wiring diagram is attached in file.
    Simple program I have used for servos testing, given below,

    #include "Tlc5940.h"
    #include "tlc_servos.h"

    #define SERVO_CHANNEL 0
    #define DELAY_TIME 20

    void setup()
    {
    tlc_initServos(); // Note: this will drop the PWM freqency down to 50Hz.
    }

    void loop()
    {
    for (int angle = 0; angle < 180; angle++) {
    tlc_setServo(SERVO_CHANNEL, angle);
    Tlc.update();
    delay(DELAY_TIME);
    }
    for (int angle = 180; angle >= 0; angle--) {
    tlc_setServo(SERVO_CHANNEL, angle);
    Tlc.update();
    delay(DELAY_TIME);
    }
    }

    Thank you,

    Regards,
    Nirav
     

    Attached Files:

  2. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,792
    Likes:
    134
    Location:
    morristown,tn
    Why you open a new thread

    Have you tried it like it tells you...?
    Code (text):
    /*
        This sketch sweeps a servo on channel 0.

        To connect a servo:
         1. Put a 2k-5k pull-up resistor (R0 below; I've tried with 3.3k) between the
              servo control output pin and +5v.
         2. Connect that same pin to the servo's control line like so

            servo data pin
                  |     _____
         OUTn ----+----[_____]---+5v
                          R0

        Steve Pomeroy <steve ~AT~ staticfree.info>, 2009-01-20 */

    #include "Tlc5940.h"
    #include "tlc_servos.h"

    #define SERVO_CHANNEL   0
    #define DELAY_TIME      20

    void setup()
    {
      tlc_initServos();  // Note: this will drop the PWM freqency down to 50Hz.
    }

    void loop()
    {
      for (int angle = 0; angle < 180; angle++) {
        tlc_setServo(SERVO_CHANNEL, angle);
        Tlc.update();
        delay(DELAY_TIME);
      }
      for (int angle = 180; angle >= 0; angle--) {
        tlc_setServo(SERVO_CHANNEL, angle);
        Tlc.update();
        delay(DELAY_TIME);
      }
    }
     
     
  3. ecaits

    ecaits New Member

    Joined:
    Aug 25, 2014
    Messages:
    10
    Likes:
    0
    Dear Burt,

    I have tried exactly same way as told in your reply.
    But still servo is not rotating in commanded fashion.

    Regards,
    Nirav
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,792
    Likes:
    134
    Location:
    morristown,tn

    How you have the servo hooked up
     
  6. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,145
    Likes:
    907
    Location:
    Rochdale UK
    What servo have you got??
     
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,792
    Likes:
    134
    Location:
    morristown,tn
    Im sure if not hooked up right it will not work that chips made for driving leds there using pullups to keep it from thinking you have a broken led.
    [​IMG]
     
    Last edited: Aug 21, 2015

Share This Page