Simple servo tester with Arduino

Servo tester is a useful little device that is needed specially when you do not have one. I’ve been placed in a situation like that few days ago what I was trying to connect ailerons with servos on my Depron plane and setup correct control throw. Luckily, I own a few Arduinos,  so 15 minutes later I owned a divice like that:

Servo tester with Arduino

It is an extremely simple servo tester based on Arduino Pro Micoro that can send 3 different PWM pulse lengths: 1000us, 1500us and 2000us. That gives min, neutral and max stick position on RC radios. Perfect to setup control throws and neutral positions.

Required parts:

  • Arduino. Any Arduino will do. I used Arduino Pro Micro, but any can be used. Even barebone ATmega328 running internal oscillator on 8MHz,
  • Breadboard,
  • Tact switch,
  • Some golpins to make servo connector,
  • Cables.

Electrical diagram goes as follows:

Arduino servo tester diagram

Program is also not complicated:

#include <Servo.h>
Servo servo;
const int PIN_BUTTON = 6;
const int PIN_SERVO = 5;
int pos = 1500;
int prevButtonState = HIGH;
int currentButtonState = HIGH;
void setup() {
servo.attach(PIN_SERVO);
servo.writeMicroseconds(pos);
pinMode(PIN_BUTTON, INPUT_PULLUP);
}
void loop() {
currentButtonState = digitalRead(PIN_BUTTON);
if (currentButtonState == LOW && prevButtonState == HIGH) {
pos = pos + 500;
if (pos > 2000) {
pos = 1000;
}
servo.writeMicroseconds(pos);
}
prevButtonState = currentButtonState;
delay(100);
}

And at the end, it works like that:

Source code is available on GitHub.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *