Slowing Down PCA9685 Controlled Servo Movement

Hey Guys!

I spent a lot of time on a 7 segment servo controlled clock for my office recently which I finally finished. It works great but am somewhat disappointed that whenever the time changes (every minute) the servos that move go full speed and are really loud + distracting. I'm therefore trying to slow down the servo movements to bring the noise down a bit.

I know there are a variety of methods for slowing them down, but am not sure what the best may be to cut the speed for each in this specific script. I spent a lot of time dialing in each of the 28 servos to face the right way and last thing I want to do is jeopardize that.

The script seemingly uses SetPWM within the "showdigit" function (~70% down) plus variables to set each servo. Any suggestions for how to address would be fantastic. Below is a snippet of the part which sets the servo followed by the complete code if you wish to view...

void showdigit(byte i, byte digit, int w) { // parameters: i = digit position (0,1,2,3), digit = number, w = delay avoiding high power draw
  int pulse;
  byte servonum, a, segmentposition;

  for (byte j = 0; j < 7; j++) { // show the 7 segments
    servonum = j + (8 * ((i == 1 || i == 3))); // add 8 if position is 1 or 3 because 1 ands 3 digits start on pin 8 of the PCA
    segmentposition = mapchar[digit] [j]; // segment should be low or high?
    if (servoreverse [i] [j] == 0) {
      pulse = servopulse[segmentposition]; // for a normal (not reverse) servo assign pulse low or high
    }
    else {
      pulse = servopulse[!segmentposition]; // if servo works reverse, assign contrary
    }
    pulse = pulse + servofinetune [i] [j]; // add the fine tunning to the servo

    switch (i) { // switch for both PCA controllers
      case 0: case 1:
        servoHours.setPWM(servonum, 0, pulse);
        break;
      case 2: case 3:
        servoMinutes.setPWM(servonum, 0, pulse);
        break;
    }
    delay(w); // delay in between movement of contiguous segments, so we can do waves oleeeeeeee.
  }
}

ServoClock_OTA_Ease_092322.ino (11.1 KB)

Thanks!

You may find that members are reluctant to download code. It is kind of a pain.

Read the forum guidelines to see how to properly post code and some good information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

I see several possibilities but I cannot explain them as that part of the code is not shown. Also post a simple schematic, not a frizzy picture as how you have wired it.

Thanks for the reply...

The entire code is linked in the initial post if thats what you're after. I've also added a diagram below. Hope thats what you needed. Appreciate the help!

To note, there are 14 servos per PCA9685 wired to points 1-14 on each board. The 15th connection for each doesn't have anything attached. Thanks

Nice picture but not much help. "A schematic, or schematic diagram, is a representation of the elements of a system using abstract, graphic symbols rather than realistic pictures." Wikipedia

I get what a schematic is, but not sure how it applies to the code unless you are suggesting hardware solution. Also not sure how I'd put it together necessarily as there's really only 4 distinct components - the NodeMCU, PCA9685s, SG-90 servos plus a capacitor. Here's the schematic for the PCA9685. Couldn't find one for the servo. Can paste together or redraw if needed, but other than each servo connecting to a PWM on a PCA9685 everything's just 5v or gnd.

Hope that helps - Thanks

The NodeMCU processor is 3V3 not 5V as you stated "everything's just 5v or gnd". At this point without the information I asked for and Links to "Technical" information on the hardware devices I cannot help. Good Luck!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.