Page 1 of 1

SOLVED :4 Servos

Posted: 03 May 2019, 21:52
by cherowley
Hi!

My project needs 4 servos (4 parts to the bay so 4 blinds).

Anyway to achieve this on a single esp8266?

I've tried altering code to have 4 servo objects but I presume they must use too many timers as it all get confused. (with teh 4 objects i tried using one at a time and all at once - sames result)

myservo1.attach(4, 700, 2100);
myservo1.write(event->Par3);
delayMillis(3000);
myservo1.detach();

myservo2.attach(14, 700, 2100);
myservo2.write(event->Par3);
delayMillis(3000);
myservo2.detach();

myservo3.attach(12, 700, 2100);
myservo3.write(event->Par3);
delayMillis(3000);
myservo3.detach();

myservo4.attach(13, 700, 2100);
myservo4.write(event->Par3);
delayMillis(3000);
myservo4.detach();

but that just gets erratic.

Also tried using just one servo object but that just moves the first one.

myservo1.attach(4, 700, 2100);
myservo1.write(event->Par3);
delayMillis(3000);
myservo1.detach();
myservo1.attach(14, 700, 2100);
myservo1.write(event->Par3);
delayMillis(3000);
myservo1.detach();
myservo1.attach(12, 700, 2100);
myservo1.write(event->Par3);
delayMillis(3000);
myservo1.detach();
myservo1.attach(12, 700, 2100);
myservo1.write(event->Par3);
delayMillis(3000);
myservo1.detach();


Anyone achieved this?

Re: 4 Servos

Posted: 03 May 2019, 22:19
by ThomasB
Wiki says maximum is two servos using the servo command.

If you need to control four then I suggest using the UDP feature. Have the rules in a master ESPEasy control a slave ESPEasy. That will get you four servos.

- Thomas

Re: 4 Servos

Posted: 03 May 2019, 22:45
by cherowley
Cheers Thomas, suspected it was a hardware limitation with hardware timers or the like..

Thanks for the pointer :)

SOLVED: Re: 4 Servos

Posted: 05 May 2019, 14:22
by cherowley
Just a follow up in case anyone else wants to use more than 2 servos - by defining more instances it does actually work fine, I'm now using 4 servos with espeasy with no problems.

The problem was the wiring. My servos power are connected together then linked to the psu with a single cable. This wire was of insufficient gauge, causing brownouts on the servos I suspect!

Oops and shame on me for not checking the basics!

Re: SOLVED :4 Servos

Posted: 05 May 2019, 23:20
by ThomasB
I'm now using 4 servos with espeasy with no problems.
That's a pleasant surprise. Thanks for the update.
- Thomas