Home › Forums › Arduino › If high temperature then send email using Arduino Uno and Ethernet Shield W5100
Tagged: Arduino
- This topic has 8 replies, 2 voices, and was last updated 1 year, 1 month ago by
Renzo Mischianti.
-
AuthorPosts
-
-
3 April 2024 at 09:20 #30237
Hello,
Im having the Task to code an Arduino to read the Temperature and show it in an LCD Screen and have some Rules so if its over 30 it should send an email to me but the problem is im trying since a week to do it but i cant i have already tried lots of examples but its nothing. I already configured an IP on my Arduino and now i would need help and a guide on how to do it so that it sends an email to me.
This is what i have coded until now and it works.#include <OneWire.h> #include <DallasTemperature.h> #include <Wire.h> #include <LiquidCrystal_I2C.h> // Initialize the LCD LiquidCrystal_I2C lcd(0x27, 16, 2); //The LCD address and size. You can change according to your setup #define ONE_WIRE_BUS 2 //pin for sensor // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); /* The setup function. We only start the sensors here */ void setup(void) { // Start serial port Serial.begin(9600); Serial.println("Dallas Temperature IC Control Library Demo"); // Start up the library sensors.begin(); // Initialize LCD lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("PEGASUS"); lcd.setCursor(0, 1); lcd.print("Measure it"); delay(2000); lcd.clear(); } /* Main function, get and show the temperature */ void loop(void) { delay(3000); // Request temperature readings Serial.print("Requesting temperatures..."); sensors.requestTemperatures(); // Send the command to get temperatures Serial.println("DONE"); // Read temperature from the sensor float tempC = sensors.getTempCByIndex(0); delay(1000); // Check if reading was successful if (tempC != DEVICE_DISCONNECTED_C) { Serial.print("Temperature for the device 1 (index 0) is: "); Serial.println(tempC); // Display temperature on LCD lcd.setCursor(0, 0); lcd.print("Temperature:"); lcd.setCursor(0, 1); lcd.print(tempC); lcd.print((char)223); lcd.print("C"); lcd.print(" | "); lcd.print(DallasTemperature::toFahrenheit(tempC)); lcd.print(" F"); // Check if temperature exceeds 29°C if (tempC >= 29.00) { delay(3000); lcd.clear(); lcd.print("Oida 's is warm"); delay(3000); } // Check if temperature falls below 15°C else if (tempC <= 15.00) { delay(3000); lcd.clear(); lcd.print("Oida is des koid "); delay(3000); } else { lcd.setCursor(0, 2); lcd.print(" "); // Clear the line } delay(3000); } else { Serial.println("Error: Could not read temperature data"); } }
-
4 April 2024 at 11:35 #30241
Hi Erjon,
try to follow the steps for Arduino UNO (if you use It); then there are a lot of topics about how to configure the send grid to send email.Send emails with attachments (v2.x library): Arduino Ethernet – 1
Bye Renzo
-
4 April 2024 at 11:39 #30242
And are there any firewall rules which i have to look closely or that could cause me problems to not be able to send an email?
Erjon
-
4 April 2024 at 15:31 #30248
And im using the EMailSender library and Ethernet library but my Bytes are full and i cant execute the Code. Is there any minimised version for w5100.
Erjon
-
-
4 April 2024 at 15:34 #30249
It’s possible that firewall block some port and It doesn’t work, however, it’s important to note that the Arduino Uno does not support SSL, which is required for secure email transmission.
Therefore, you would need to use a specific email provider that allows non-SSL communication or explore alternative email sending methods, such as using a third-party service or API designed to work with IoT devices like the Arduino.
-
4 April 2024 at 15:37 #30250
-And im using the EMailSender library and Ethernet library but my Bytes are full and i cant execute the Code. Is there any minimised version for w5100.
– im trying the method with sendgrid where i put API, Email, etc. But my Bytes are full and i wanted to ask do you have any idea or maybe another library i could use so that my code would be optimized to work when i add more stuff ?
Thank you,
Erjon
-
-
4 April 2024 at 15:52 #30252
Ahhh ok sorry Erjon,
you can reduce memory usage by disabling the attachments.
Bye Renzo-
5 April 2024 at 10:10 #30255
How could i save some more memory in the UIPEthernet library?
Thank you, Erjon.
-
-
5 April 2024 at 12:49 #30256
I think the enc28j60 need more resources respect w5500.
Bye Renzo
-
-
AuthorPosts
- You must be logged in to reply to this topic.