Pessoal,
comprei o BMP085 aqui no Laboratório de Garagem e estou com um probleminha.
A função Calibration não consegue ser executada completamente. Quando chega no ponto abaixo
nada mais acontece. Mais precisamente nesse ponto
while(Wire.available()<2)
Verifiquei o conteudo de Wire.available() e é sempre zero
// Read 2 bytes from the BMP085
// First byte will be from 'address'
// Second byte will be from 'address'+1
int bmp085ReadInt(unsigned char address)
{
unsigned char msb, lsb;
Wire.beginTransmission(BMP085_ADDRESS);
Wire.write(address);
Wire.endTransmission();
Wire.requestFrom(BMP085_ADDRESS, 2);
Serial.println(Wire.available());
while(Wire.available()<2)
;
msb = Wire.read();
lsb = Wire.read();
return (int) msb8 | lsb;
}
Será que tem algum problema com o sensor?
Alguém sabe uma maneira de testá-lo?
Desde já agradeço qualquer dica.
Abraços.
Alexandre.
Tags:
Pessoal,
se eu uso esse Sketch formecido pela Adafruit
#include <Adafruit_BMP085.h>
//==============================================
#include <util/delay.h> //Needed by BMP085 library
#include "Adafruit_BMP085.h" //Library to control the BMP085
#include <Wire.h> //Needed by BMP085 library
Adafruit_BMP085 bmp; //create a BMP085 object
void setup() {
Serial.begin(9600); //Initialize the serial interface at 9600bps
bmp.begin(); //Initialize the sensor
}
void loop() {
//Read and print out the temperature
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");
//Read and print out the pressure
Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pa");
//Read and print out the altitude
Serial.print("Altitude = ");
Serial.print(bmp.readAltitude());
Serial.println(" Meters");
Serial.println();
delay(500); //Wait 500ms before next reading
}
Eu obtenho esse valores (errados)
Temperature = 0.00 *C
Pressure = 234 Pa
Altitude = 30367.23 Meters
Alguma ideia do que esteja ocorrendo?
Obrigado.
Alexandre.
Mostre pra nós como o esquema de ligação
VCC ligado 3.3V do Arduino
GND ligado no GND do arduino
SDA ligado no ANALOGIC IN A4 do arduino
SCL ligado no ANALOGIC IN A5 do arduino
Os outros 2 pinos do BMP085 eu deixei livre
A alimentação é via USB ligado no notebook
Sim.
Na função bmp085Calibration()
Quando o primeiro valor é passado para a função bmp085ReadInt()
ac1 = bmp085ReadInt(0xAA);
int bmp085ReadInt(unsigned char address)
{
unsigned char msb, lsb;
Wire.beginTransmission(BMP085_ADDRESS);
Wire.write(address);
Wire.endTransmission();
Wire.requestFrom(BMP085_ADDRESS, 2);
=====>>>> DAQUI PRA FRENTE NADA ACONTECE POIS Wire.available() É SEMPRE ZERO
while(Wire.available()<2)
;
msb = Wire.read();
lsb = Wire.read();
return (int) msb8 | lsb;
}
Será que o sensor está danificado?
Tem como testar esse sensor?
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por