Too much program storage space

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 :frowning: 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.

can someone help me plz
Step 4: Writing the Arduino Code
Here is the Arduino code for our access control system:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <MFRC522.h>
#include <SPI.h>

// Define the pins for the RC522 module
#define SS_PIN 10
#define RST_PIN 9

// Create instances of the MFRC522 and LiquidCrystal_I2C classes
MFRC522 rfid(SS_PIN, RST_PIN);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

// Known RFID card UID (Change this to match your card’s UID)
byte knownUID[4] = {0x7B, 0xC0, 0xAD, 0x21};

void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize SPI bus
SPI.begin();
// Initialize RFID module
rfid.PCD_Init();

// Initialize I2C LCD
lcd.begin(16,2);
lcd.backlight();

// Display a welcome message
lcd.setCursor(0, 0);
lcd.print(“Access Control”);
lcd.setCursor(0, 1);
lcd.print(“System Ready”);
delay(2000);
lcd.clear();
lcd.print(“Scan your RFID”);
}

void loop() {
//lcd.print(“Scan your RFID”);
// Look for new RFID cards
if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
// Print the UID of the card
Serial.print("UID tag: “);
for (byte i = 0; i < rfid.uid.size; i++) {
Serial.print(rfid.uid.uidByte[i] < 0x10 ? " 0” : " ");
Serial.print(rfid.uid.uidByte[i], HEX);
}
Serial.println();

// Check if the card UID matches the known UID
if (checkUID(rfid.uid.uidByte)) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Access Granted");
  lcd.setCursor(0, 1);
  lcd.print("Welcome!");
} else {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Access Denied");
  lcd.setCursor(0, 1);
  lcd.print("Invalid Card");
}
delay(3000);
lcd.clear();
lcd.print("Scan your RFID");

// Halt PICC
rfid.PICC_HaltA();

}
}

// Function to check if the scanned UID matches the known UID
bool checkUID(byte* uid) {
for (byte i = 0; i < 4; i++) {
if (uid[i] != knownUID[i]) {
return false;
}
}
return true;
}

and i get this message Sketch uses 8266 bytes (25%) of program storage space. Maximum is 32256 bytes.
Global variables use 590 bytes (28%) of dynamic memory, leaving 1458 bytes for local variables. Maximum is 2048 bytes.