Create Push Notification over Flame Sensor

Try switching notify to email and see if you receive the emails.

If I use email, can it sent notif? And what example should I use?

No but It helps isolate the problem.

I mean, if I switch notify to email, then the sensor can’t send email automatically, right? It just work on request, right?

Email will be sent automatically, check the docs for the email widget.

Do you mean this sketch?

    /*************************************************************
    Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

    Blynk is a platform with iOS and Android apps to control
    Arduino, Raspberry Pi and the likes over the Internet.
    You can easily build graphic interfaces for all your
    projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

    Blynk library is licensed under MIT license
    This example code is in public domain.

    *************************************************************
    =>
    =>          USB HOWTO: http://tiny.cc/BlynkUSB
    =>

    Simple e-mail example

    App project setup:
    E-mail Widget

    Connect a button to digital pin 2 and GND
    Pressing this button will send an e-mail

    WARNING: You are limited to send ONLY ONE E-MAIL PER 15 SECONDS!
    *************************************************************/

    /* Comment this out to disable prints and save space */
    #define BLYNK_PRINT SwSerial
    /* Set this to a bigger number, to enable sending longer messages */
    //#define BLYNK_MAX_SENDBYTES 128

    #include <SoftwareSerial.h>
    SoftwareSerial SwSerial(10, 11); // RX, TX
    
    #include <BlynkSimpleStream.h>

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

    void emailOnButtonPress()
    {
       // *** WARNING: You are limited to send ONLY ONE E-MAIL PER 15 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
      {
         SwSerial.println("Button is pressed."); // This can be seen in the Serial Monitor
         Blynk.email("your_email@mail.com", "Subject: Button Logger", "You just pushed the button...");

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

    void setup()
    {
       // Debug console
       SwSerial.begin(9600);
 
       // Blynk will work through Serial
       // Do not read or write this serial manually in your sketch
       Serial.begin(9600);
       Blynk.begin(Serial, auth);

       // Send e-mail when your hardware gets connected to Blynk Server
       // Just put the recepient's "e-mail address", "Subject" and the "message body"
       Blynk.email("your_email@mail.com", "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()
    {
       Blynk.run();
    }

But, isn’t it work on request because there are email on button pressed?

This is the only line you require. Comment out your notify line, add the email widget to your project and add the line above (with your email details and Subject changed to “Flame Sensor” and text of say “Sensor triggered”).

Ok, I’ll try it first.

Oh, then that pin 2 connect to push button?

No, forget the email sketch we are just using the email widget.

You had a sketch with this:

Blynk.notify("Flame!!!");

simply change to:

//Blynk.notify("Flame!!!");
Blynk.email("your_email@mail.com", "Flame!!!", "Sensor activated");

Ensure you have your email address in the line above and the email widget added to your project.

Ok. Then, how about push notif widget? Should I delete it?

No leave it in the project we will try to use it later when you have checked email out.

It will not do anything now you have commented out the line of code.

I have add my email to the sketch and the email widget. But, still no incoming email.

Is your email a Gmail address?

I use yahoomail. Is it not allowed? Then, I’ll change to gmail.

Set up a Gmail account. you can always forward you Yahoo later.

I have change to gmail and nothing email coming.

Try adding this as the last line of setup()

Blynk.email("your_email@gmail.com", "Flame!!!", "Sensor activated");

If this doesn’t work it looks like you haven’t configured Blynk correctly.

but, @Maria, i know that time is short and you have deadlines, but i still ask what i asked several days ago:

are you positive that you have a reliable working internet connection between board - blynk server?

you should test it first, with a sketch containing nothing else just to send uptime to app. if you can not make that working, it is not reasonable to struggle with more advanced things.

in the sketch builder you can find example for that.

i have a feeling that you’re acting in haste, but you should slow down, and go in very small steps. as i already wrote:

  1. the flame sensor sketch is working as you wish in offline mode (without internet and blynk)? just with a buzzer. yes / no ?

  2. do you managed to have a working sketch with serial usb or whatever connection to blynk? just sending uptime for some minutes. (no notification or flame sensor involved) yes / no ?

  3. ONLY if 1 and 2 are positive it worths trying to implement flame sensor and notification to the sketch.

1 Like

What’s the sign if the system have connection between board blynk server? I have check my app, it’s online.

Is it not reliable connection?