Arduino Forum

Using Arduino => Sensors => Topic started by: francesco28 on May 19, 2018, 11:30 pm

Title: Bmp280
Post by: francesco28 on May 19, 2018, 11:30 pm
Hi, I'm trying to create a weather station with Arduino uno, shield ethernet and bme280 but it won't work.
Title: Re: Bmp280
Post by: TolpuddleSartre on May 19, 2018, 11:51 pm
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.
Title: Re: Bmp280
Post by: gwareloth on May 20, 2018, 08:59 am
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 (https://learn.adafruit.com/adafruit-bmp280-barometric-pressure-plus-temperature-sensor-breakout/overview).

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


(http://forum.arduino.cc/index.php?action=dlattach;topic=548444.0;attach=258632)
Title: Re: Bmp280
Post by: slipstick on May 20, 2018, 10:02 am
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
Title: Re: Bmp280
Post by: francesco28 on May 20, 2018, 11:26 am
(https://www.makerfabs.com/image/cache/makerfabs/BMP280%20Barometer/BMP280%20Barometer_1-1000x750.jpg)


I connected the pin of the bmp280 sensor like this:

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?
Title: Re: Bmp280
Post by: gwareloth on May 20, 2018, 11:39 am
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.
Title: Re: Bmp280
Post by: francesco28 on May 20, 2018, 11:42 am
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
Title: Re: Bmp280
Post by: TolpuddleSartre on May 20, 2018, 01:50 pm
Does the board have level shifters on it? It is hard to tell from only a rear-view.
Title: Re: Bmp280
Post by: MorganS on May 21, 2018, 12:34 am
How long are the wires? I2C cannot go long distances. More than 3 feet will require some effort.
Title: Re: Bmp280
Post by: floresta on May 21, 2018, 01:35 am
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