For starters im using arduino UNO R4 with separate ESP 8266 module wired up via digital ports 2 and 3 and using Software Serial library. Im uploading the code to arduino using the ESP module for communication.
I ran in to problem where adding the BMP280 to my sketch stops the communication with Blynk and overall seems to stop the void loop execution. I already tested those sensors all together without blynk and in this scenario, when they just print to serial monitor, everything works fine. Another thing is that the BMP 280 sensor works in this very sketch I provided when all other sensors and lines of code relevant to them are commented out. As for the BMP 280 relevant lines the lines marked with “XX” are the ones that ultimatelly make this bug to appear. I tried using other libraries for BMP 280 but the problem remains the same.
All sensors are wired correctly. Every single one of them works fine while put in a sketch which is not using blynk and just prints them to serial monitor.
Is there any known conflict preventing blynk from using this sensor while combined with others? Or anything really that could be relevant to my problem.
#define BLYNK_TEMPLATE_ID "ID"
#define BLYNK_TEMPLATE_NAME "NAME"
#define BLYNK_AUTH_TOKEN "TOKEN"
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
//#include <Adafruit_BMP280.h>
#include <DHT.h>
#include <SoftwareSerial.h>
char ssid[] = "wifiname";
char pass[] = "wifipassword";
SoftwareSerial EspSerial(2, 3); // RX, TX
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
#define DHTPIN 13
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
//#define BMP280_ADDRESS 0x76 XX
//Adafruit_BMP280 bmp; XX
const int MQ135Pin = A0;
BlynkTimer timer;
///Global variables///
//double temperatureBMP = 5;
//double temperatureBMPreal = 5;
double pressure = 5;
double temperatureDHT = 5;
double humidity = 5;
int airQuality = 5;
void sendSensorData() {
//temperatureBMP = bmp.readTemperature();
//temperatureBMPreal = (temperatureBMP + 0.5);
//pressure = bmp.readPressure() / 100.0F;
temperatureDHT = dht.readTemperature();
humidity = dht.readHumidity();
airQuality = analogRead(MQ135Pin);
temperatureDHT = round(temperatureDHT * 10) / 10.0;
humidity = round(humidity * 10) / 10.0;
//temperatureBMPreal = round(temperatureBMPreal * 10) / 10.0;
//Blynk.virtualWrite(V0, temperatureBMPreal);
//Blynk.virtualWrite(V1, pressure);
Blynk.virtualWrite(V2, temperatureDHT);
Blynk.virtualWrite(V3, humidity);
Blynk.virtualWrite(V4, airQuality);
}
void setup() {
//init BMP280
//bmp.begin(BMP280_ADDRESS);
/// init DHT11 ///
dht.begin();
Serial.begin(115200);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass);
//timer set for sendSensorData
timer.setInterval(2000L, sendSensorData);
}
void loop() {
Blynk.run();
timer.run();
}