Show Posts
|
|
Pages: [1] 2
|
|
2
|
International / Software / Re: consulta. PID u otro modo- para posicion de motor
|
on: November 24, 2012, 07:14:53 am
|
|
Hola Nicko,
Si no requieres tanta precisión entonces lo que has hecho esta bien, bueno y tampoco es que mi código sea la panacea, tambien estoy aprendiendo jajaja... trata con algo así (lo ley en la web)
Setpoint = analogRead(pinSensor2)
feedback= analogRead(pinSensor)
error = Setpoint - feedback
PWM = error*K
donde K es una constante que hallaras por ensayo y error, delimitas a PWM para que si es > 255 entonces sea 255 y si es < 0 entonces sea 0, algo así es lo que hago, has visto un par de videos que saque de youtube? miralo y ve la precisión que alcanzan..mi reto es llegar a ese grado.
slds
|
|
|
|
|
3
|
International / Software / Re: consulta. PID u otro modo- para posicion de motor
|
on: November 22, 2012, 01:48:02 pm
|
|
Hola Nicko,
bien por tu avance, lo que veo es q dejas el PWM constante a 60 y para q aumente la precisión debes hacer proporcional el pwm a la diferencia del valor del sensor con el pot 2.
Te cuanto que apenas fabrique mi nuevo puente H con el L298n, falta volver a configurar los valores y revisar el método PID de mi sketch. seguire pendiente de tus avances ya que apenas en q semana retomó yo.
Slds
|
|
|
|
|
5
|
International / Software / Re: consulta. PID u otro modo
|
on: November 11, 2012, 04:58:32 pm
|
|
Amigo, por ahí estuve cacharreando con lo del PID y ya va tomando forma, entra a mi blog y revisa el ejemplo, todavía se debe mejorar el sketch, o mejor aún usar la libreria PID existente.
Como te ha ido a ti? que has avanzado?
Cualquier cosa me cuentas.
|
|
|
|
|
6
|
International / Software / Re: consulta. PID u otro modo
|
on: October 30, 2012, 05:00:12 pm
|
|
El encoder es el feedback, si, vas a saber donde esta (o cuantas vueltas dió) pero como haces efectivo tu posicionamiento...con el PID (método de sistema de control) vas a optimizar la salida del sistema, reduciendo el error, ya que lo ajustas progresivamente.
Aunque su uso depende de la aplicación ( si lo amerita) yo personalmente he revisado varios post acerca del uso de este método en fabricación de servos casero, y la precisión es bárbara ( claro que para lograr esta precisión, se requiere de caracterización matemática del proceso - mathlab/simulink/labview)
Yo voy a tratar de hacer un seudo (PD) realizando el ajuste manual (sin la caracterización) ya que lo que estoy haciendo, no tiene que ser tan preciso (aplicación de motor en un sistema de dirección de un carro RC)
Slds
|
|
|
|
|
11
|
Using Arduino / Project Guidance / Re: Control gear motor like a Servo, project , suggestions
|
on: October 27, 2012, 03:35:42 pm
|
Your logic to decide which way to move the motor (and how fast) looks very strange. I'd expect you to decide what the desired position was based on the joystick, compare that with the actual position to determine how far the motor was from the desired position and in which direction, and determine the motor speed and direction from that. Instead you're just comparing the motor and joystick positions against some limits. Presumably this means that the motor is just supposed to go between two fixed positions rather than follow the joystick. Could you clarify what behaviour you're aiming for?
The technique of setting the motor speed and then waiting for a second before you do anything else pretty much guarantys that the motor will overshoot. If I were you I'd do the position comparison as fast as possible and decide what direction/speed you want the motor to move, tell it to move in that direction / speed and then immediately do the position comparison again etc.
the code part is really simple, I just control the motor's direction with the h - bridge (joystick signal, right or left), and I use the pot signal like to limit. now I'm searching about PID (I`m Mech Engineer but automatization is not my strength) I realize improved as had recomendade (control P) but how can I figure out the constant (Kp) to do like you say speed = (desired position - actual position)*Kp 
|
|
|
|
|
14
|
Using Arduino / Project Guidance / Control gear motor like a Servo, project , suggestions
|
on: October 25, 2012, 04:15:39 pm
|
Gente, In my project I`am using a geared motor like a Servo, I adapted a pot (100 k), for reading its potition; My Idea is move it to left or right until reach limit points in both ways (almost a 45 degree from mid potition, both ways) I'm using a L293D like h bridge and PWM. this is my gear motor:  My test video: http://www.youtube.com/embed/AXtEeYBjr3gthis is my code, a simple one, but worked I want to improved, any suggestion? what about PID? thanks, //Programa para control de carro v.1.1, dirección //Selwins Maturana Oct 2012 int pot2 = A5; //joystick dirección int enable = 3; //Enable IC L293D - PWM control de velocidad int right = 9; // Señal para ir hacia la derecha int left = 7; // Señal para ir hacia la izquierda int LED = 13; //verificación int sign;// Señal potenciometro moto reductor void setup(){ pinMode(enable, OUTPUT); pinMode(forward, OUTPUT); pinMode(backward, OUTPUT); Serial.begin(9600); } void loop(){
dir = analogRead(pot2); // joystick sign = analogRead(A3); //Posición del moto reductor sign = map(sign, 0,1023, 0, 255); Serial.println(sign); delay(1000);
if(dir >= 344 && sign > 105) { digitalWrite(left, LOW); analogWrite(enable, 70); // Para que gire despacio digitalWrite(right, HIGH); delay(1000); // pausa para que no se pase digitalWrite(right, LOW); delay(10); } else if (dir <= 334 && sign < 127){ digitalWrite(right, LOW); analogWrite(enable, 80); digitalWrite(left, HIGH); delay(1000); digitalWrite(left, LOW); delay(10); } else { digitalWrite(right,LOW); digitalWrite(left, LOW); analogWrite(enable, 0); } }
|
|
|
|
|
15
|
International / Español / Uso de motor DC como cuasi Servo, proyecto avanzado, para sugerencias
|
on: October 25, 2012, 03:43:16 pm
|
Gente, En el proyecto que estoy desarrollando utilice este moto reductor como un cuasi servo, le instale un potenciometro de 100 k, para que me sirviera como "encoder" y saber su posición, la idea es usarlo como dirección, moviendolo hacia la izquierda o derecha hasta cierto ángulo, teniendo como referencia la lectura del potenciometro instalado. estoy utilizando un L293D (puente H) para el sentido de giro y PWM. Este es:  Este es el código que utilizo, simplemente gira a la izquierda o a la derecha sin pasar los límites establecidos (valor del pot) es muy sencillo y funcionó, pero requiero hacerlo mejor, ya que debí colocarle una duración de 1 seg, ya que se estaba pasando demasiado de los límites. La consulta es que si con PID puedo mejorar el control, alguien que me comparta su experiencia. //Programa para control de carro v.1.1, dirección //Selwins Maturana Oct 2012 int pot2 = A5; //joystick dirección int enable = 3; //Enable IC L293D - PWM control de velocidad int right = 9; // Señal para ir hacia la derecha int left = 7; // Señal para ir hacia la izquierda int LED = 13; //verificación int sign;// Señal potenciometro moto reductor void setup(){ pinMode(enable, OUTPUT); pinMode(forward, OUTPUT); pinMode(backward, OUTPUT); Serial.begin(9600); } void loop(){
dir = analogRead(pot2); // joystick sign = analogRead(A3); //Posición del moto reductor sign = map(sign, 0,1023, 0, 255); Serial.println(sign); delay(1000);
if(dir >= 344 && sign > 105) { digitalWrite(left, LOW); analogWrite(enable, 70); // Para que gire despacio digitalWrite(right, HIGH); delay(1000); // pausa para que no se pase digitalWrite(right, LOW); delay(10); } else if (dir <= 334 && sign < 127){ digitalWrite(right, LOW); analogWrite(enable, 80); digitalWrite(left, HIGH); delay(1000); digitalWrite(left, LOW); delay(10); } else { digitalWrite(right,LOW); digitalWrite(left, LOW); analogWrite(enable, 0); } }
|
|
|
|
|