Servo motor generates heat when not in use

Good day! My project consists of a servo motor and a DS1307 RTC module. It is supposed to turn on at a specific time. My problem is that the servo motor generates heat when in stand by mode. Is it possible to “turn off” the servo motor and make it “turn on” at the specific time set on the RTC module to prevent overheating?

Here’s my program.

#include <DS1307.h>
#include <Servo.h>

Servo myservo;

int setHour = 20;
int setMin = 9;
int pos=0;
int uled = 9;

DS1307 rtc(SDA, SCL);
Time t;
void start();

void setup()
{
pinMode(uled, OUTPUT);
Serial.begin(9600);
rtc.begin();
myservo.attach(9);
}

void loop()
{
t = rtc.getTime();

Serial.print(rtc.getDOWStr());
Serial.print(" ");

Serial.print(rtc.getDateStr());
Serial.print(" – ");

Serial.println(rtc.getTimeStr());

if (t.hour == setHour && t.min == setMin)
{
start();
}

delay (1000);
}

void start()
{
for (pos = 0; pos <= 60; pos += 1) {

myservo.write(pos);
delay(10);
}
for (pos = 60; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(10);
}
}

The servo motor is Tower Pro MG995 Digi Hi-Speed, the RTC module is DS1307, and the MCU is a arduino clone.

Even when you are not moving it the servo is trying to maintain the last position you sent it to. So if there is any load on it trying to move it out of position then it is still having to do work to stay stationary.

If you don't mind if the servo moves itself between the times when you are actively writing to it then you can use the myservo.detach() command which stops the Arduino from sending the position data to it. Then you'll need to attach() it again before you try to write to it next.

Steve

If the servo is heating when holding position it seems to me that you need a bigger servo for the job.

...R

slipstick:
Even when you are not moving it the servo is trying to maintain the last position you sent it to. So if there is any load on it trying to move it out of position then it is still having to do work to stay stationary.

If you don’t mind if the servo moves itself between the times when you are actively writing to it then you can use the myservo.detach() command which stops the Arduino from sending the position data to it. Then you’ll need to attach() it again before you try to write to it next.

Steve

In what part of my program should I detach it? Sorry noob question

I would like to detach it a minute after the set time. I tried this program but after one sweep, it detaches. I think I’m doing it wrong.

#include <DS1307.h>
#include <Servo.h>

Servo myservo;

int setHour = 21;
int setMin = 24;
int pos=0;
int uled = 9;

DS1307 rtc(SDA, SCL);
Time t;
void start();

void setup()
{
pinMode(uled, OUTPUT);
Serial.begin(9600);
rtc.begin();
myservo.attach(9);
}

void loop()
{
t = rtc.getTime();

Serial.print(rtc.getDOWStr());
Serial.print(" ");

Serial.print(rtc.getDateStr());
Serial.print(" – ");

Serial.println(rtc.getTimeStr());

if (t.hour == setHour && t.min == setMin)
{
start();
}
delay (1000);
if (t.hour == setHour && t.min == setMin)
{
myservo.detach();
delay(60000);
}
}

void start()
{
for (pos = 0; pos <= 60; pos += 1) {

myservo.write(pos);
delay(10);
}
for (pos = 60; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(10);
}

}

Update. I tried this one and the servo detached properly. I measured the voltage on pin 9 with respect to ground and it is 0V. However, the servo motor is still heating.

#include <DS1307.h>
#include <Servo.h>

Servo myservo;

int setHour = 22;
int setMin = 26;
int pos=0;
int uled = 9;

DS1307 rtc(SDA, SCL);
Time t;
void start();

void setup()
{
pinMode(uled, OUTPUT);
Serial.begin(9600);
rtc.begin();
myservo.attach(9);
}

void loop()
{
t = rtc.getTime();

Serial.print(rtc.getDOWStr());
Serial.print(" ");

Serial.print(rtc.getDateStr());
Serial.print(" – ");

Serial.println(rtc.getTimeStr());

if (t.hour == setHour && t.min == setMin)
{
start();
}
else if (t.hour != setHour && t.min != setMin)
{
delay(250);
myservo.detach();
}
}

void start()
{
{
for (pos = 0; pos <= 60; pos += 1) {

myservo.write(pos);
delay(10);
}
for (pos = 60; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(10);
}
}
}

Please use code tags. It will also help you if you use the auto-format function in Arduino. It makes it easier to read the code.

You could turn off the power supply to the servo. That will require a transistor (preferably a MOSFET) or a motor-driver chip that can handle the peak current of the servo.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile: