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.
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;
}
}
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().
ReplyDeleteBut 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 ;)
Super project !
ReplyDeletetracking system için nrf mi kullandın
ReplyDeleteKeşke resimlerdeki yazılarıda ingilizce yapsaymışsın
ReplyDeleteJust 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.
ReplyDeleteForgot to ask, What is Mutlak?
ReplyDeletemutlak is variables mutlak --- absolute
Delete