Go Down

Topic: Bmp280 (Read 283 times) previous topic - next topic

francesco28

May 19, 2018, 11:30 pm Last Edit: May 20, 2018, 12:17 pm by francesco28
Hi, I'm trying to create a weather station with Arduino uno, shield ethernet and bme280 but it won't work.

TolpuddleSartre

If you want more than just sympathy, you will have to post a whole lot more detail than that.

Just keep in mind that we can't see what you can, and we don't know what "won't work" means to you.

gwareloth

#2
May 20, 2018, 08:59 am Last Edit: May 20, 2018, 10:20 am by gwareloth
I don't have a BMP280, but have had great success with its predecessor the BMP180, basically using the adafruit example code. What code are you using?- adafruit has a tutorial and code for the 280 here.

Just for interest, the pic shows my output fed to adafruit's IoT MQTT site, using a nodemcu.



slipstick

Hi, I'm trying to create a weather station with Arduino uno, shield ethernet and bmp280 but it won't work.
I expect there's a problem with the code you're using or the way you have things connected. But it's just a guess.

Do you want to give us a bit more information to go on?

Steve

francesco28




I connected the pin of the bmp280 sensor like this:
  • VCC-->3,3V
  • GND-->GND
  • SCL-->12
  • SDA-->11
  • SDO-->GND

And this is the code:
Code: [Select]


#include "ThingSpeak.h"
#include <Wire.h>
#include <Adafruit_BMP085.h>  // la libreria Adafruit BMP085 funziona anche per il sensore BMP180
#include <SPI.h>
#include <Ethernet.h>

#define USE_ETHERNET_SHIELD


Adafruit_BMP085 bmp;

// Configurazione indirizzo mac della Ethernet shield
   byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
   EthernetClient client;


// inseriamo i valori del nostro canale Thingspeak

unsigned long myChannelNumber = ******;
const char * myWriteAPIKey = "********";


void setup() {
  // inizializziamo le componenti
  Ethernet.begin(mac);
  ThingSpeak.begin(client);
  bmp.begin();
}

void loop() {

 
    //ThingSpeak.setField(1,bmp.readTemperature());

   
    float temperatura = bmp.readTemperature();
    Serial.print("Temperatura");
    Serial.println(temperatura);
    ThingSpeak.setField(1,temperatura);
    float pressure_mb = (bmp.readPressure())/100; // diviso 100 per avere la lettura in millibar
    ThingSpeak.setField(2,pressure_mb);
   

   

  // Manda i valori che hai impostato tutti in una sola volta.
  ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); 

 delay(20000); // ThingSpeak accetterà solo aggiornamenti ogni 15 secondi.
}

There's something wrong with it?

gwareloth

Quote
I connected the pin of the bmp280 sensor like this:
VCC-->3,3V
GND-->GND
SCL-->12
SDA-->11

SDO-->GND
Those aren't I2C pins on a Uno, which are A4 (SDA) and A5 (SCL). Also duplicated next to the reset button.

francesco28

#6
May 20, 2018, 11:42 am Last Edit: May 20, 2018, 11:44 am by francesco28
Ok, now I changed the pin connection
VCC-->3,3V
GND-->GND
SCL-->A5
SDA-->A4
Now Arduino gives in output 0°C and 0 pressure

TolpuddleSartre

Does the board have level shifters on it? It is hard to tell from only a rear-view.

MorganS

How long are the wires? I2C cannot go long distances. More than 3 feet will require some effort.
"The problem is in the code you didn't post."

floresta

#9
May 21, 2018, 01:35 am Last Edit: May 21, 2018, 01:35 am by floresta
Quote
Code: [Select]
. . .
#include <Adafruit_BMP085.h>  // la libreria Adafruit BMP085 funziona anche per il sensore BMP180
. . .

Wouldn't you have more luck with the Adafruit BMP280 library?

Don

Go Up