Arduino Mega with PCA9685 using I2C bus to operate SG90 servos

Hi, I have a sketch for a 16 channel sg90 servos using a PCA9685 and a Mega, the sketch I have was originally for 4 servos but I just added, It is probably a bit long winded but my programming skills are limited…

The problem I have is some of the SG90 servos are buzzing and getting warm and I believe its because they are being held, they are only switching a Model railway point so don’t need to be held, I could use a command for ,attach() and detach() but I am unsure how to add in the sketch with the …pwm.setPWM(1, 0, 200); and so on with all the other 16 functions can anyone assist I would be most grateful …

Regards

John

Toms_Modified_Turnout_sketch.ino (4.09 KB)

If the servos are getting warm it almost certainly means they are pushing against a load and that can also be the cause of the buzzing. Hobby servos are not designed for continuous pushing against a load that can overcome their internal friction. In another application the solution might be a more powerful servo, but SG90 type servos should be fine for model railway turnouts.

If you are just operating model railway turnouts and if you correctly adjust the connection between the servo and the turnout there should be no appreciable load when the turnout is at either end of its movement. My guess is that your servo is trying to move further than necessary or that it is pushing against its internal end-stop.

I am not familiar with the PCA9685. I just operate my turnout servos directly from my Mega - with a separate servo power supply, of course.

...R

The servo’s are moving between 2 angles and the arm of the servo has a piece of piano wire connected to arm and throught a small hole in the point so no load is on motor, a lot of comments about these cheap SG90’s with same problem but the attach and detach command is what I want to use but other sketches I have seen did’nt use the PCA9685 module so not quite sure how to add to sketch.

Also checking the movement of the servos’s they are not at there extreme as I can move more in each direction when not powered, also read somewhere about the frequency lowering mine set to 60 hz…

John

John40131:
..... also read somewhere about the frequency lowering mine set to 60 hz..

this datasheet suggests that the maximum frequency to be 50Hz....

Does it works any better if you lower the PWM frequency?

also have a look at this example; Can you spot that they are doing which you are not? (hint: checking the switch states is not what I referring to :wink: )

I am not in a position to try a lower frequency at the moment and the sketch as much as I can understand sketches which i said is limited it looks like 8 servo are moving on after the other I dont want that..

Also am going to have to look at slowing motion down as motors are jamming... crappy SG90 servo's

John40131:
The servo's are moving between 2 angles and the arm of the servo has a piece of piano wire connected to arm and throught a small hole in the point so no load is on motor,

By "load on the motor" I meant the force on the servo arm. If there is no force the servos won't get hot (assuming the gears have not jammed).

...R

John40131:
.... it looks like 8 servo are moving on after the other...

you are right.... it is continuously moving the servos back and forth

let me ask you this then:

from your code, if the your switch is remain ON or OFF (assuming they are not limit switches), do you think your servo stops (ie has a min and max position) or it keeps trying to move?

I dont want it to move continuously ... once its sent to one position it stays there till I switch it back again its a Point motor for switching |Model Railway points so this is what I want it to do is use the attach() and detach() command so its not being held..

John