ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

DEPARTAMENTO DE ELECTRICA Y ELECTRONICA INSTRUMENTACIÓN Y SENSORES


Enviado por   •  20 de Mayo de 2018  •  Documentos de Investigación  •  920 Palabras (4 Páginas)  •  114 Visitas

Página 1 de 4

[pic 1]

DEPARTAMENTO DE ELECTRICA Y ELECTRONICA

INSTRUMENTACIÓN Y SENSORES

[pic 2]

NIVEL DE AGUA

     


[pic 3]

1. Objetivos:

 Realizar un sensor lineal de nivel de agua de 0 a 10 cm con la utilización de un

potenciómetro.

 Tomar datos y linealizarlos para poderlos mostrarlos en un LCD utilizando Arduino.

2. Codigo Arduino.

#include

//Giro

unsigned int counter=0;

unsigned int inicio;

int MOTOR=3;

int k;

long j;

int rotation;

int act;

//teclado

#include

char c;

String ting;

int i=0;

int ning=50;

const byte FILAS=4;

const byte COLUM=4;

//pines teclado

int c1=37;

int c2=35;

int c3=33;

int c4=31;

int f1=29;

int f2=27;

int f3=25;

int f4=23;

//Matriz teclado

char hexaKeys[FILAS][COLUM] =  //Aquí pondremos la disposición de los caracteres tal cual están en nuestro teclado

{

  {'1','2','3','A'},

  {'4','5','6','B'},

  {'7','8','9','C'},

  {'*','0','#','D'}

};

byte filasPines[FILAS] = {f1,f2,f3,f4}; //Seleccionamos los pines en el arduino donde iran conectadas las filas

byte columPines[COLUM] = {c1,c2,c3,c4}; //Seleccionamos los pines en el arduino donde iran conectadas las filas

Keypad teclado = Keypad(makeKeymap(hexaKeys),filasPines,columPines,FILAS,COLUM); //inicializa el teclado

int num=0;

void docount()  // counts from the speed sensor

{

  counter++;  // increase +1 the counter value

}

//lcd

#include // Incluye la Libreria LiquidCrystal

LiquidCrystal lcd(4,5,6,7,8,9); // Crea un Objeto LC. Parametros: (rs, enable, d4, d5, d6, d7)

void timerIsr()

{

  Timer1.detachInterrupt();  //stop the timer

  Serial.print("Velocidad del motor: ");

  rotation = (counter /20);  // divide by number of holes in Disc

  Serial.print(rotation,DEC);

  Serial.println(" RPS ");

  counter=0;  //  reset counter to zero

  act=rotation;

  Timer1.attachInterrupt( timerIsr );  //enable the timer

}

void setup() {

  //GIRO

  pinMode(MOTOR, OUTPUT);

  analogWrite(MOTOR,0);

  Timer1.initialize(1000000); // set timer for 1sec

  attachInterrupt(0, docount, RISING);  // increase counter when speed sensor pin goes High

  Timer1.attachInterrupt( timerIsr ); // enable the timer

  //TECLADO

  pinMode(23,INPUT);

  pinMode(25,INPUT);

  pinMode(27,INPUT);

  pinMode(29,INPUT);

  pinMode(31,INPUT);

  pinMode(33,INPUT);

  pinMode(35,INPUT);

  pinMode(37,INPUT);

  lcd.begin(16,2); // Inicializa la interface para el LCD screen, and determina sus dimensiones (ancho y alto) del display

 

}

int sp;

int pwmsp;

void loop(){

ingreso();

pwmsp=1.1181*sp+46.392;

   for(k=80; k

              ingreso();

              analogWrite(MOTOR, k);

              delay(100);  

    }

    j=k;

    do {  

             ingreso();

             analogWrite(MOTOR, j-1);

             delay(50);

...

Descargar como (para miembros actualizados)  txt (5 Kb)   pdf (247 Kb)   docx (178 Kb)  
Leer 3 páginas más »
Disponible sólo en Clubensayos.com