Release/Stop Driving Servo?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jayekub
New user
Posts: 2
Joined: 12 Jul 2017, 07:21

Release/Stop Driving Servo?

#1 Post by jayekub » 12 Jul 2017, 07:26

hi, i'm successfully controlling a servo over mqtt using the Servo command. however, i'd like to stop the servo pwm signal after a few seconds to conserve power (and avoid the subtle noise it makes). i've tried sending a GPIO 0 command but that seems to have no effect after the Servo command is used. i need to reboot to get it to stop.

is there a way to do this with ESPEasy? i had this working fine with nodemcu, but switched to ESPEasy to get away from worrying about memory constraints...

jayekub
New user
Posts: 2
Joined: 12 Jul 2017, 07:21

Re: Release/Stop Driving Servo?

#2 Post by jayekub » 12 Jul 2017, 22:14

started poking around in the code and i don't see Servo::detach() called anywhere, so i'm guessing the answer is "no". i'll try coding up something to address this and will contribute back if it works.

fz1
New user
Posts: 1
Joined: 28 Jul 2017, 14:50

Re: Release/Stop Driving Servo?

#3 Post by fz1 » 28 Jul 2017, 14:55

Hi,
I have exactly the same problem! I have already tried to pull the Servo GPIO LOW, but without success. It keeps "sending" the PWM signal

SimtechBen
New user
Posts: 1
Joined: 02 Jan 2018, 00:49

Re: Release/Stop Driving Servo?

#4 Post by SimtechBen » 02 Jan 2018, 00:56

I am having the same problem. The servo keeps buzzing or ticking once it reaches position. I am trying to control shutters with it and if there is any small load on it, the servo ticks to try and maintain position. This is not desireable as the general position is fine with me.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Release/Stop Driving Servo?

#5 Post by toffel969 » 02 Jan 2018, 09:14

I have the same problem. It kills the servos rather quickly... a fix would be desirable.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Release/Stop Driving Servo?

#6 Post by vader » 02 Jan 2018, 09:35

If it needs no force to keep the position, just detach the servo from ESP and enjoy the silence (a mod of the source code is necessary). :mrgreen:

TD-er
Core team member
Posts: 8644
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Release/Stop Driving Servo?

#7 Post by TD-er » 02 Jan 2018, 21:25

I added an issue about this on Github.
https://github.com/letscontrolit/ESPEasy/issues/672

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Release/Stop Driving Servo?

#8 Post by vader » 02 Jan 2018, 21:40

I'm not sure if it is a real issue. The servos just do what they have to do: Keep the set position.

TD-er
Core team member
Posts: 8644
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Release/Stop Driving Servo?

#9 Post by TD-er » 02 Jan 2018, 21:53

vader wrote: 02 Jan 2018, 21:40 I'm not sure if it is a real issue. The servos just do what they have to do: Keep the set position.
But do they change position if you go to 0% duty-cycle?
Other change could be to set an upper and lower limit on the allowed PWM value.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Release/Stop Driving Servo?

#10 Post by grovkillen » 02 Jan 2018, 21:56

Yes, aren't they supposed to work that way? To be able to stay in the position with no power applied you'd need more expensive servos?

More on the subject:
https://arduino.stackexchange.com/q/24783
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Release/Stop Driving Servo?

#11 Post by vader » 02 Jan 2018, 22:03

TD-er wrote: 02 Jan 2018, 21:53
vader wrote: 02 Jan 2018, 21:40 I'm not sure if it is a real issue. The servos just do what they have to do: Keep the set position.
But do they change position if you go to 0% duty-cycle?
Other change could be to set an upper and lower limit on the allowed PWM value.
I haven't tried it yet. For my purposes I detached the servo from ESP. So it has no power at all (I hope...) but reverts a bit back due to the mechanical force.

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Release/Stop Driving Servo?

#12 Post by Jeff » 07 Jan 2018, 00:34

I have the same problem, it's for my catfood, it's not important to keep the position.
The noise is stressful :x
How to do ? I can use mqtt command (nodered) or url commad (domoticz).
Help us ;)

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Release/Stop Driving Servo?

#13 Post by toffel969 » 28 Feb 2018, 18:16

vader wrote: 02 Jan 2018, 22:03
TD-er wrote: 02 Jan 2018, 21:53
vader wrote: 02 Jan 2018, 21:40 I'm not sure if it is a real issue. The servos just do what they have to do: Keep the set position.
But do they change position if you go to 0% duty-cycle?
Other change could be to set an upper and lower limit on the allowed PWM value.
I haven't tried it yet. For my purposes I detached the servo from ESP. So it has no power at all (I hope...) but reverts a bit back due to the mechanical force.
Hi vader
Can you elaborate on necessary changes in source to de tach servo?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Release/Stop Driving Servo?

#14 Post by kimot » 28 Feb 2018, 23:22

Simply power servo through transistor driven by another gpio pin and switch power off, when servo is not driven to move.
But servo can move under some force then, because it is not held in its position by motor force.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Release/Stop Driving Servo?

#15 Post by toffel969 » 01 Mar 2018, 09:20

kimot wrote: 28 Feb 2018, 23:22 Simply power servo through transistor driven by another gpio pin and switch power off, when servo is not driven to move.
But servo can move under some force then, because it is not held in its position by motor force.
Sure thats a way to do it, but I think there must be a software fix too using the detach command in the arduino source code.

I think there are many applications where a holding torque through servo power is not required, but servo buzz is critical.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

waspie
Normal user
Posts: 127
Joined: 09 Feb 2017, 19:35

Re: Release/Stop Driving Servo?

#16 Post by waspie » 01 Mar 2018, 15:44

edited the servo file to detach after 2 seconds. works perfectly.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Release/Stop Driving Servo?

#17 Post by toffel969 » 01 Mar 2018, 15:56

waspie wrote: 01 Mar 2018, 15:44 edited the servo file to detach after 2 seconds. works perfectly.
Which file (name of the ino) and what source code has been changed ?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

waspie
Normal user
Posts: 127
Joined: 09 Feb 2017, 19:35

Re: Release/Stop Driving Servo?

#18 Post by waspie » 01 Mar 2018, 16:05

toffel969 wrote: 01 Mar 2018, 15:56
waspie wrote: 01 Mar 2018, 15:44 edited the servo file to detach after 2 seconds. works perfectly.
Which file (name of the ino) and what source code has been changed ?
i was in process of finding it....
I've been using mine like this for many months now without issue


it's _P001_Switch.ino

find:

Code: Select all

            {
              case 1:

                //IRAM: doing servo stuff uses 740 bytes IRAM. (doesnt matter how many instances)
                #if defined(ESP8266)
                  servo1.attach(event->Par2);
                  servo1.write(event->Par3);
                #endif
                break;
              case 2:
                #if defined(ESP8266)
                  servo2.attach(event->Par2);
                  servo2.write(event->Par3);
                #endif
                break;
            }
replace with:

Code: Select all

            {
              case 1:

                //IRAM: doing servo stuff uses 740 bytes IRAM. (doesnt matter how many instances)
                #if defined(ESP8266)
                  servo1.attach(event->Par2);
                  servo1.write(event->Par3);
                  delay(2000);
                  servo1.detach();
                #endif
                break;
              case 2:
                #if defined(ESP8266)
                  servo2.attach(event->Par2);
                  servo2.write(event->Par3);
                  delay(2000);
                  servo2.detach();
                #endif
                break;
            }
change delay (ms) to whatever you need. if your servos are where they need to be in half a second change it to something like 600.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Release/Stop Driving Servo?

#19 Post by toffel969 » 01 Mar 2018, 16:17

thx
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Release/Stop Driving Servo?

#20 Post by mrwee » 30 Jul 2018, 11:44

Hi Guys,

Is it possible to add the 'detach feature' as e.g. a command in ESP Easy? I'm not capable of changing the source-code and re-compiling, so it would be a nice addition :)

TD-er
Core team member
Posts: 8644
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Release/Stop Driving Servo?

#21 Post by TD-er » 30 Jul 2018, 22:58

mrwee wrote: 30 Jul 2018, 11:44 Hi Guys,

Is it possible to add the 'detach feature' as e.g. a command in ESP Easy? I'm not capable of changing the source-code and re-compiling, so it would be a nice addition :)
What a coincidence ;)
Someone made a PR for this... https://github.com/letscontrolit/ESPEasy/pull/1619

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 32 guests