# AC servo RC radio speed fix

**URL:** <https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720>\
**Category:** Programming\
**Created:** [April 3, 2022, 12:59pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720 "2022-04-03T12:59:08Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![nice\_servo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nice_servo/32/248390_2.png) [@nice\_servo](https://forum.arduino.cc/u/nice_servo)\
**Post date:** [April 3, 2022, 12:59pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/1 "2022-04-03T12:59:08Z")

</div>

tutorial:

> **[Control Servos With Arduino and RC Receiver/Transmiter](https://www.instructables.com/Control-Servos-with-Arduino-and-RC-receiver/)**
>
> Control Servos With Arduino and RC Receiver/Transmiter: In this Tutorial I'll explain how to control more than one servo with only one channel of your Transmiter/Receiver and program own movements. It is usefull for complex movements like robotic...

Hi, this tutorial taught me how to move servo through RC radio via arduino....then i was able to move an AC servo that uses PUL and DIR, but it rotates very slowly, what can i fix to make it go fast....

```cpp

// ***------ RC Servo control -----***
// ***---- K. Michalsky / 2015 ----***

//Arduino Pins
// Pin7 to channel2 of receiver
// Pin9 to Signal of Servo1

//Include Servo library.The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. 
#include <Servo.h>

#define dirPin 2
#define stepPin 3

//Create servo objects to control the servo motors
//Servo servoMotor1;

//Define variables for the position of the servos
//int posServo1 = 0;

//Define a variable for the channel of the Receiver with which you want to control the servos, in this case channel2 (ailerons channel from my receiver)
int channel2;

int mSpeed = 0;

//Attach each servo variable to a pin
void setup() { 

  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  // Set the spinning direction CW/CCW:
  digitalWrite(dirPin, HIGH);
  
  //servoMotor1.attach(9); //Servo1 attached to pin 9

    //Define the input Pin for the Receiver
  pinMode(7, INPUT);
  Serial.begin(9600); //Serial comunication for later monitoring of channel signal value
}

void loop() {
  //Read the pulse from Pin7 either HIGH or LOW
  channel2 = pulseIn(7, HIGH);

  //Monitor channel value
  Serial.print("Channel 2:");
  Serial.println(channel2);

  //Define a range of the channel value to center the servo when the stick of the transmiter is centered. This range can variate depending on which servos and Transmiter you are using. Servos are centered at 90 degrees
  //if((channel2 >= 1450) && (channel2 <= 1550)){
    //posServo1 = 0;
    //servoMotor1.write(posServo1);
  //}
  //If the channel value is bigger than the highest value of the range do following
  if(channel2 > 1550){
    digitalWrite(dirPin, HIGH);
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1);
  }

    delayMicroseconds(1);
  if(channel2 < 1450){
    digitalWrite(dirPin, LOW);
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1);
    
  }

        
          }                  
                 
   
  //Time for Monitoring values

```

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [April 3, 2022, 1:01pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/2 "2022-04-03T13:01:36Z")

</div>

Does it ever go fast **without** the Arduino?

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [April 3, 2022, 1:04pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/3 "2022-04-03T13:04:43Z")

</div>

> [@nice\_servo](#):
>
> an AC servo

Do you have any details?

---

<div class="post-metadata">

**Author:** ![nice\_servo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nice_servo/32/248390_2.png) [@nice\_servo](https://forum.arduino.cc/u/nice_servo)\
**Post date:** [April 3, 2022, 1:05pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/4 "2022-04-03T13:05:56Z")

</div>

o yes for sure.... if i use this sample code it spins so fast

```cpp
// Define stepper motor connections:
#define dirPin 2
#define stepPin 3
void setup() {
  // Declare pins as output:
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  // Set the spinning direction CW/CCW:
  digitalWrite(dirPin, HIGH);
}
void loop() {
  // These four lines result in 1 step:
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(stepPin, LOW);
  delayMicroseconds(5);
}

```

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [April 3, 2022, 1:08pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/5 "2022-04-03T13:08:15Z")

</div>

Oh, it's a stepper motor, not a servo?

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [April 3, 2022, 1:10pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/6 "2022-04-03T13:10:38Z")

</div>

> [@nice\_servo](#):
>
> . if i use this sample code it spins so fast

Your loop() times in that are much faster - with pulseIn it's going to be a lot slower

---

<div class="post-metadata">

**Author:** ![nice\_servo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nice_servo/32/248390_2.png) [@nice\_servo](https://forum.arduino.cc/u/nice_servo)\
**Post date:** [April 3, 2022, 1:14pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/7 "2022-04-03T13:14:33Z")

</div>

they work the same exact way, PUL and DIR

---

<div class="post-metadata">

**Author:** ![nice\_servo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nice_servo/32/248390_2.png) [@nice\_servo](https://forum.arduino.cc/u/nice_servo)\
**Post date:** [April 3, 2022, 1:17pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/8 "2022-04-03T13:17:23Z")

</div>

what do you mean, what can i change?

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [April 3, 2022, 1:23pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/9 "2022-04-03T13:23:19Z")

</div>

> [@nice\_servo](#):
>
> they work the same exact way, PUL and DIR

If you say so. All my servos have a single line PWM control line, power and ground. 3 wires. By definition, steppers aren't servos, they have no positional feedback system.

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [April 3, 2022, 1:26pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/10 "2022-04-03T13:26:22Z")

</div>

> [@nice\_servo](#):
>
> what do you mean

I mean, if you're using pulseIn to read an RC PWM output, the pulses only happen every 20ms.  
You could try not using pulseIn

---

<div class="post-metadata">

**Author:** ![nice\_servo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/nice_servo/32/248390_2.png) [@nice\_servo](https://forum.arduino.cc/u/nice_servo)\
**Post date:** [April 3, 2022, 2:00pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/11 "2022-04-03T14:00:19Z")

</div>

solved, thank you

> [@Servo control using arduino via rc receiver](https://forum.arduino.cc/t/servo-control-using-arduino-via-rc-receiver/976208/4):
>
> Thank it works, i also tried it on AC servo PUL and DIR and it works, but i cannot make it go faster it rotates very slowly, what can i do? // \*\*\*------ RC Servo control -----\*\*\* // \*\*\*---- K. Michalsky / 2015 ----\*\*\* //Arduino Pins // Pin7 to channel2 of receiver // Pin9 to Signal of Servo1 //Include Servo library.The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. #include \<Servo.h\> #define dirPin 2 #define stepPin 3 //Create servo objects to c…

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [September 30, 2022, 2:00pm UTC](https://forum.arduino.cc/t/ac-servo-rc-radio-speed-fix/976720/12 "2022-09-30T14:00:25Z")

</div>

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