viernes, 3 de diciembre de 2010

PROYECTO MINIAPOLIS

ESTE ES UNTRABAJO HECHO POR LOS ESTUDIANTES DEL TEC DE MONTERREY CAMPUS SANTA FE.

EL OBJETIVO PRIMORDIAL ES HACER UN DIRIGIBLE AUTONOMO, CON UN MICROCONTROLADOR ATMEGA 328, MONTADO SOBRE UN KIT ARDUINO DUEMILANOVE.

EL MATERIAL USADO PARA ESTE PROYECTO ES:

- UN KIT DE ARDUINO
- 3 SENSORES ULTRASONICOS (PING PARALLAX)
- 3 MOTORES DC
- 3 PROPELLERS
- 1 SERVO MOTOR
- GLOBOS DE HELIO EQUIVALENTES A 0.5 m3
- 4 PILAS 9 V
- REGULADORES DE VOLTAJE 7805
- 2 PUENTES H L293B
- PLACA FENOLICA
- CABLES

DESARROLLO

PENSAMOS EN HACER UN DIRIGIBLE QUE TUVIERA TRES MOTORES CON LOS CUALES DOS IMPULSARIAN HACIA EL FRENTE Y OTRO MANTENDRIA LA ALTURA ESTABLE.

PASOS DE LA FABRICACIÓN DEL DIRIGIBLE:



LA RETROALIMENTACIÓN DE LOS MOTORES ESTA DADA POR LA ALTURA MEDIDA CON LOS SENSORES ULTRASONICOS. TODAS LAS VELOCIDADES DE LOS MOTORES ESTAN CONTROLADAS POR UN CICLO DE TRABAJO.

EL PROGRAMA DE NUESTRO PROYECTO CONSISTE:


#include <Servo.h>

Servo servo;

int pos = 0;

int PWM1=3;
int PWM2=5;
int PWM3=6;

const int pingPinx = 2;
const int pingPiny = 4;
const int pingPinz = 11;
const int PUENTEH1 = 7;
const int PUENTEH2 = 8;
const int PUENTEH3 = 9;
const int PUENTEH4 = 10;


void setup() {
   // initialize serial communication:
   Serial.begin(9600);
     servo.attach(13);
}

void loop()
{

   long durationx, cmx, durationy, cmy, durationz, cmz;;

   pinMode(pingPinx, OUTPUT);
   digitalWrite(pingPinx, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPinx, HIGH);
   delayMicroseconds(5);
   digitalWrite(pingPinx, LOW);
   pinMode(pingPinx, INPUT);
   durationx = pulseIn(pingPinx, HIGH);
   cmx = microsecondsToCentimeters(durationx) ;

   pinMode(pingPiny, OUTPUT);
   digitalWrite(pingPiny, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPiny, HIGH);
   delayMicroseconds(5);
   digitalWrite(pingPiny, LOW);
   pinMode(pingPiny, INPUT);
   durationy = pulseIn(pingPiny, HIGH);
   cmy = microsecondsToCentimeters1(durationy);

   pinMode(pingPinz, OUTPUT);
   digitalWrite(pingPinz, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPinz, HIGH);
   delayMicroseconds(5);
   digitalWrite(pingPinz, LOW);
   pinMode(pingPinz, INPUT);
   durationz = pulseIn(pingPinz, HIGH);
   cmz = microsecondsToCentimeters2(durationz);
  
   int XPWM = ((325 - cmx) - 70);
   int YPWM = ((325 - cmy) - 70);
 //  int ZPWM = ((325 - cmy) - 70);

   if (cmx < 40 && cmy > 40){
   int XPWM = cmx + 30 + 180;
   int YPWM = 50;
   analogWrite(PWM1, XPWM);
   analogWrite(PWM2, YPWM);
   digitalWrite(PUENTEH1, LOW);
   digitalWrite(PUENTEH2, HIGH);
   digitalWrite(PUENTEH3, LOW);
   digitalWrite(PUENTEH4, HIGH);
   servo.attach(13);
   servo.write(50);              // tell servo to go to position in variable 'pos'
   delay(180);                   // waits 15ms for the servo to reach the position
   //Serial.print("Izquierda");
   //Serial.print(cmx);
   //Serial.print("cm   ");
   //Serial.print(cmy);
   //Serial.print("cm   ");
   //Serial.print(XPWM   );
   //Serial.print("     ");
   //Serial.print(   YPWM);
   //Serial.println();
   //delay(100);
   }
   if (cmx > 40 && cmy < 40){
   int YPWM = cmy + 30 + 180;
   int XPWM = 50;
   analogWrite(PWM1, XPWM);
   analogWrite(PWM2, YPWM);
   digitalWrite(PUENTEH1, LOW);
   digitalWrite(PUENTEH2, HIGH);
   digitalWrite(PUENTEH3, LOW);
   digitalWrite(PUENTEH4, HIGH);
   servo.attach(13);
   servo.write(125);              // tell servo to go to position in variable 'pos'
   delay(180);                   // waits 15ms for the servo to reach the position
   //Serial.println("Derecha");
   //Serial.print(cmx);
   //Serial.print("cm   ");
   //Serial.print(cmy);
   //Serial.print("cm   ");
   //Serial.print(XPWM   );
   //Serial.print("     ");
   //Serial.print(   YPWM);
   //Serial.println();
   //delay(100);
   }
   if (cmx >= 60 && cmy >= 60){
   int XPWM = 124;
   int YPWM = 124;
   analogWrite(PWM1, XPWM);
   analogWrite(PWM2, YPWM);
   digitalWrite(PUENTEH1, LOW);
   digitalWrite(PUENTEH2, HIGH);
   digitalWrite(PUENTEH3, LOW);
   digitalWrite(PUENTEH4, HIGH);
   servo.attach(13);
   servo.write(90);              // tell servo to go to position in variable 'pos'
   delay(180);                   // waits 15ms for the servo to reach the position
   //Serial.print("Centro");
   //Serial.print(cmx);
   //Serial.print("cm   ");
   //Serial.print(cmy);
   //Serial.print("cm   ");
   //Serial.print(XPWM   );
   //Serial.print("     ");
   //Serial.print(   YPWM);
   //Serial.println();
   //delay(100);
   }
   if (cmz <= 100){
   int ZPWM = 255;
   analogWrite(PWM3, ZPWM);
   }
   if (cmz >= 150){
   int ZPWM = 124;
   analogWrite(PWM3, ZPWM);
   }
}

long microsecondsToCentimeters(long microseconds)
{
   // The speed of sound is 340 m/s or 29 microseconds per centimeter.
   // The ping travels out and back, so to find the distance of the
   // object we take half of the distance travelled.
   return microseconds / 29 / 2;
}

long microsecondsToCentimeters1(long microseconds)
{
   // The speed of sound is 340 m/s or 29 microseconds per centimeter.
   // The ping travels out and back, so to find the distance of the
   // object we take half of the distance travelled.
   return microseconds / 29 / 2;
}

long microsecondsToCentimeters2(long microseconds)
{
   // The speed of sound is 340 m/s or 29 microseconds per centimeter.
   // The ping travels out and back, so to find the distance of the
   // object we take half of the distance travelled.
   return microseconds / 29 / 2;
}


SE HACE UNA MEDICION DE LOS SONARES, SI SE DETECTA UNA SEÑAL MENOR A 40 CM COMENZARA A MODIFICARSE EL CICLO DE TRABAJO DEL MOTOR Y GIRARA LA DIRECCION CONTROLADA POR UN SERVO.

EJEMPLO:

SI EL SENSOR X DETECTA UNA DISTANCIA MENOR A 40 CM, EL SERVO GIRA A SU DERECHA 45 GRADOS, EL MOTOR CORRESPONDIENTE AUMENTA SU PWM A 255 Y EL OTRO MOTOR BAJA SU POTENCIA A 50. UNA VEZ LIBRADO EL OBSTACULO LOS DOS MOTORES REGRESAN A UN PWM DE 124 Y EL SERVO AL ORIGEN. EN CASO DE QUE EL SENSOR Y DETECTE LO MENCIONADO AL INICIO PASA LO MISMO SOLO QUE LOS MOTORES INVIERTEN SU FUNCION Y EL SERVO GIRA 45 GRADOS EN DIRECCION A LA IZQUIERDA.

RECOMENDACIONES:

NOSOTROS NOS ENCONTRAMOS CON CIERTOS PROBLEMAS AL CONECTAR LOS MOTORES, ESTOS NO SE PODIAN QUEDAR SIN POTENCIA POR QUE LA CORRIENTE QUE RECIBIAN DESDE UN INICIO NO ERA LA MISMA QUE AL YA ESTAR EN MARCHA TODO EL SISTEMA. ESTO DERIVADO DE LOS PICOS DE CORRIENTE EN LOS MOTORES DE DC. TAMBIÉN DEBERAN SER MUY CUIDADOSOS EN EL ANGULO QUE LE MANDAN AL SERVO Y CHECAR LA VELOCIDAD CON QUE LO REALIZA. UTILIZAR FUENTES INDEPENDIENTES ES LO MEJOR Y EVITAR EL MAYOR PESO POSIBLE.

miércoles, 25 de agosto de 2010

Libro de Intel 8051

The 8051 Microcontroller and Embedded Systems Using Assembly and C
Second Edition
Muhammad Ali Mazidi, Janice Gillispie Mazidi, Rolin D. McKinlay




Esta es la puerta de entrada al mundo de los microcontroladores. En este libro encontraras conceptos de lenguaje binario-hexadecimal, memorias, seriales, todo sobre el desarrollo de los microcontroladores.

El contenido del libro es:


􀂈 Introduction to Computing
􀂈 The 8051 Microcontrollers
􀂈 8051 Assembly Language Programming
􀂈 Branch Instructions
􀂈 I/O Port Programming
􀂈 8051 Addressing Modes
􀂈 Arithmetic & Logic Instructions And Programs
􀂈 8051 Programming in C
􀂈 8051 Hardware Connection and Hex File
􀂈 8051 Timer/Counter Programming in Assembly and C
􀂈 8051 Serial Port Programming in Assembly and C
􀂈 Interrupts Programming in Assembly and C
􀂈 8051 Interfacing to External Memory
􀂈 8051 Real World Interfacing I: LCD,ADC AND SENSORS
􀂈 LCD and Keyboard Interfacing
􀂈 8051 Interfacing with 8255

El libro esta en inglés pero muy completo para tener los conceptos teóricos esta muy bien.

Descarga el libro

Convertidor de analógico a digital; primera aproximación. ADC0804

Hola el día de hoy nos toca alambrar el circuito de prueba, para un convertidor de analógico a digital (ADC0804).....El diagrama se ve de la siguiente forma:

Material:

- ADC0804...
http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS005671.PDF
- 8 Resistencias de 330 ohms y 1 de 10K
- 8 LED's
- 2 capacitores de 0.1 uF
- 1 capacitor de 100 pF
- Fuente triple

El circuito se alambra tal y como se ve en el diagrama no debe haber ninguna modificación. Pero dejo algunas recomendaciones muy practicas.

1. Ser muy cuidadosos al momento de conectar el voltaje de referencia en el PIN 9...Este va dividido entre dos, es decir, para que tu circuito funcione debes de conectar 2.5 volts fijos a esa entrada.

2. La alimentación a todos los LED's debe ser de 5 volts fijos; esta no debe cambiar y otra cosa es independiente de las demás alimentaciones....ojo necesitaras una fuente triple.....

3. El voltaje de la entrada 6, sera el único regulable, pero no deberá exceder los 5.3 volts (de lo contrarios se quemará tu ADC)

Mucho éxito con tu circuito.

jueves, 19 de agosto de 2010

Puente H con relevadores

El día de hoy nos toca dar entrada a un circuito que nos permitira mover motores de corriente directa. Esta implementación sera capaz de hacer que el motor gire hacia la derecha o a la izquierda.......

Este es el diagrama de conexíón del circuito.

La bobina "A" debe de tener el mismo voltaje que la boina "D" y la "B" debe estar conectada al mismo voltaje que la "C" (PARA HACER ESTE TIPO DE CONEXIONES SUGERIMOS USAR CAIMANES-CAIMANES)

Es importante mencionar que los relevadores tienen una configuración dada por su fabricante, la cual es la siguiente:




Una vez identificado todo esto es muy fácil conectarlo....(EVITEN EL PROTOBOARD ES COMPLICADO).....

Precios Steren

-Relevador RAS-0510      $ 14.00
-Motor                              $ 22.00
-Caimanes                          $ 4.00

Un saludo.....