Simple e-mail example - Arduino Uno went offline

Dear all,

I’m trying to reproduce the example below: ==> It’s worked but only a few moments…

Sadly, after several push up, my Arduino Uno seems to be freeze and on blynk app side I have this message: “Arduino Uno went offline”. At this moment I have no other choice that reboot or reset my device.

Do you know why my arduino is freeze and went offline? Do you have a solution for this issue? I didn’t find a closed topic for this poblem

Here below my setting :
Ardware :

  • Shield Ethernet SunFounder W5100 for Arduino UNO R3 Mega 2560 1280 A057
  • UNO R3 Atmega328P

I’m using also Arduino IDE 1.8.12 and Blynk 0.6.1

The Code :

#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

#define W5100_CS  10
#define SDCARD_CS 4

unsigned count = 0;

void emailOnButtonPress()
  // *** WARNING: You are limited to send ONLY ONE E-MAIL PER 5 SECONDS! ***

  // Let's send an e-mail when you press the button
  // connected to digital pin 2 on your Arduino

  int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"

  if (isButtonPressed) // You can write any condition to trigger e-mail sending
    Serial.println("Button is pressed."); // This can be seen in the Serial Monitor


    String body = String("You pushed the button ") + count + " times.";"", "Subject: Button Logger", body);

    // Or, if you want to use the email specified in the App (like for App Export):
    //"Subject: Button Logger", "You just pushed the button...");

void setup()
  // Debug console

  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  // You can also specify server:
  //Blynk.begin(auth, "", 80);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8080);

  // Send e-mail when your hardware gets connected to Blynk Server
  // Just put the recepient's "e-mail address", "Subject" and the "message body""", "Subject", "My Blynk project is online.");

  // Setting the button
  pinMode(2, INPUT_PULLUP);
  // Attach pin 2 interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);

void loop()

Let me know if you need additionals informations in order to understand my issue


What do you see in your serial monitor? Are you getting multiple serial prints for each button press?

Do the LEDs on your Ethernet shield start doing different things after you’ve pressed the button for the first time time?

I assume that you have a proper email address in here?


Yes I have multiple serial prints for each button press. But after few moment, my arduino freeze :
here below one example of serial print :

10:19:21.397 -> [0] Getting IP…
10:19:45.154 -> [23751] IP: XXX-XXX-XXX-XXX
10:19:45.154 -> [23752]
10:19:45.200 -> ___ __ __
10:19:45.200 -> / _ )/ /_ _____ / /__
10:19:45.247 -> / _ / / // / _ / '/
10:19:45.296 -> /
//_, /////_
10:19:45.296 -> /
__/ v0.6.1 on Arduino Uno
10:19:45.342 ->
10:19:45.342 -> [23871] Connecting to
10:19:45.389 -> [23992] Ready (ping: 11ms).
10:19:59.779 -> Button is pressed.
10:20:07.801 -> Button is pressed.
10:20:08.037 -> Button is pressed.
10:20:08.834 -> Button is pressed.
10:20:09.255 -> Button is pressed.
10:20:10.949 -> Button is pressed.
10:20:11.424 -> Button is pressed.
10:20:11.518 -> Button is pressed.
10:20:11.706 -> Bu
The serial print stops in the middle of printing

I received all the mails excepted the one for the 9th times

Concerning the shield, LEDs react differently after pushing the button.
Concerning my mail address and oath token, yes I changed this informations only for the post

I assume that the issue is not due to Ethernet shield or the Arduino but an issue in the code.
Indeed, I tried this code with others arduino, shield, internet connection and blynk account. I still have the same result.

Do you think it’s a issue that can be solved or should I change my device in order to have more reliability? And if yes, do you have some recommendations on devices?

Two things…

  1. Physical buttons don’t make clean on/off transitions when pressed and released. Instead, they suffer from ‘contact bounce’ where the circuit will be made and broken multiple times per press/release operation. How bad this contact bounce will be depends on the design of your switch and the voltage being switched.

  2. Your interrupt is set to CHANGE, which means that at the absolute minimum you will trigger your ISR at least twice per press release operation, once when pressed and once when released.

You need to change the interrupt so that it only triggers once, either when the level rises or falls, but not both.
You also need to add a debounce routine to your button press ISR to ensure that you only get one email per button press.

The email widget has a number of restrictions…


  • Maximum allowed email + subject + message length is 120 symbols. However you can increase this limit if necessary by adding #define BLYNK_MAX_SENDBYTES XXX to you sketch. Where XXX is desired max length of your email. For example for ESP you can set this to 1200 max length #define BLYNK_MAX_SENDBYTES 1200 . The #define BLYNK_MAX_SENDBYTES 1200 must be included before any of the Blynk includes.
  • Only 1 email per 5 seconds is allowed
  • In case you are using gmail on the Local Server you are limited with 500 mails per day (by google). Other providers may have similar limitations, so please be careful.
  • User is limited with 100 messages per day in the Blynk Cloud

I think that’s what is happening is that you are hitting the 1 email per 5 seconds limit and the Blynk server is dropping your connection.
So, in addition to the changes outlined above, you also need to ensure that the user can’t keep pressing the button and exceed the 5 second limit.


Ok I understand. I will try to correct my code.
Many thanks for your help


Dear all,
I send now a clean impulsion with a texas instrument in order to avoid the contact bounce. Currently their is no mechanical parts coming into play in my experiment.
I tested my montage :
After 6 impulsions (spaced by a delay over 5 secondes), my Arduino goes freezing.
I’m affraid that this problem can’t be only explain by contact bounce.

I wonder if Blynk is Arduino friendly or if I need to change my hardware to be compliant of this app
Do you have advices?

Can you post your serial output again please?

Is the code identical to the sketch builder code I linked to earlier?


Hi PeeKnight,

my serial input freeze after the sixth “Button is pressed” sentence. There is no other error message
Yes the code is identical.


I guess you mean output?

Understanding the timing of the button presses is important, and I can’t tell that without seeing the serial monitor output with timestamps.
Also, regardless of whether or not your new ‘switch’ causes contact bounce, your CHANGE interrupt will still produce two interrupts - and therefore two emails - on each press/release of the switch, unless you Chang this as suggested earlier.