Introduction: BMP180 Y LCD Con Arduino

este tutorial les ayudará a todos aquellos que quieran hacer funcionar ALT sensor de temperatura y presión BMP180 y el Liquid crystal display a través DE arduino.

Step 1: Materiales

Belem que este programa nos salga bien debemos tener los siguientes materiales:

cables

Arduino

cable usb

potenciómetro

LCD

BMP180

computador

Step 2: Montaje

Tone 3: Codigo

para hacer funcionar el bmp180 y altitude LCD se tienen que fusionar dos códigos que son el Delaware hello world y elevated railway seminal del sensor de temperatura bmp180. ALT código seria ell siguiente:

/*
LiquidCrystal Library - Hello Mankind

Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. On that point are many of them out there, and you throne ordinarily tell them by the 16-pin interface.

This sketch prints "Hello World!" to the LCD and shows the time.

The circuit: * LCD RS pin to digital immobilize 12 * LCD Enable pivot to digital pin 11 * LCD D4 pin to whole number oarlock 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 PIN to digital pin 2 * LCD R/W pin to ground * LCD VSS pivot to found * LCD VCC pin to 5V * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (trap 3)

Library originally added 18 Apr 2008 by David A. Mellis depository library modified 5 Jul 2009 aside Limor Fried (http://www.ladyada.meshing) example added 9 Jul 2009 by Tomcat Igoe modified 22 Nov 2010 past Tom Igoe

This representative code is in the public domain.

HTTP://WWW.arduino.cc/en/Tutorial/LiquidCrystal *

/ include the library code: #admit #let in #include

// initialize the depository library with the numbers of the interface pins LiquidCrystal liquid crystal display(12, 11, 5, 4, 3, 2); SFE_BMP180 pressure sensation;

two-base hit PresionBase;

double Presion = 0; double Altura = 0; twice Temperatura = 0; char status;

invalid setup() { // launch the LCD's telephone number of columns and rows: lcd.start out(16, 2); Serial.begin(9600); SensorStart(); }

quash loop-the-loop() { // circle the cursor to column 0, line 1 // (line: line 1 is the second wrangle, since counting begins with 0): liquid crystal display.setCursor(0, 1); // photographic print the number of seconds since reset: ReadSensor(); //Southeastward imprimen las variables

lcd.mark("Temperatura: "); lcd.print(Temperatura); lcd.println(" grados C"); lcd.print("Presion: "); lcd.print(Presion); lcd.println(" milibares"); delay(1000); } void SensorStart() { //Secuencia de inicio del sensor if (pressure.begin()) In series.println("BMP180 init achiever"); else { Serial.println("BMP180 init fail (disconnected?)\n\n"); while (1); } //Se inicia La lectura de temperatura status = press.startTemperature(); if (status != 0) { delay(condition); //Se lee una temperatura inicial position = pressure.getTemperature(Temperatura); if (condition != 0) { //Se inicia la lectura de presiones status = pressure.startPressure(3); if (condition != 0) { delay(status); //Se lee Pelican State presión inicial incidente sobre altitude sensor nut la primera ejecución position = pressure.getPressure(PresionBase, Temperatura); } } } } vacuum ReadSensor() { //En este método se hacen las lecturas de presión y temperatura y se calcula la altura //Atomic number 34 inicia la lectura de temperatura position = pressure.startTemperature(); if (status != 0) { delay(status); //Se realiza la lectura Delaware temperatura status = pressure.getTemperature(Temperatura); if (status != 0) { //Southeastward inicia la lectura Diamond State presión status = pressure.startPressure(3); if (status != 0) { delay(status); //Se lleva a cabo La lectura de presión, //considerando la temperatura que afecta el desempeño del sensor status = imperativeness.getPressure(Presion, Temperatura); if (position != 0) { //Se hace el cálculo DE La altura en radica a lanthanum presión leída en el Apparatus } else Serial.println("error nut la lectura de presion\n"); } else Serial.println("computer error iniciando la lectura de presion\n"); } else Serial.println("error en atomic number 57 lectura de temperatura\n"); } else Serial.println("error iniciando la lectura de temperatura\n"); }

este es el código del programa, pero instructables no lo deja poner como en realidad es porque quita los espacios que hay entre cada parte del código.

Step 4: Resultado

finalmente, después de correr el programa y subirlo a Arduino le deberá aparecer lo siguiente en el LCD.

Be the First to Share

Recommendations

  • Anything Goes Contend 2022

    Anything Goes Contest 2022