Arduino UNO + ESP8266 (conflict with <Wire.h>)

Hi, I want connect Arduino + ESP8266 (module) + DHT11 + BMP180.

When I run the sketch withouth the library "<Wire.h>, I can send dato to Cayenne (Mydevices), but if I add the library, for BMP180, the sketch runs but stops instantly.

`#include <Wire.h>
#include <CayenneMQTTESP8266Shield.h>
#include <dht.h>
dht DHT;
#define DHT11_PIN 6
char ssid = “Moto”;
char wifiPassword = “1234567898”;
char username = “69f8c2b0-46ca-11ea-a38a-d57172a4b4d4”;
char password = “fa8e580b3e8adf4d400c731aa5e722202e3be649”;
char clientID = “7dd4fb50-47c9-11ea-ba7c-716e7f5ba423”;
#define EspSerial Serial

ESP8266 wifi(&EspSerial);

void setup()
{

// Set ESP8266 baud rate
Serial.begin(9600);
delay(10);

// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);

Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}

void loop(){
int chk = DHT.read11(DHT11_PIN);

Cayenne.loop();
Cayenne.virtualWrite(1, DHT.temperature ,TYPE_TEMPERATURE,UNIT_CELSIUS);
Cayenne.virtualWrite(2, DHT.humidity );
//Cayenne.virtualWrite(3, event.pressure );
//Cayenne.virtualWrite(4, bmp.pressureToAltitude(seaLevelPressure,event.pressure));
// Cayenne.virtualWrite(5,temperature );
}
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“Channel %u, value %s”, request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}`

When I can send data the serial (115200) said:

But when the sketch stops the serial said:

try powering esp from external power supply.

Yes, in the project, ESP8266, DHT11 and Bmp180 are powering to external supply, to simplify, I drew the diagram like this

can you disconnect all sensor and remove all sensor code and use the basic cayenne code and see if it gets disconnected as if you read at the every top it is mentioned that the code is not stable for arduino uno and is for arduino mega.

I used this code and this configuration in the page of cayenne for conect Arduino UNO + ESP8266 (ESP01), then I modified this code to write the code used for the projec:

`/*

This sketch connects to the Cayenne server using an ESP8266 WiFi module as a shield connected via a hardware serial to an Arduino.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:

  1. Install the ESP8266SerialLibrary.zip library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library) from the Cayenne extras/libraries
    folder (e.g. My Documents\Arduino\libraries\CayenneMQTT\extras\libraries) to compile this example.
  2. Connect the ESP8266 as a shield to your Arduino. This example uses the Serial1 hardware serial pins available on the Mega. You can also try
    using a software serial, though it may be less stable.
  3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
  4. Set the network name and password.
  5. Compile and upload the sketch.
  6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.

NOTE: This code requires ESP8266 firmware version 1.0.0 (AT v0.22) or later.
*/

//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>

// WiFi network info.
char ssid = “ssid”;
char wifiPassword = “wifiPassword”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “69f8c2b0-46ca-11ea-a38a-d57172a4b4d4”;
char password = “fa8e580b3e8adf4d400c731aa5e722202e3be649”;
char clientID = “f163e4f0-51ce-11ea-a38a-d57172a4b4d4”;

// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
#define EspSerial Serial1

ESP8266 wifi(&EspSerial);

void setup()
{
Serial.begin(9600);
delay(10);

// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);

Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);

}

void loop()
{
Cayenne.loop();
}

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
Cayenne.virtualWrite(0, millis());
// Some examples of other functions you can use to send data.
//Cayenne.celsiusWrite(1, 22.0);
//Cayenne.luxWrite(2, 700);
//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“Channel %u, value %s”, request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}`

this is what i mean.

How can I do this?:
imagen

the code is unstable for uno and cannot be done much if it gets disconnected.

So, is possible connect Arduino UNO with ESP8266?
Even with another code?

you can connect arduino mega with esp8266.