7
Instituto Tecnológico y de Estudios Superiores de Monterrey Campus Puebla Actuadores Dr. Renán Contreras Gómez Laboratorio 1.1 José Luis Arellano Camacho A01323890 Rigoberto Bodadilla García A01322649 Alfredo Carranza Garcés A00811569 Daniel Lopez Caceres A01322442 Roberto Martínez Chalchi A01099130 Aldo Hernández Pineda A01324039

Laboratorio1.1

Embed Size (px)

DESCRIPTION

sadasdasd

Citation preview

Page 1: Laboratorio1.1

Instituto Tecnológico y de Estudios Superiores de MonterreyCampus Puebla

ActuadoresDr. Renán Contreras Gómez

Laboratorio 1.1

José Luis Arellano Camacho A01323890Rigoberto Bodadilla García A01322649

Alfredo Carranza Garcés A00811569Daniel Lopez Caceres A01322442

Roberto Martínez Chalchi A01099130Aldo Hernández Pineda A01324039

27 de Febrero del 2015

Page 2: Laboratorio1.1

Objetivo

Mediante el uso de un Arduino (Micro-Controlador) se realizara un control de velocidad de un Motor DC, empleando al mismo tiempo un POT (Potenciómetro) para modular la velocidad del mismo y un Puente H para controlar el sentido en el que gira el motor, para el cambio de sentido se implementara un push botton.

Introducción

PWM (Modulación por ancho de pulsos), es una técnica para suministrar energía eléctrica a una carga que tiene una respuesta relativamente lenta. La señal de alimentación consta de un tren de tensiones de pulsos de tal manera que la anchura de los pulsos individuales controla el nivel de tensión eficaz a la carga.

Un Puente H es un circuito electrónico que permite a un motor eléctrico DC girar en ambos sentidos, avance y retroceso. Son ampliamente usados en robótica y como convertidores de potencia. Los puentes H están disponibles como circuitos integrados, pero también pueden construirse a partir de componentes discretos.

Desarrollo

1. Código Puente H:

//H Bridge

int switchPin=7; //switch inputint motor1Pin=3;// H Bridge leg 1int motor2Pin=4; // H Bridge leg 2int speedPin=9;// H bridge enable pinint ledPin=13; //LEDint potPin=A1;int speed=0;

void setup() { //set the switch as an inputSerial.begin(9600);pinMode(switchPin,INPUT);

//set all the other pins you're using as outputs:pinMode(motor1Pin,OUTPUT);pinMode(motor2Pin,OUTPUT);

Page 3: Laboratorio1.1

pinMode(speedPin,OUTPUT);pinMode(ledPin,OUTPUT);

//set speedPin high so that motor can turn on:digitalWrite(speedPin,HIGH);//blink the LED 3 times. This should happen only once.//if you see the LED blink three times, it means that the module reset itself,//probably because the motor caused a bownout or a short.blink(ledPin,3,100);}

void loop() { //if the switch is high motor will turn on one direction: if(digitalRead (switchPin)>0) { digitalWrite(motor1Pin,LOW); // set leg 1 of the H Bridge low.¿ digitalWrite(motor2Pin,HIGH); //set leg 2 of the H bridge high speed=(analogRead(potPin)); speed =793+(speed/6); analogWrite(speedPin,speed); Serial.println(speed); delay(50); } //if the switch is low, motor will turn in tthe other direction: else{ digitalWrite(motor1Pin,HIGH); // set leg 1 of the H Bridge high.¿ digitalWrite(motor2Pin,LOW); //set leg 2 of the H bridge low speed= (analogRead(potPin)); speed =793+(speed/6); analogWrite(speedPin,speed); Serial.println(speed); delay(50); }} void blink( int whatPin,int howManyTimes, int milliSecs){ int i=0;

Page 4: Laboratorio1.1

for (i=0; i<howManyTimes; i++) { digitalWrite(whatPin,HIGH); delay(milliSecs/2); digitalWrite(whatPin,LOW); delay(milliSecs/2); } }

2. Código DC_Motor_Control_POT:

// Function: DC_motor_control_pot//// Use a potentiometer to control a DC motorint sensor_pin = A1;int motor_pin = 11; // must be a PWM digital outputvoid setup(){Serial.begin(9600);pinMode(motor_pin, OUTPUT);}void loop(){int pot_val, motor_speed;pot_val = analogRead( sensor_pin );motor_speed = int_scale( pot_val, 0, 1023, 0, 255);analogWrite( motor_pin, motor_speed);}int int_scale(int x, int xmin, int xmax, int ymin, int ymax){int y;y = ymin + float(ymax - ymin)*float( x - xmin )/float(xmax - xmin);return(y);}

3. Código PWM to control the power of DC Motor:

// Use PWM to control the power of a DC motor// Repeat a pattern of three brightness levelsint Mot_pin = 11; // must be one of 3, 5, 6, 9, 10 or 11 for PWMvoid setup() {

Page 5: Laboratorio1.1

pinMode(Mot_pin, OUTPUT); // Initialize pin for output}void loop() {int dtwait = 2000; // Pause interval, millisecondsint V1=80, V2=220, V3=120; // 8-bit output values for PWM duty cycleanalogWrite(Mot_pin, V1);delay(dtwait);analogWrite(Mot_pin, V2);delay(dtwait);analogWrite(Mot_pin, V3);delay(dtwait);}

Resultado

Conclusiones

Se logro llevar a cabo la configuración del circuito, logrando controlar la velocidad del motor y al mismo tiempo el cambio de sentido. Uno de los principales problemas que tuvimos fue el de la energìa con la que se alimentaba el motor, ya que al provenir desde la tarjeta de arduino, y que cada pin entrega unicamente 40 mA, no es suficiente para que el motor pueda funcionar, entonces ocupamos un transistor npn 2n3904 que nos incrementa de manera considerable dicha corriente requerida para el motor. Otro punto a considerar es el tomar en cuenta los pines especìficos de la tarjeta de Arduino Uno que ùnicamente algunos pines arrojan valores analògicos necesarios para el control con la tècnica PWM que no utiliza valores digitales.