Servo code only works with my Hitech hs422 Servos and not my Savox 0231MG Servos

Hello,

For some reason the following code only works with my Hitech hs422 Servos and not my Savox 0231MG Servos.

Its a simple code. When I flip the switch the servo’s are to turn one way and when I unflip the switch it should turn back the other. I have kept everything the same made sure the voltage and amperage is enough.

Is there a difference on how to use code with Savox servos? Is there a problem with my code?

#include <Servo.h>
int button1 = 6; //button pin, connect to ground to move servo
int press1 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  servo1.attach(2);
  digitalWrite(6, HIGH); //enable pullups to make pin high
  
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(0);
  }
  else {
    servo1.write(90);
  }
   }

Hi,

I think you should look up the specs and see what their current rating is. Can you post links to the specs of your servos please?

How are you powering the servo.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

All servos should be powered by a separate power supply to the arduino. The arduino cannot supply the currents needed to move a servo.

Tom.... :)

http://imgur.com/WpSNOzi

Everything is getting power from the Venom 7.4 volt 8000ma battery. In the picture I have the switch being connected to the ground on the arduino, but I have also tried it with it being connected to the ground on the bread board and the results are the same.

Savox tech is:

Dimensions(mm): 41.8x20.2x42.9
Weight(g): 66
Speed(@6.0V sec/60): .17
Torque(@6.0V oz-in): 208.0
Gear: Metal
Bearing: 2BB
Case: Plastic
25 Tooth Spline

Problem is that when I turn the system on, the Savox servo goes to 90 degrees, but never goes back to 0 when I flip the switch. When it’s supposed to alternate between 90 and 0 when I flip the switch. It works perfectly with the Hitec Servo.

Looking at the (full) specs for the SW0231MG on the Savox site, it needs a pulse-stream at 200-250hz, instead of the standard servo frequency of 50Hz. I'd say this is your problem.

The full specs:-

Dimensions(mm): 41.8x20.2x42.9 Weight(g): 66 Speed(@6.0V sec/60): .17 Torque(@6.0V oz-in): 208.0 Gear: Metal Bearing: 2BB Case: Plastic 25 Tooth Spline IP Rating: 67 Frequency: 200-250hz Pulse Width Frequency: 1520

Sorry if this is a noob question... but how do I change it? Is it a different library? or something I have to add to the code?

Hi,

Also move the power wires of the servo so that they are right next to the power wires from the battery.
The servo must pull quite a bit of current when it start to move, and the protoboard rails are not rated for much current.

Tom… :slight_smile:

Hi,

Pulse Width Frequency: 1520

What?????????

It should be Centre Position Pulse Length 1520uS

Ya wonder why they bother with spec when they can't even give something meaningful.

Tom... :)

Looking at the (full) specs for the SW0231MG on the Savox site, it needs a pulse-stream at 200-250hz, instead of the standard servo frequency of 50Hz. I'd say this is your problem.

Well, I looked at the site servo specs and I did not see anything that states that 200-250hz input pulse stream is required. As it seems the servo can be used with a typical RC receiver, the 200-250hz is probably the spec for the h-bridge driver in the servo.