Arduino UNO + 8266 + MQTT

Hi there,
I successfully connected my UNO to 8266 and Cayenne through the new MQTT library, using both software and hardware serial.

Everything works, BUT data packets are sent pretty irregularly every 10/15 seconds: is this normal or should I think to a hardware issue?

The same sketch with my Node MCU8266 and the proper library works like a charm… data refreshed each 1 sec

Thanks!

My sketch:

#include <CayenneMQTTESP8266Shield.h>
#include <DHT.h>
#define DHT22_PIN 7
#define DHTTYPE DHT22
#include <CapacitiveSensor.h>

#define D2  5  // I2C Bus SDA (data)
#define D3  0
#define D4  4  // Same as "LED_BUILTIN", but inverted logic

#define IN D2
#define OUT D4

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

char ssid[] = "";

char wifiPassword[] = "";
char username[] = "";
char password[] = "";
char clientID[] = "";


ESP8266 wifi(&EspSerial);


DHT dht(DHT22_PIN, DHTTYPE);
float humidity, temp_c;


CapacitiveSensor cs_4_2 = CapacitiveSensor(IN, OUT); 

void setup()
{
  cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); 
    pinMode(IN, INPUT);
  pinMode(OUT, OUTPUT);
  
  // Set ESP8266 baud rate
  EspSerial.begin(57600);
  delay(10);

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

void loop()
{
  Cayenne.loop();

}

Hi @suppaman78,

The same sketch on the nodemcu was also connected to Cayenne?

~Benny

Yes, with different library

Passed tons of hours trying to make this work fluently, no success. In the end, I just decided to abandon the arduino/mega way, and switched my setup to MCU.

Thanks anyway