Introduction: Como Encontrar La Temperatura De Un BMP 180 En Una Pantalla LCD?

En este tritural se hallará la forma en la que puedes encontrar la temperatura de un BMP 180 e Arduino. También les enseñaré usar la pantalla LCD. De esta forma podremos encontrar la temperatura con estos dos materiales como base.

Step 1: Primero Se Debe Hacer El Montaje De Arduino, Usando Los Siguientes Materiales:

1. Arduino

2. Protoboard grande

3. Pantalla LCD

4. BMP soldado

5. Suficientes Cables

Step 2: Con Estos Materiales Se Realizará El Montaje. Este Llevara Una Estructura Como Esta:

Step 3: Después De Tener El Montaje, Se Conecta Con Un Cable Como El Que Se Usa Para La Impresora.

Al ya haber tenido el montaje se debe mandar el código.Si su propocito no es encontrar la temperatura, debe cambiar una pequeña parte de este código, pero no sera in gran cambio. Para encontrar la temperatura seria algo así:

#include
#include

#include

// You will need to create an SFE_BMP180 object, here called "pressure":


SFE_BMP180 pressure;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

double baseline; // baseline pressure

void setup()

{

Serial.begin(9600);

Serial.println("REBOOT");

lcd.begin(16, 2);

// Initialize the sensor (it is important to get calibration values stored on the device).

if (pressure.begin())

lcd.println("BMP180 init success"); else

{

// Oops, something went wrong, this is usually a connection problem,

// see the comments at the top of this sketch for the proper connections.

Serial.println("BMP180 init fail (disconnected?)\n\n");

while(1); // Pause forever.

}

// Get the baseline pressure:

baseline = getPressure();

lcd.setCursor(0, 1);

Serial.print("baseline pressure: ");

Serial.print(baseline);

Serial.println(" mb"); }

void loop()

{

double a,P;

// Get a new pressure reading:

P = getPressure();

// Show the relative altitude difference between

// the new reading and the baseline reading:

a = pressure.altitude(P,baseline);

lcd.print("relative altitude: ");

if (a >= 0.0) lcd.print(" ");

// add a space for positive numbers lcd.print(a,1);

lcd.print(" meters, "); if (a >= 0.0) Serial.print(" ");

// add a space for positive numbers lcd.print(a*3.28084,0);

lcd.println(" feet"); delay(500);

}

double getPressure()

{

char status;

double T,P,p0,a;

// You must first get a temperature measurement to perform a pressure reading.

// Start a temperature measurement:

// If request is successful, the number of ms to wait is returned.

// If request is unsuccessful, 0 is returned.

status = pressure.startTemperature();

if (status != 0)

{

// Wait for the measurement to complete:

delay(status);

// Retrieve the completed temperature measurement:

// Note that the measurement is stored in the variable T.

// Use '&T' to provide the address of T to the function.

// Function returns 1 if successful, 0 if failure.

status = pressure.getTemperature(T);

if (status != 0)

{

// Start a pressure measurement:

// The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).

// If request is successful, the number of ms to wait is returned.

// If request is unsuccessful, 0 is returned.

status = pressure.startPressure(3);

if (status != 0)

{

// Wait for the measurement to complete:

delay(status);

// Retrieve the completed pressure measurement:

// Note that the measurement is stored in the variable P.

// Use '&P' to provide the address of P.

// Note also that the function requires the previous temperature measurement (T).

// (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)

// Function returns 1 if successful, 0 if failure.

status = pressure.getPressure(P,T);

if (status != 0)

{

return(P);

}

else lcd.println("error retrieving pressure measurement\n");

}

else lcd.println("error starting pressure measurement\n");

}

else lcd.println("error retrieving temperature measurement\n");

}

else lcd.println("error starting temperature measurement\n");

}

Step 4:

Espero que les aya funcionado. Si necesitan algo, no me lo pregunten que yo o se más.

Comments

author
saravp (author)2017-02-13

wow !!!! Eres la mejor!!!! No he encontrado uno tan bueno como el tuyo