No Notification Receive using Arduino UNO Serial USB

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.


/* Comment this out to disable prints and save space */
#define BLNYK_PRINT DebugSerial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"
#define BLYNK_TEMPLATE_ID "TMPL5hdx8s9L"
#define BLYNK_DEVICE_NAME "Capstone Project"

#include <Blynk.h>

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#include <BlynkSimpleStream.h>

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

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup(){
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
  lcd.init();
  lcd.backlight();
  lcd.clear();
  pinMode (2, OUTPUT);
  digitalWrite(2, HIGH);
  delay(1000);
  lcd.setCursor(0, 0);
  lcd.print("IRRIGATION");
  lcd.setCursor(0, 1);
  lcd.print("SYSTEM IS ON ");
    lcd.print("");
    delay(3000);
  lcd.clear();  
}

void loop(){
  Blynk.run();
  int moist = analogRead(A0);
  Serial.println(moist);
  if (moist > 950) { 
      digitalWrite(2, LOW);
      lcd.setCursor(0, 0);
      lcd.print("Water Pump is ON ");
  } else {
      digitalWrite(2, HIGH);
      lcd.setCursor(0, 0);
      lcd.print("Water Pump is OFF");
      Blynk.logEvent("auto_water", ("Plant Already Watered!"));
}

  if (moist > 950) {
    lcd.setCursor(0, 1);
    lcd.print("Moisture : LOW ");   
  } else if (moist < 950 && moist > 400) {
    lcd.setCursor(0, 1);
    lcd.print("Moisture : MED ");
  } else if (moist < 500) {
    lcd.setCursor(0, 1);
    lcd.print("Moisture : HIGH ");
  }
}

I’d suggest you start by reading this…

Then this…

Pete.

1 Like

I already followed your advice, however I haven’t received a notification for the event I made on blynk.cloud.

I’d suggest that you post your updated sketch along with screenshots of how your event and associated notification are configured.
If you’ve not previously been sending events to the timeline then you may have already exceeded your daily quote, but in that case you should now see a message to that effect.

Pete.

1 Like

You need to use triple backticks when you post code.

Also, you need to post a screenshot of the EVENT screen as well as the associated notification screen, and your screenshots probably need to be done at a different screen resolution, or in multiple parts, so that ALL of the options can be seen.

Pete.

what you mean triple backticks sir? can you give me sir a example how to use it?

and here is my events.

You should add the triple backticks before and after your whole sketch. Something like this
triple backticks

1 Like

Thank you sir, sorry for the disturbance.

1 Like

Okay, firts if all you need to remove all of your code from the void loop except Blynk.run() and place it in a function, then use a BlynkTimer to call that function.
I’ve already shared a link to the “keep your void loop clean” article earlier 8n this topic. You need to read it and act upon it.

I also asked you to…

You’ve posted a shot of the Events tab, but you haven’t shown the detail associated with the Auto Water event, or the Notifications tab within that event.
It you look at the tutorial I linked to regarding events, notifications and flag variables then you’ll see examples of the sort of screenshots that we need to see. However, if you actually worked through that article yourself then you’d probably find the answer to your problem anyway.

Even when you’ve fixed the notification issue, you still need to implement at least one flag variable to ensure that you don’t very quickly exceed your daily event/notification quota.

Until you do these things we can’t really help you any further.

Pete.

1 Like

I already read and follow those step in this both link Keep your void loop() clean - Blynk Documentation and Events, Notifications and the use of "Flag" variables, but still not working

Here’s my notification tab

my blynk event tab is ok and also my notification tab, the problem sir is I don’t really know where line should I put those codes in my project :frowning:

I’d like to see ALL of the parameters in each of the two tabs for the Auto Water event. You’ve provovided a screenshot of half of the notification tab, which tells me very little.

Also, if you’ve updated your sketch don’t you think it would be sensible to post that sketch here?

Pete.

Please edit your post and replace whatever characters you’ve used with triple backticks.

Pete.

Here’s the example of code that I experiment for my project.
’ ’ ’

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

float m_threshold = 500;
bool info_sent = false;

BlynkTimer timer;

void moistureSensor() {
 int moist = analogRead(A0);
 Serial.println(moist);
 if (moist > 950) {
digitalWrite(2, LOW);
lcd.setCursor(0, 0);
lcd.print("Water Pump is ON ");

if(moist > m_threshold && info_sent == false) {
Blynk.logEvent("auto_water",  String("Plant Already Watered!") + moist);
info_sent = true;
Serial.println("Blynk Alert Notification sent!");
Serial.println();
}

else if (moist <= m_threshold && info_sent == true) {
info_sent = false;
Serial.println("Moist is now equal to or below the threshold");
Serial.println("New low-moist detected events will trigger a new alert notification");
Serial.println();                  
}

} else {
  digitalWrite(2, HIGH);
  lcd.setCursor(0, 0);
  lcd.print("Water Pump is OFF");
}

if (moist > 950) {
lcd.setCursor(0, 1);
lcd.print("Moisture : LOW ");  
} else if (moist < 950 && moist > 400) {
lcd.setCursor(0, 1);
lcd.print("Moisture : MED ");
} else if (moist < 500) {
lcd.setCursor(0, 1);
lcd.print("Moisture : HIGH ");
}
}

void setup() {
Serial.begin(9600);
Blynk.begin(Serial, auth);
lcd.init();
lcd.backlight();
lcd.clear();
pinMode (2, OUTPUT);
digitalWrite(2, HIGH);
delay(1000);
lcd.setCursor(0, 0);
lcd.print("IRRIGATION");
lcd.setCursor(0, 1);
lcd.print("SYSTEM IS ON ");
lcd.print("");
delay(3000);
lcd.clear();  
timer.setInterval(1000L, moistureSensor);
}

void loop() {
Blynk.run();
timer.run()
}

’ ’ ’

Quite a bit of your sketch appears to be missing.

If you go into the web console, Devices > Capstone Project then click the three dots next to “Capstone Project” you’ll get a menu like this…

Click on Notifications Settings and you’ll see a menu like this…

Check that for your Auto Water notification the notification is Active.

If that’s okay then take a screenshot of your Timeline tab in the web console device screen.

Pete.

Pete.

Still no record in timeline

i think the problem sir is the code, because i don’t know which line should i put the blynk.logevent, etc.
What do you think of my code? it is correct or not?
’ ’ ’

float m_threshold = 950;
bool info_sent = true;

BlynkTimer timer;

void moistureSensor() {
int moist = analogRead(A0);
Serial.println(moist);
if (moist > 950) {
digitalWrite(2, LOW);
lcd.setCursor(0, 0);
lcd.print("Water Pump is ON ");
} else {
digitalWrite(2, HIGH);
lcd.setCursor(0, 0);
lcd.print("Water Pump is OFF");

if(moist > m_threshold && info_sent == true) {
Blynk.logEvent("auto_water",  String("Plant Already Watered!") + moist);
info_sent = false;
Serial.println("Blynk Alert Notification sent!");
Serial.println();
} else if(moist <= m_threshold && info_sent == false) {
info_sent = true;
Serial.println("Moist is now equal to or below the threshold");
Serial.println("New low-moist detected events will trigger a new alert notification");
Serial.println();
}
}

if (moist > 950) {
lcd.setCursor(0, 1);
lcd.print("Moisture : LOW ");
} else if (moist < 950 && moist > 400) {
lcd.setCursor(0, 1);
lcd.print("Moisture : MED ");
} else if (moist < 500) {
lcd.setCursor(0, 1);
lcd.print("Moisture : HIGH ");
}
}

’ ’ ’