I have done few program with ESP and work great. Now I’d like to use arduino UNO with W5100 shield.
Only blank program take 82% space ?!?!? I add SHT31 and I’m out of space.
you can save 7% by commenting #define CAYENNE_PRINT Serial
but still, it is not much of space. You will need to use a higher memory device like a arduino mega.
ho avuto lo stesso problema, ho messo // a cayenne_print, sono arrivato al 98% e gira
è arduino uno con wire e dht22
altrimenti desisti e passi a qualcosa di piu potente
This is useless I need to move to some other platform or make my own webserver. But I don’t understand why so much program space. It remain more space on ESP, but it is smaller MPU.
you need to modify the code a bit. Below code uses 89% memory for reading SHT31 value and sending them to cayenne:-
#include <CayenneMQTTEthernet.h>
#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
bool enableHeater = false;
uint8_t loopCnt = 0;
Adafruit_SHT31 sht31 = Adafruit_SHT31();
char username[] = "MQTT_USERNAME";
char password[] = "MQTT_PASSWORD";
char clientID[] = "CLIENT_ID";
void setup() {
//Serial.begin(9600);
//while (!Serial)
// delay(10); // will pause Zero, Leonardo, etc until serial console opens
// Serial.println("SHT31 test");
if (! sht31.begin(0x44)) { // Set to 0x45 for alternate i2c addr
// Serial.println("Couldn't find SHT31");
while (1) delay(1);
}
Cayenne.begin(username, password, clientID);
//Serial.print("Heater Enabled State: ");
//if (sht31.isHeaterEnabled())
// Serial.println("ENABLED");
//else
// Serial.println("DISABLED");
}
void loop() {
Cayenne.loop();
// Toggle heater enabled state every 30 seconds
// An ~3.0 degC temperature increase can be noted when heater is enabled
if (++loopCnt == 30) {
enableHeater = !enableHeater;
sht31.heater(enableHeater);
//Serial.print("Heater Enabled State: ");
//if (sht31.isHeaterEnabled())
// Serial.println("ENABLED");
//else
//Serial.println("DISABLED");
loopCnt = 0;
}
}
CAYENNE_OUT_DEFAULT()
{
float t = sht31.readTemperature();
float h = sht31.readHumidity();
Cayenne.celsiusWrite(1, t);
Cayenne.virtualWrite(2, h, "rel_hum", "p");
}
Thanks for help, but this is not enough. I need to to do also some logic inside not only send temperature and humidity.
I’m not so good in programming, but I will try to use arduino uno board for I/O and logic, then connect with ESP board via ISP.
So ESP will work on receive and send data to cayonne server. Will see if I’m good enough…
what else do you want to do?
i would suggest an esp development board like nodemcu or wemos.
Your API should left us more space on arduino. But I do progress on connecting arduino uno with ESP
users have faced issues with uno and esp as it has only one hardware serial pins. The cayenne code for esp as the shield is meant for devices with multiple hardware serial pins like mega.