Society of Robots - Robot Forum
Software => Software => Topic started by: ecaits on August 19, 2015, 01:42:47 AM
-
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
-
I haven't used this yet, although I have one similar on order.
I can think of a couple possible problems.
1) The PWM outputs are sinks, you will need a pull up resistor (~4.7K to TLC5940NT +), if your servo does not have one.
2)One wire devices can have reflections on the line and fail to communicate, particularly if you have other i2c devices on the line.
Don't forget to tie all grounds together.