A fix with Blynk or hardware one (servo noise)

I’ve recently built some automated blinds

using 5 servos into a PCA9685 and ESP8266. All is working fine and i’m happy with it but i’m wondering about servo noise that is happening when the blinds are being held in place (stall position??). If it were one servo it might not be as noticeable but because there is 5 its allot louder. Though you cant really hear it in the video.

I understand the signal should be a loop sending the servo its position, but this might not be an option in this situation. Has anyone come across this before, if so any ideas? Is there a method with code to stop the signal or will i have to add in a relay to cut the power to the servo board?

Im using metal gear mini servos similar to the sg90’s too which isnt helping with the noise either.

Any thoughts or ideas would be appreciated.

Also thanks to PeteKnight for his help on a previous post regarding the PCA9685, was very helpful

Gav

1 Like

Did you try servo detach after they reach desired position. Then reattach before going to a new position.

OE - Output enable. Can be used to quickly disable all outputs. When this pin is low all pins are enabled. When
the pin is high the outputs are disabled. Pulled low by default so it’s an optional pin!

Connect the pin to a digital output and set it high when the servos are not moving to stop servo chatter.

I didnt have much luck with this, once the SDA pin was cut i couldn’t get it working again unless i reset.

I initially looked at the detach method, but because Im going through the PCA board I couldn’t get detach to work either. I feel this would have been the best way if my servos were going into the ESP8266.

Both the above ways might work, im not as good as id like with coding. I found a solution that now seems obvious (after trying relays to cut the separate power to the servos and all sorts). Just setting my SERVOMAX to 4096. Then set a separate button to be pushed once in place and that should do it. Only snag would be my sliders moving to max each time i press the button, but i could live with that. Here’s the code if anyone is interested.

Thanks guys for suggesting some ideas and helping me out.

int  master, slider1, slider2, slider3, slider4, slider5;


// Second Servo
#define SERVOMIN  125 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  4096 //
void setup() {
  Serial.begin(9600);
  Wire.begin();                 // Wire must be started first
  pwm.begin();
  pwm.setPWMFreq(60);
  Blynk.begin(auth, ssid, pass);
}

void loop() {
  Blynk.run();

  //InValue=analogRead(A0);
  //map(InValue,0,4095,SERVOMIN,SERVOMAX);
  if (master > 125)
  {
pwm.setPWM(0, 0, master);
pwm.setPWM(2, 0, master);
pwm.setPWM(4, 0, master);
pwm.setPWM(6, 0, master);
pwm.setPWM(8, 0, master);
  }
  else
  {
pwm.setPWM(0, 0, slider1);
pwm.setPWM(2, 0, slider2);
pwm.setPWM(4, 0, slider3);
pwm.setPWM(6, 0, slider4);
pwm.setPWM(8, 0, slider5);
  }
}

Did you calibrate your servos?

That noise may be from trying to drive your servos past their physical limit.

Yeah, i found that 125 to 575 was about right for them. That’s where i think i was thrown off a little. So now each slider in Blynk is set to 0 - 575, but now my servomax is 4096 with a button assigned to it for that value only.

Just figured this out and it works, I have no idea what was going on before with it.

Thanks again for everyones help!

Can you post the code on what you have end up ? So that anyone who are trying the same can learn from this topic.

Thank you.

yeah, its pretty much the same as it is above, but here it is in full for anyone that might come across similar problems. (its a little messy but does the job)

Also in Blynk remember to set sliders around 125 - 575 (or whatever your servos are) and to have a separate button that is 0 - 4096 to lock them in place once you’re happy with the final position.

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>


Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
char auth[] = "xx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xx";
char pass[] = "xx";
// PCA9685 outputs = 12-bit = 4096 steps
// 2.5% of 20ms = 0.5ms ; 12.5% of 20ms = 2.5ms
// 2.5% of 4096 = 102 steps; 12.5% of 4096 = 512 steps
uint8_t servonum = 9;
int  master, slider1, slider2, slider3, slider4, slider5;


// Second Servo
#define SERVOMIN  125 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  4096 //
void setup() {
  Serial.begin(9600);
  Wire.begin();                 // Wire must be started first
  pwm.begin();
  pwm.setPWMFreq(60);
  Blynk.begin(auth, ssid, pass);
}

void loop() {
  Blynk.run();

  //InValue=analogRead(A0);
  //map(InValue,0,4095,SERVOMIN,SERVOMAX);
  if (master > 125)
  {
pwm.setPWM(0, 0, master);
pwm.setPWM(2, 0, master);
pwm.setPWM(4, 0, master);
pwm.setPWM(6, 0, master);
pwm.setPWM(8, 0, master);
  }
  else
  {
pwm.setPWM(0, 0, slider1);
pwm.setPWM(2, 0, slider2);
pwm.setPWM(4, 0, slider3);
pwm.setPWM(6, 0, slider4);
pwm.setPWM(8, 0, slider5);
  }
}

BLYNK_WRITE(V1)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  slider1  = pinValue;
  Serial.println(slider1);

}
BLYNK_WRITE(V2)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V2 to a variable
  slider2  = pinValue;
  Serial.println(slider2);

}
BLYNK_WRITE(V3)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V3 to a variable
  slider3  = pinValue;
  Serial.println(slider3);

}
BLYNK_WRITE(V4)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V4 to a variable
  slider4  = pinValue;
  Serial.println(slider4);

}
BLYNK_WRITE(V5)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V4 to a variable
  slider5  = pinValue;
  Serial.println(slider5);

}
BLYNK_WRITE(V6)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V4 to a variable
  master  = pinValue;
  Serial.println(master);

}
1 Like