IoT Module – Notification

Notification
Description

This module can be used to trigger Notification in your smartphone as per commands sent from the hardware. 

You can connect various sensors on your hardware and monitor them with the notification module. 

For example, you can be notified whenever your plants need water. This can be done by monitoring the moisture content of the soil with the help of your hardware board and moisture sensor. As soon as the moisture level goes below a fixed threshold controller board will send a signal to Dabble for generating a notification in Smartphone.

Available in

Introduction

The Notification module in the IoT module can be used to trigger a notification in your Smartphone based on events occurring on your hardware.

All the commands related to triggering a notification are transferred from hardware only. This means that the title name of the notification and text content of notification will be sent from your hardware board only. The module in Smartphone shows you the history of the last notification created on the phone.

The image below shows that a notification is created in smartphones for monitoring the moisture content of plants.

You can see the title of notification is “Plant Monitoring Status” and content states that “The moisture level has gone down. Water your plant and quench its thirst ”. 

 

evive Notes Icon
Note: At a time you can create only one topic of notification, however updating it’s content multiple times is possible.

Arduino IDE Functions

Header

To send Notification, you have to include the following header:

#define CUSTOM_SETTINGS

#define NOTIFICATION_SETTINGS

After defining the above mention headers, you have to include the dabble library:

#include <Dabble.h>

You can download the zip of Arduino Library for

  1. evive, Uno, Mega, and Nano – Dabble-Arduino 
  2. ESP32 – Dabble-ESP32

depending on the board you are using.

Enabling Bluetooth Communication

To enable Bluetooth communication, you have to initialize serial communication using the following code:

  1. For evive and Arduino Mega, Uno and Nano
    Dabble.begin(Baud_Rate);

    Here Baud_Rate is the baud rate set for the Bluetooth module. With evive, you normally get 115200 baud rate modules.

  2. For ESP32
    Dabble.begin("Bluetooth_Name");

    In place of Bluetooth_Name  enter name that you want to keep for Bluetooth of ESP32. The default name given in the library is “MyEsp32”. 

Refreshing the data

To refresh the data that the device has got from the mobile app, you have to use the following line of code:

Dabble.processInput();

This function also changes the state and the brightness of the LED automatically and you don’t have to do anything.

Functions

Following are the function available for this module:

  1. Notification.clear() – To clear all the previous notifications.
  2. Notification.setTitle(titleName) – Enter the title name you want to give to your notification. Remember that at a time you can generate only one topic for notification on the phone. Hence make sure you don’t create multiple titles.

  3. Notification.notifyPhone(content) – Write the content of notification.

PictoBlox (Scratch) Blocks

For handling notification, there are two stacked blocks namely “send notification titled () & message ()” and “clear notification“. The “clear notificationblock is used for clearing the previous notification from the phone.

clear notification

The “send notification titled () & message ()” is used to create the title of notification and also its content. As stated earlier that you can create only one notification topic and updating it again and again is possible, hence make sure that notification title is the same for all messages related to that topic.

send notification

evive Notes Icon
Note: When you are using this module with Arduino Uno, Mega, and Nano,  you have to set the Bluetooth baud rate to the baud rate of the Bluetooth module to have proper communication between the board and the module. To set the baud rate you have to use set bluetooth baud rate to () block.

set bluetooth baud rate to

Examples

Click here to view Arduino IDE Example for IoT Module – Notification

evive

In this example, a notification for monitoring the status of touch pins of evive and sending SMS on pressing tactile switch is shown.

Either copy code from below or navigate to “Files>>Dabble>>01.evive>>10.IOT>> Notification in Arduino IDE.

Mega, Uno, and Nano

You can also find below code in Arduino IDE  for this navigate to “Files>>Dabble>>01.Uno Nano Mega>>10.IOT>> Notification

In the below example status of the push button is notified in the Smartphone.

ESP32

You can also find below code in Arduino IDE  for this navigate to “Files>>DabbleESP32>>10.IOT>> Notification.

In the below example status of the push button is notified in the Smartphone.

Click here to view PictoBlox (Scratch) Example for IoT Module – Notification

evive

In the example below notification for monitoring status of touch pins of evive is shown. 

Notification evive_example

Uno, Mega Nano

For Mega and Nano just changes the head block of the below script.
The script below creates a notification that shows the status of digital pin 13 on phone. Note that here at first all the notifications are cleared using “clear notification” block and then the new notification is created. The title of the notification in each block is the same and only the content is different.
Notification Uno_Example

Leave a Reply

Close Menu
×

Cart