hackerspace-silesia / Smogomierz

Smogly(formerly: Smogomierz) - simple and cheap PM 2.5 and PM10 sensor based on NodeMCU (ESP8266) or ESP32
Apache License 2.0
123 stars 38 forks source link

Smogomierz nie podaje danych z BME280 cd. #16

Closed opennas closed 5 years ago

opennas commented 5 years ago

Mam czujnik BME280 wilgotności temperatury oraz ciśnienia i podłączony mam 4 kabelkami z wykorzystaniem SCL i SDA.

Zgodnie z rekomendacją wdo sprawdzenia adresu BME280 wykorzystałem kod https://playground.arduino.cc/Main/I2cScanner i zmieniłem Serial.begin(9600); na Serial.begin(115200);

Zmieniłem na nowy zarówno kontroler NodeMCU v3 + moduł WiFi ESP8266 jak i również czujnik BME280. Wszystko połączone jest zgodnie ze schematem i opisem.

Nie wiem co może być przyczyną tego problemu i proszę o pomoc, bo chwilowo wyczerpały mi się pomysły.

20:16:21.928 -> Scanning... 20:16:21.928 -> Unknown error at address 0x01 20:16:21.928 -> Unknown error at address 0x02 20:16:21.928 -> Unknown error at address 0x03 20:16:21.962 -> Unknown error at address 0x04 20:16:21.962 -> Unknown error at address 0x05 20:16:21.962 -> Unknown error at address 0x06 20:16:21.962 -> Unknown error at address 0x07 20:16:21.962 -> Unknown error at address 0x08 20:16:21.962 -> Unknown error at address 0x09 20:16:21.962 -> Unknown error at address 0x0A 20:16:21.962 -> Unknown error at address 0x0B 20:16:21.962 -> Unknown error at address 0x0C 20:16:21.962 -> Unknown error at address 0x0D 20:16:21.962 -> Unknown error at address 0x0E 20:16:21.962 -> Unknown error at address 0x0F 20:16:21.962 -> Unknown error at address 0x10 20:16:21.995 -> Unknown error at address 0x11 20:16:21.995 -> Unknown error at address 0x12 20:16:21.995 -> Unknown error at address 0x13 20:16:21.995 -> Unknown error at address 0x14 20:16:21.995 -> Unknown error at address 0x15 20:16:21.995 -> Unknown error at address 0x16 20:16:21.995 -> Unknown error at address 0x17 20:16:21.995 -> Unknown error at address 0x18 20:16:21.995 -> Unknown error at address 0x19 20:16:21.995 -> Unknown error at address 0x1A 20:16:21.995 -> Unknown error at address 0x1B 20:16:21.995 -> Unknown error at address 0x1C 20:16:22.029 -> Unknown error at address 0x1D 20:16:22.029 -> Unknown error at address 0x1E 20:16:22.029 -> Unknown error at address 0x1F 20:16:22.029 -> Unknown error at address 0x20 20:16:22.029 -> Unknown error at address 0x21 20:16:22.029 -> Unknown error at address 0x22 20:16:22.029 -> Unknown error at address 0x23 20:16:22.029 -> Unknown error at address 0x24 20:16:22.029 -> Unknown error at address 0x25 20:16:22.029 -> Unknown error at address 0x26 20:16:22.029 -> Unknown error at address 0x27 20:16:22.029 -> Unknown error at address 0x28 20:16:22.063 -> Unknown error at address 0x29 20:16:22.063 -> Unknown error at address 0x2A 20:16:22.063 -> Unknown error at address 0x2B 20:16:22.063 -> Unknown error at address 0x2C 20:16:22.063 -> Unknown error at address 0x2D 20:16:22.063 -> Unknown error at address 0x2E 20:16:22.063 -> Unknown error at address 0x2F 20:16:22.063 -> Unknown error at address 0x30 20:16:22.063 -> Unknown error at address 0x31 20:16:22.063 -> Unknown error at address 0x32 20:16:22.063 -> Unknown error at address 0x33 20:16:22.063 -> Unknown error at address 0x34 20:16:22.063 -> Unknown error at address 0x35 20:16:22.097 -> Unknown error at address 0x36 20:16:22.097 -> Unknown error at address 0x37 20:16:22.097 -> Unknown error at address 0x38 20:16:22.097 -> Unknown error at address 0x39 20:16:22.097 -> Unknown error at address 0x3A 20:16:22.097 -> Unknown error at address 0x3B 20:16:22.097 -> Unknown error at address 0x3C 20:16:22.097 -> Unknown error at address 0x3D 20:16:22.097 -> Unknown error at address 0x3E 20:16:22.097 -> Unknown error at address 0x3F 20:16:22.097 -> Unknown error at address 0x40 20:16:22.097 -> Unknown error at address 0x41 20:16:22.130 -> Unknown error at address 0x42 20:16:22.130 -> Unknown error at address 0x43 20:16:22.130 -> Unknown error at address 0x44 20:16:22.130 -> Unknown error at address 0x45 20:16:22.130 -> Unknown error at address 0x46 20:16:22.130 -> Unknown error at address 0x47 20:16:22.130 -> Unknown error at address 0x48 20:16:22.130 -> Unknown error at address 0x49 20:16:22.130 -> Unknown error at address 0x4A 20:16:22.130 -> Unknown error at address 0x4B 20:16:22.130 -> Unknown error at address 0x4C 20:16:22.130 -> Unknown error at address 0x4D 20:16:22.130 -> Unknown error at address 0x4E 20:16:22.130 -> Unknown error at address 0x4F 20:16:22.164 -> Unknown error at address 0x50 20:16:22.164 -> Unknown error at address 0x51 20:16:22.164 -> Unknown error at address 0x52 20:16:22.164 -> Unknown error at address 0x53 20:16:22.164 -> Unknown error at address 0x54 20:16:22.164 -> Unknown error at address 0x55 20:16:22.164 -> Unknown error at address 0x56 20:16:22.164 -> Unknown error at address 0x57 20:16:22.164 -> Unknown error at address 0x58 20:16:22.164 -> Unknown error at address 0x59 20:16:22.164 -> Unknown error at address 0x5A 20:16:22.164 -> Unknown error at address 0x5B 20:16:22.198 -> Unknown error at address 0x5C 20:16:22.198 -> Unknown error at address 0x5D 20:16:22.198 -> Unknown error at address 0x5E 20:16:22.198 -> Unknown error at address 0x5F 20:16:22.198 -> Unknown error at address 0x60 20:16:22.198 -> Unknown error at address 0x61 20:16:22.198 -> Unknown error at address 0x62 20:16:22.198 -> Unknown error at address 0x63 20:16:22.198 -> Unknown error at address 0x64 20:16:22.198 -> Unknown error at address 0x65 20:16:22.198 -> Unknown error at address 0x66 20:16:22.198 -> Unknown error at address 0x67 20:16:22.233 -> Unknown error at address 0x68 20:16:22.233 -> Unknown error at address 0x69 20:16:22.233 -> Unknown error at address 0x6A 20:16:22.233 -> Unknown error at address 0x6B 20:16:22.233 -> Unknown error at address 0x6C 20:16:22.233 -> Unknown error at address 0x6D 20:16:22.233 -> Unknown error at address 0x6E 20:16:22.233 -> Unknown error at address 0x6F 20:16:22.233 -> Unknown error at address 0x70 20:16:22.233 -> Unknown error at address 0x71 20:16:22.233 -> Unknown error at address 0x72 20:16:22.233 -> Unknown error at address 0x73 20:16:22.233 -> Unknown error at address 0x74 20:16:22.266 -> Unknown error at address 0x75 20:16:22.266 -> Unknown error at address 0x76 20:16:22.266 -> Unknown error at address 0x77 20:16:22.266 -> Unknown error at address 0x78 20:16:22.266 -> Unknown error at address 0x79 20:16:22.266 -> Unknown error at address 0x7A 20:16:22.266 -> Unknown error at address 0x7B 20:16:22.266 -> Unknown error at address 0x7C 20:16:22.266 -> Unknown error at address 0x7D 20:16:22.266 -> Unknown error at address 0x7E 20:16:22.266 -> No I2C devices found 20:16:22.266 ->

bfaliszek commented 5 years ago

Wygląda jakby BME280 było uszkodzone

firemark commented 5 years ago

Pytanie durne - czy dobrze podłączyłeś zasilanie? :)

opennas commented 5 years ago

Po pierwszej próbie nie byłem pewny czy jest sprawny BM280, więc zakupiłem kolejny zestaw. Z tego powodu trwało chwilę zanim odpowiedziałem.

Złożyłem z nowych części drugi egzemplarz Smogomierza i podłączyłem BM280 zgodnie z instrukcją 3X sprawdzając.

BM280 - NodeMcu V3

VCC - 3V GND - G SCL - D4 SDA - D3

Kod

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>

void setup()
{
  Wire.begin();

  Serial.begin(115200);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}

void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}
bfaliszek commented 5 years ago

a sprawdź na D1 i D2? Jeśli samemu kompilujesz kod w ArduinoIDE to daj znać też jaką masz wersję ESP8266core najnowsza to 2.5.0 beta 3 i w tych betach może coś nie działać(np. SoftwareSerial).

opennas commented 5 years ago

Po odłączeniu D1 i D2 z projektu Smogomierz i podłączeniu BME280

VCC - 3V GND - G SCL - D2 SDA - D1

nawet gorzej bo nie wykrywał nic, a poprzednio na D3,D4 skanował adresy.

22:30:30.391 -> Scanning... 22:30:30.425 -> No I2C devices found 22:30:30.425 -> 22:30:35.402 -> Scanning... 22:30:35.435 -> No I2C devices found 22:30:35.435 ->

a poprzednio na D3,D4 skanował adresy.

20:16:21.928 -> Unknown error at address 0x01 ... 20:16:22.266 -> Unknown error at address 0x7E

ESP8266 mam teraz w wersji 2.4.2.

bfaliszek commented 5 years ago

To jeszcze ostatnie pytanie. Na pewno masz wybraną płytkę NodeMCU 1.0? To chyba jeszcze ostatnia opcja jaka została. Jeśli tak, to chyba masz po prostu wadliwe BME280, które nie działa.

opennas commented 5 years ago

Włączona opcja NodeMCU 1.0 (ESP-12E Module) i sprawdzałem dwa czujniki BME280. Jeszcze mam trzeci, ale muszę wlutować piny. Zakupiłem dwa pełne zestawy Smogomierza i testowałem na dwóch płytkach NodeMCU.

Kompilacja programu I2cScanner.ino dla testu I2C nie ma żadnego błędu :) Nadal nie odnaleziono I2C :(

opennas commented 5 years ago

Kabel USB mam podłączony do komputera z jednej a do NodeMCU z drugiej. Po zaprogramowaniu mogę oglądać monitor portu szeregowego, ale nie mam podłączonego zasilania Smogomierza w dedykowanym konektorze.

Wynik na porcie szeregowym:

19:41:27.985 -> Scanning...
19:41:27.985 -> Unknown error at address 0x01
19:41:27.985 -> Unknown error at address 0x02
19:41:27.985 -> Unknown error at address 0x03
19:41:27.985 -> Unknown error at address 0x04
19:41:27.985 -> Unknown error at address 0x05
19:41:27.985 -> Unknown error at address 0x06
19:41:27.985 -> Unknown error at address 0x07
19:41:27.985 -> Unknown error at address 0x08
19:41:28.019 -> Unknown error at address 0x09
19:41:28.019 -> Unknown error at address 0x0A
19:41:28.019 -> Unknown error at address 0x0B
19:41:28.019 -> Unknown error at address 0x0C
19:41:28.019 -> Unknown error at address 0x0D
19:41:28.019 -> Unknown error at address 0x0E
19:41:28.019 -> Unknown error at address 0x0F
19:41:28.019 -> Unknown error at address 0x10
19:41:28.019 -> Unknown error at address 0x11
19:41:28.019 -> Unknown error at address 0x12
19:41:28.019 -> Unknown error at address 0x13
19:41:28.019 -> Unknown error at address 0x14
19:41:28.019 -> Unknown error at address 0x15
19:41:28.052 -> Unknown error at address 0x16
19:41:28.052 -> Unknown error at address 0x17
19:41:28.052 -> Unknown error at address 0x18
19:41:28.052 -> Unknown error at address 0x19
19:41:28.052 -> Unknown error at address 0x1A
19:41:28.052 -> Unknown error at address 0x1B
19:41:28.052 -> Unknown error at address 0x1C
19:41:28.052 -> Unknown error at address 0x1D
19:41:28.052 -> Unknown error at address 0x1E
19:41:28.052 -> Unknown error at address 0x1F
19:41:28.052 -> Unknown error at address 0x20
19:41:28.052 -> Unknown error at address 0x21
19:41:28.086 -> Unknown error at address 0x22
19:41:28.086 -> Unknown error at address 0x23
19:41:28.086 -> Unknown error at address 0x24
19:41:28.086 -> Unknown error at address 0x25
19:41:28.086 -> Unknown error at address 0x26
19:41:28.086 -> Unknown error at address 0x27
19:41:28.086 -> Unknown error at address 0x28
19:41:28.086 -> Unknown error at address 0x29
19:41:28.086 -> Unknown error at address 0x2A
19:41:28.086 -> Unknown error at address 0x2B
19:41:28.086 -> Unknown error at address 0x2C
19:41:28.086 -> Unknown error at address 0x2D
19:41:28.121 -> Unknown error at address 0x2E
19:41:28.121 -> Unknown error at address 0x2F
19:41:28.121 -> Unknown error at address 0x30
19:41:28.121 -> Unknown error at address 0x31
19:41:28.121 -> Unknown error at address 0x32
19:41:28.121 -> Unknown error at address 0x33
19:41:28.121 -> Unknown error at address 0x34
19:41:28.121 -> Unknown error at address 0x35
19:41:28.121 -> Unknown error at address 0x36
19:41:28.121 -> Unknown error at address 0x37
19:41:28.121 -> Unknown error at address 0x38
19:41:28.121 -> Unknown error at address 0x39
19:41:28.121 -> Unknown error at address 0x3A
19:41:28.121 -> Unknown error at address 0x3B
19:41:28.154 -> Unknown error at address 0x3C
19:41:28.154 -> Unknown error at address 0x3D
19:41:28.154 -> Unknown error at address 0x3E
19:41:28.154 -> Unknown error at address 0x3F
19:41:28.154 -> Unknown error at address 0x40
19:41:28.154 -> Unknown error at address 0x41
19:41:28.154 -> Unknown error at address 0x42
19:41:28.154 -> Unknown error at address 0x43
19:41:28.154 -> Unknown error at address 0x44
19:41:28.154 -> Unknown error at address 0x45
19:41:28.154 -> Unknown error at address 0x46
19:41:28.154 -> Unknown error at address 0x47
19:41:28.187 -> Unknown error at address 0x48
19:41:28.187 -> Unknown error at address 0x49
19:41:28.187 -> Unknown error at address 0x4A
19:41:28.187 -> Unknown error at address 0x4B
19:41:28.187 -> Unknown error at address 0x4C
19:41:28.187 -> Unknown error at address 0x4D
19:41:28.187 -> Unknown error at address 0x4E
19:41:28.187 -> Unknown error at address 0x4F
19:41:28.187 -> Unknown error at address 0x50
19:41:28.187 -> Unknown error at address 0x51
19:41:28.187 -> Unknown error at address 0x52
19:41:28.187 -> Unknown error at address 0x53
19:41:28.187 -> Unknown error at address 0x54
19:41:28.221 -> Unknown error at address 0x55
19:41:28.221 -> Unknown error at address 0x56
19:41:28.221 -> Unknown error at address 0x57
19:41:28.221 -> Unknown error at address 0x58
19:41:28.221 -> Unknown error at address 0x59
19:41:28.221 -> Unknown error at address 0x5A
19:41:28.221 -> Unknown error at address 0x5B
19:41:28.221 -> Unknown error at address 0x5C
19:41:28.221 -> Unknown error at address 0x5D
19:41:28.221 -> Unknown error at address 0x5E
19:41:28.221 -> Unknown error at address 0x5F
19:41:28.221 -> Unknown error at address 0x60
19:41:28.255 -> Unknown error at address 0x61
19:41:28.255 -> Unknown error at address 0x62
19:41:28.255 -> Unknown error at address 0x63
19:41:28.255 -> Unknown error at address 0x64
19:41:28.255 -> Unknown error at address 0x65
19:41:28.255 -> Unknown error at address 0x66
19:41:28.255 -> Unknown error at address 0x67
19:41:28.255 -> Unknown error at address 0x68
19:41:28.255 -> Unknown error at address 0x69
19:41:28.255 -> Unknown error at address 0x6A
19:41:28.255 -> Unknown error at address 0x6B
19:41:28.255 -> Unknown error at address 0x6C
19:41:28.290 -> Unknown error at address 0x6D
19:41:28.290 -> Unknown error at address 0x6E
19:41:28.290 -> Unknown error at address 0x6F
19:41:28.290 -> Unknown error at address 0x70
19:41:28.290 -> Unknown error at address 0x71
19:41:28.290 -> Unknown error at address 0x72
19:41:28.290 -> Unknown error at address 0x73
19:41:28.290 -> Unknown error at address 0x74
19:41:28.290 -> Unknown error at address 0x75
19:41:28.290 -> Unknown error at address 0x76
19:41:28.290 -> Unknown error at address 0x77
19:41:28.290 -> Unknown error at address 0x78
19:41:28.290 -> Unknown error at address 0x79
19:41:28.290 -> Unknown error at address 0x7A
19:41:28.325 -> Unknown error at address 0x7B
19:41:28.325 -> Unknown error at address 0x7C
19:41:28.325 -> Unknown error at address 0x7D
19:41:28.325 -> Unknown error at address 0x7E
19:41:28.325 -> No I2C devices found
19:41:28.325 -> 

Pomyślałem, że może aby działała I2C muszę dodatkowo podłączyć zasilanie i wtedy dopiero pojawi się zasilanie i będzie działać I2C?

Po po podłączeniu zasilania dodatkowo do zestawu i nadal podłączonym USD do NodeMCU wynik skanowania jesy tylko

19:40:26.206 -> Scanning...
19:40:26.240 -> No I2C devices found
19:40:26.240 -> 

Kombinuje dalej ale nie mogę dojść przyczyny braku działania BM280.

bfaliszek commented 5 years ago

masz po prostu wadliwe BME280, które nie działa.

🤷🏻‍♂️

opennas commented 5 years ago

Próbowałem już dwa BME280. Dzisiaj doszła trzecia sztuka BM280. Zaraz ją przygotuje i podłączę.

opennas commented 5 years ago

Teraz podłączyłem 3 sztukę BME280 i to samo :( Zakupiłem w Botland i teraz po sprawdzeniu 3 sztuki nie pozostaje mi nic innego jak napisać reklamacje. Mało prawdopodobne, aby w trzech wysyłkach tylko BME280 było 3X wadliwe.

opennas commented 5 years ago

Sukces, po resecie NodeMCU oraz ustawieniu SSID na sztywno. Zadziałał BME280 :)

Ciągle zastanawiam się co było przyczyną tego... (wygląda na to, że nie sam czujnik)

{ "device_name": "Smogomierz-C68890", "pm1": 19, "pm25": 31, "pm10": 37, "temperature": 23.3, "pressure": 1022, "humidity": 25, "dewpoint": 8.306054 }