SOLVED :4 Servos

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
cherowley
Normal user
Posts: 125
Joined: 14 Jan 2016, 09:39

SOLVED :4 Servos

#1 Post by cherowley » 03 May 2019, 21:52

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?
Last edited by cherowley on 05 May 2019, 14:22, edited 1 time in total.

User avatar
ThomasB
Normal user
Posts: 383
Joined: 17 Jun 2018, 20:41
Location: USA

Re: 4 Servos

#2 Post by ThomasB » 03 May 2019, 22:19

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

cherowley
Normal user
Posts: 125
Joined: 14 Jan 2016, 09:39

Re: 4 Servos

#3 Post by cherowley » 03 May 2019, 22:45

Cheers Thomas, suspected it was a hardware limitation with hardware timers or the like..

Thanks for the pointer :)

cherowley
Normal user
Posts: 125
Joined: 14 Jan 2016, 09:39

SOLVED: Re: 4 Servos

#4 Post by cherowley » 05 May 2019, 14:22

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!

User avatar
ThomasB
Normal user
Posts: 383
Joined: 17 Jun 2018, 20:41
Location: USA

Re: SOLVED :4 Servos

#5 Post by ThomasB » 05 May 2019, 23:20

I'm now using 4 servos with espeasy with no problems.
That's a pleasant surprise. Thanks for the update.
- Thomas

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest