Skip to main content

360 Degree Servo Motor Using Stepper - Arduino


Hi Everyone,

I want to produce own servo motor using stepper motor because i need full rotational servo motor. This servo will allow clear tracking to my antenna tracker, i want to use it horizontal movement mechanism. For this mechanism we can think it our UAV moves in two dimensional coordinate plane which x-axis and y-axis.





If i want to completely track the UAV there shouldn't be any obstacle on my movement as both software and hardware. We can think our movement as a scanning the half sphere, for doing this we need two movement point i want to name it horizontal movement mechanism and vertical movement mechanism. For the full scanning  i can set horizontal movement mechanism to 0-360 degree and vertical movement mechanism 0-90 degrees. Or we can set them both 0-180 degree. In both side we can scan the area clearly.





I want to choose first one because in second one there are two critical point if i use. However i want to use it smoothly. At this position i have another problem. I should develop own servo motor because i need full rotation.

Here it is my solution :




Here the code :



#include <AFMotor.h>

AF_Stepper motor(200, 1);
int x =0;
int xold =0;

void setup() {
  motor.setSpeed(40);  // 10 rpm    
}
void loop() {
  int mutlak = abs(x-xold);
  if(x-xold >0 && mutlak <= 180)
 {
  motor.step((x-xold)*5/9, FORWARD, SINGLE); 
  delay(500);
  xold = x;
 }
  if(x-xold <0 && mutlak <= 180)
 {
  motor.step((mutlak)*5/9, BACKWARD, SINGLE); 
  delay(500);
  xold = x;
 }
 if(x-xold >0 && mutlak > 180)
 {
  motor.step((xold+360-x)*5/9, BACKWARD, SINGLE); 
  delay(500);
  xold = x;
 }
  if(x-xold < 0 && mutlak > 180)
 {
  motor.step((x+360-xold)*5/9, FORWARD, SINGLE); 
  delay(500);
  xold = x;
 } 

}

Comments

  1. Really interesting. It's possible to control any 2 wire motor with a l298n, always in datasheet rules, just by timing and playing with power on ENA/ENB with analogWrite().

    But if you hack a servo to remove the limit of the gear, then remove the electronic board and re-solder the 2 wires, just leave the PWM wire unconnected but safe, you never know when you will need to add a temperature sensor with a regulated voltage lm5xx... ideas away, you will have a servo 360º with gear system and controlled with l298n, really powerful if you want just to roll in both senses, if you need precision that's your article, great work! I'll check if a need, atm I'm working as said ;)

    ReplyDelete
  2. tracking system için nrf mi kullandın

    ReplyDelete
  3. Keşke resimlerdeki yazılarıda ingilizce yapsaymışsın

    ReplyDelete
  4. Just what I have been working on. Been trying to use a closed loop stepper MKS42 but having problems coding to it. I think I will give this a whirl (pun intended). I will need to put my positions in an array and trigger them with inputs to analog ports. Should work with DRV8825 driver as well. Thanks for the video.

    ReplyDelete
  5. Forgot to ask, What is Mutlak?

    ReplyDelete

Post a Comment

Popular posts from this blog

Artificial Horizon and Compass Using Arduino-Processing-MPU6050

Hi everyone, Today we will realize our artificial horizon using Arduino, Processing and MPU 6050 IMU. In this application I use Arduino Uno, If you should use different card, you should examine i2c communication for your card. For Arduino Uno connections will be like that: MPU6050 Pins       Arduino Uno Pins Vcc                        3.3V Gnd                       Gnd SCL                       A5 SDA                      A4 INT                       2 (Digital Pin) This my MPU6050, if you want more information about it: http://www.invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf After it we connecting the MPU6050 to Arduino. If our Arduino-MPU6050 system is ready, we can begin to try it. In this level, we should read three dimensional degrees which are Phi, Theta, Psi on MPU6050 using serial monitor. For doing this of course we need the code, Here is the arduino code: // M.Furkan Bahat , November 2014 // For more information http:/

Onuncu Yıl Marşı - Arduino

Bir önceki çalışmamızda sizlere Arduino'nun hazır melodilerinden dinletiler sunmuştuk. Bu gün ise sınırları biraz daha zorlayıp Nokia 3310 Besteleyici deneyimime güvendiğim için kodları kurcalayarak bestelediğim Onuncu Yıl Marşı'nı bayrak sallayarak dinletmek istiyorum. Eğer gerçekten Onuncu Yıl Marşı olarak dinlerseniz öyle oluyor, lütfen biraz ön yargı :) (3310'nun besteleyisinden kat be kat zor bir iş olduğunu itiraf etmeliyim) Servo ucuna bağladığım bayrağı sürekli olarak bir sağa bir sola sallama isteğim, Tone.h kütüphanesinin Servo.h kütüphanesini yanında barındırmak istememesi üzerine sekteye uğradı. Timer hatası sebebiyle bunu yapamadım, fakat yılmadım servo'yu direkt melodi sinyalinin geldiği bacağa bağladım. Bu ise her ne kadar dolu dolu bir bayrak sallayış olmasa da gönlümüzü etmeye yetiyor :) Gerekli malzemeler: Servo Hoparlör Bağlantı Kabloları Olmazsa olmazımız bayrağımız. Bağlantının nasıl yapılacağına gelecek olursak Hoparlörün si

Görüntü işleme için Uçuş Denemesi

Merhabalar, Bu çalışmamızda havandan görüntü almak isteyen veyahut bu görüntüleri işlemek isteyen arkadaşlara referans olsun diye iki adet video paylaşacağım. Videoları kişisel bilgisayarınıza indirip görüntü işleme açısından çalışmalar yapabilirsiniz. Diğer taraftan yerde belirlediğimiz bir nesnenin boyutunun irtifa değerlerine göre ekranda kapladığı piksel değişimini inceleyebilirsiniz. Ya da en azından belirli irtifa değerlerinden nesneler ve insanların nasıl göründüğü hakkında genel kültür olur :) İlk videoda 70cm x 70cm beyaz bir levha kullanıldı, diğer taraftan oturan, ayakta ve yürüyen insan figürleri de videoda mevcut. Bunların çeşitli irtifa değerlerine göre dikey şekilde konumlandırılmış, yere doğru bakan kameradan nasıl göründüğü konusunda fikir sahibi olmanıza sebep olacağını düşünmekteyim. İkinci videoda 30-100 metre arasında dolaşan (genelinde 45 metre civarında) bir insansız hava aracından alınan görüntüler mevcut. Aşağı konumlandırılmış hedefler 70 cm x