Everything about Internet of Things and more

Internet of Things project – Android push notifications | ESP8266 Arduino Tutorial

What is the purpose of an IoT project if you cannot access it live from everywhere using your smartphone? Even the name of the concept itself – “Internet of things” – suggests the idea of having remote access to your “things” from any place at anytime. In this ESP8266 Arduino tutorial you will find a 3 steps simple method to send push notifications messages from your IoT project to your smartphone using a standalone cheap a Wi-Fi module.

Examples of IoT applications that requires push notifications:

Push notifications from ESP8266 Arduino compatible Wi-Fi module to Android / IOS mobile devices

Is it hard to do it?

Nope, this shouldn’t take more than 30 minutes to make it work. This esp8266 arduino tutorial is so simple that you will just love it at the end. Follow the next steps and in no more than 20-30 minutes your Android or IOS smartphone will receive a push notification like this:

IoT project - Android push notifications | ESP8266 Arduino TutorialProject requirements:

Note: If you don’t know what an ESP8266 is, you should read this complete ESP8266 module tutorial first, and than continue.

Were do you start?

Step 1: setup the PushBullet service (free)

Pushbullet is an internet service which for SMS sending, notification management and file sending between your mobile devices and pc.”

First you need to go to PushBullet and make a new free account. Activate your account, login in the website and you will see the next screen:

IoT project - Android push notifications | ESP8266 Arduino TutorialClick on you mobile OS type (Android or IOS) or go in the apps market / Google play and search for PushBullet and setup the application on your mobile device using the same account you’ve just created. After that you should see your mobile smartphone in the Devices menu.

IoT project - Android push notifications | ESP8266 Arduino TutorialGo to Settings menu and create a new Access Token by pressing Create Access Token button.

IoT project - Android push notifications | ESP8266 Arduino Tutorial

IoT project - Android push notifications | ESP8266 Arduino TutorialGet the access token and save it to a notepad text file.

Step 2: Setup PushingBox, IoT notification center (free)

“PushingBox is a cloud that can send notification, emails, tweets based on API calls in real time.”

Go to PushingBox, create a new account for free and login. Go to Dashboard and click on My Services – > Add a service. Select PushBullet service from the list and you should see the following screen:

IoT project - Android push notifications | ESP8266 Arduino TutorialGive it a name, and paste your pushbullet token which you should have in your notepad text file and submit the form. After that go to My Scenarios and add a new scenario. You should now be able to add a new Action to your scenario.

IoT project - Android push notifications | ESP8266 Arduino TutorialThe text between the $param$ signs will be your HTTP GET parameter, you will see in the code later. You will be able to replace each parameter like that with your data like temperature or humidity. Save the action and go back to your virtual scenarios list. You should be able to see your new scenario and copy the DeviceId.

IoT project - Android push notifications | ESP8266 Arduino TutorialStep 3: Code example for your ESP8266 Arduino compatible module

This code is very simple to use, it just connects to your Wi-Fi router and then sends a HTTP request to pushingbox API related to your unique device ID. Modify the code by replacing the **** with your Wi-Fi credentials and your PushingBox deviceId. Upload the code to your ESP8266 and test it.

ESP8266 Arduino Tutorial - Push notification messages example
Arduino code example

- replace the dots with your Wi-fi credentials and
- your deviceId from pushingBox account
#include <ESP8266WiFi.h>

// PushingBox scenario DeviceId code and API
String deviceId = "*************";
const char* logServer = "api.pushingbox.com";

const char* ssid = "**********";
const char* password = "***********";

void setup() {
  // Sending a notification to your mobile phone
  // function takes the message as a parameter
  sendNotification("Hello World from ESP8266!");

void sendNotification(String message){

  Serial.println("- connecting to Home Router SID: " + String(ssid));
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("- succesfully connected");
  Serial.println("- starting client");
  WiFiClient client;

  Serial.println("- connecting to pushing server: " + String(logServer));
  if (client.connect(logServer, 80)) {
    Serial.println("- succesfully connected");
    String postStr = "devid=";
    postStr += String(deviceId);
    postStr += "&message_parameter=";
    postStr += String(message);
    postStr += "\r\n\r\n";
    Serial.println("- sending data...");
    client.print("POST /pushingbox HTTP/1.1\n");
    client.print("Host: api.pushingbox.com\n");
    client.print("Connection: close\n");
    client.print("Content-Type: application/x-www-form-urlencoded\n");
    client.print("Content-Length: ");
  Serial.println("- stopping the client");

void loop() {}

The most complete Arduino Starter Kit

Final thoughts

You can send notifications just by using PushBullet standalone, without PushingBox but in order to do that you need to use HTTPS requests with secure connection, and you may consider finding a certificate. Also you need to send a specific data model in JSON format. For more information read the PushBullet API documentation. I use PushingBox because it offers many services, not only for PushBullet, and also the API documentation for PushingBox seems more clear.

PushingBox and PushBullet are two incredible powerful free platforms which you definitely need to try them if you are building an Internet of Things project. I recommend you to test them, the APIs are quite easy to work with, and the features are freaking awesome for paying nothing.

Also if you are interested in monitoring temperature and humidity with Arduino or ESP8266 you can read this Arduino temperature sensors tutorial.

Hoping that this article inspired you, i kindly invite you share this articlesubscribe my YouTube channel and join the communities on social networks. Please feel free to comment or send suggestions / remarks so i can improve the content quality!

Share on: Facebook Twitter Google+

50 Replies to “Internet of Things project – Android push notifications | ESP8266 Arduino Tutorial”

  1. GeeksTips says:


  2. Jeen says:

    Hi .Great tutorial..Can you also send me the circuit diagram showing connections between ESP8266 and Arduino ?

  3. Tri Ananda says:

    Thank you for your tutorial! it’s help me..

  4. Mark says:

    Doesn’t seem to work for me, followed the tutorial, got all of the tests to work when pushing the message from pushingbox to pushbullet, but when it came to the code, it wouldn’t push the notification when I uploaded the code. My WIFI creds are correct as is my ID, so I’m quite stumpted as to why it wouldn’t upload. Maybe a video would help to show if I missed anything?

  5. Collin H says:

    Thanks alot,
    It works like a charm.

  6. Mike Mckay says:

    Out of curiosity, isn’t the ESP able to do all of this by itself as it is a wifi enabled microcontroller in its own right?

    • Short answer: no. ESP its a development board only. The WiFi module embedded allows only TCP transactions. You cannot force input into a Smartphone directly from a ESP (not natively).

  7. Nelu says:

    Hello !
    Why I have error when I test compile cod ? :

    ‘sendNotification’ was not declared in this scope

    Thanks !

    • Hello, make sure you correctly copied the code and you have all your libraries installed. I just compiled exactly this code and it got trough fine. Thanks!

  8. Suresh Doraiswamy says:

    Hello Lucian,
    It works great! I am able to push notifications to my mobile with no problems. Thanks.
    Now, I want to send a command from the PushBox App on my mobile to this app running on my ESp8266.
    Kindly show me how.

  9. Zeynel says:


    Im try tu use on 3 days of Push note form esp8266 to android.

    But neader your code nor my code doesnt send sny message form IOT devices.
    I think ı make mistake something.

    This is my code please tell me what is wrong at ths code ?

    Thank you

  10. Zeynel says:

    // ESP8266 DS18B20 ArduinoIDE Thingspeak IoT Example code


    #define ONE_WIRE_BUS D3

    // ThingSpeak Connection Detail
    const char* host = “api.thingspeak.com”; // Your domain
    String ApiKey = “BD4EHOFNB3CTV5F0”;
    String path = “/update?api_key=” + ApiKey + “&field1=”;

    // PushingBox scenario DeviceId code and API
    String deviceId = ” v8768796E7358C90″;
    const char* logServer = “api.pushingbox.com”;

    // SSID
    const char* ssid = “IForbs”;
    const char* password = “30061972”;

    // Deep Sleep Tanımları
    const int sleepSeconds = 3600;

    char temperatureString[6];

    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature DS18B20(&oneWire);

    // ————————————
    // getTemperature Fonksiyonu
    float getTemperature() {
    float temp;
    do {
    temp = DS18B20.getTempCByIndex(0);
    } while (temp == 85.0 || temp == (-127.0));
    return temp;

    // Wifi Bağlantı Fonkriyonu
    void connectWifi (void) {

    WiFi.begin(ssid, password);
    // if you’re not connected, stop here:
    if ( WiFi.status() != WL_CONNECTED) {


    // PushBullet Mesaj Gönderim Fonksiyonu

    void sendNotification(String message){

    WiFiClientSecure client;

    if (client.connect(logServer, 80)) {

    String postStr = “deviceId=”;
    postStr += String(deviceId);
    postStr += “&$message$”;
    postStr += String(message);
    postStr += “&$parameter$=”;
    postStr += String(“Derece”);
    postStr += “\r\n\r\n”;

    client.print(“POST /pushingbox HTTP/1.1\n”);
    client.print(“Host: api.pushingbox.com\n”);
    client.print(“Connection: close\n”);
    client.print(“Content-Type: application/x-www-form-urlencoded\n”);
    client.print(“Content-Length: “);

    // ThingSpeak’ Bağlantı ve Veri Gönderme Fonksiyonu

    void thingspeak(void){
    float temperature = getTemperature();

    dtostrf(temperature, 2, 2, temperatureString);
    // send temperature to the serial console

    WiFiClient client;
    const int httpPort = 80;
    if (!client.connect(host, httpPort)) {
    sendNotification(“connection failed”);

    client.print(String(“GET “) + path + temperatureString + ” HTTP/1.1\r\n” +
    “Host: ” + host + “\r\n” +
    “Connection: keep-alive\r\n\r\n”);

    // Ana Program Bloğu

    void setup(void){

    // Sending a notification to your mobile phone
    // function takes the message as a parameter
    // sendNotification(“Hello World from ESP8266!”);

    char buf[15];


    sendNotification(“Connected to “);



    sendNotification(“Bir saatlik uyku başlangıcı”);
    //ESP.deepSleep(sleepSeconds * 1000000);


    void loop() {

  11. Caesar G says:

    Hi Lucian,

    Thank you for your great post! It is the best post on the web about Android push notifications.

    I had no problems making my ESP8266-01 working. It was as simple as copying your fantastic code into empty .ino file, and then setting the Pushbullet and Pushingbox accounts, as you guided.

    It worked beautifully.

    Unfortunately, I run into problem when trying to implement a PIR sensor, or any sensor.

    So, I put the Loop part of the code within the Loop bracket part of your code (which is at the bottom and the last line of your code). The code compiled, but the intrusion event was not triggering any push messages via Bullet.

    The only message that is pushed, is when initializing the device, or resetting it. Just one initial message, there are no messages triggered by sensor’s state change.

    Was I correct to insert the code inside the loop?

    Where the simple sensor code has to be inserted in your code?

  12. VENUS says:

    Hi there! I want to ask. Where do I get the library for my esp8266?

  13. Hardik Sheth says:

    Hi, I want my receive push notification from other device to esp8266. Means Want to get push notification in esp8266 instead of sending notification form esp8266.

    help will be really appreciated.

  14. Hello. I’m trying to use ESP8266 to send a push notification via GCM (Google Cloud Message). When I use Client.Connect to send a POST message the method returno FALSE and I do not know why this error occurs. Would you help me?

    I’m using this library:


  15. Deo kumar Das says:

    I tried to send notification using Arduino AT Command but it’s not working.Please help me out.Code is provided below

    void sendNotification(String message){

    String cmd = “AT+CIPSTART=4,\”TCP\”,\””;

    cmd += server;
    cmd += “\”,80″;
    Serial.println(“Not good!”);
    cmd=”http://api.pushingbox.com/pushingbox?devid=*************”; // replace * with deviceId
    cmd += “&message_parameter=”;
    cmd += String(message);
    cmd += “\r\n\r\n”;
    Serial.println(“- sending data…”);


  16. grupposis says:

    thank you very much it is very helpful tuto.

  17. abishek says:

    exit status 1
    Error compiling for board Arduino/Genuino Uno. error is showing
    How to solve it

  18. abishek says:

    i’m having serial wifi wireless module with arduino..

    It shows an error like

    Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

    In file included from C:\Users\Abisanju\Desktop\arduino-1.8.5-windows\arduino-1.8.5\libraries\ESP8266WiFi\src/ESP8266WiFi.h:33:0,

    from C:\Users\Abisanju\Documents\Arduino\pushbutton\pushbutton.ino:1:

    C:\Users\Abisanju\Desktop\arduino-1.8.5-windows\arduino-1.8.5\libraries\ESP8266WiFi\src/ESP8266WiFiType.h:26:19: fatal error: queue.h: No such file or directory



    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.
    Specified folder/zip file does not contain a valid library

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    what should i do?

    • This code is designed to work with ESP modules only, because it uses dedicated ESP8266 libraries. If you use other WiFi modules you may need to replace the code which manages WiFi connections.

  19. David says:

    it’s doens’t work for me…
    when I use “test” on the website – I can get the notification.
    so all the setting is OK
    I can also see that the ESP send some data to my Router – but I don’t get the notification to my phone.

    this is the code :


    ESP8266WiFiMulti WiFiMulti;

    const int GPIO2 = 2;//door sensor input

    String deviceId =” v12451BC5EA63C11″;// the token from the website
    const char* logServer = “api.pushingbox.com”;

    const char* ssid = “David”;
    const char* password = “IdontHaveAPassword”;

    bool sending = false;

    void setup() {

    pinMode (GPIO2 , INPUT);


    Serial.println(“WiFi connected”);
    Serial.println(“IP address: “);



    void loop()

    if (digitalRead(GPIO2) == LOW)
    String line = “Door1 is Close”;
    sending = false;

    String line = “Door1 is Open”;
    if (sending == false)
    sending = true;


    Serial.println(“wait 1 sec…”);

    void sendNotification(String message){

    Serial.println(“- connecting to Home Router SID: ” + String(ssid));

    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {

    Serial.println(“- succesfully connected to Home router”);
    Serial.println(“IP address: “);
    Serial.println(“- starting client”);

    WiFiClient client;

    Serial.println(“- connecting to pushing server: ” + String(logServer));
    if (client.connect(logServer, 80)) {
    Serial.println(“- succesfully connected”);

    String postStr = “devid=”;
    postStr += String(deviceId);
    postStr += “&message_parameter=”;
    postStr += String(message);
    postStr += “\r\n\r\n”;

    Serial.println(“- sending data…”);

    client.print(“POST /pushingbox HTTP/1.1\n”);
    client.print(“Host: api.pushingbox.com\n”);
    client.print(“Connection: close\n”);
    client.print(“Content-Type: application/x-www-form-urlencoded\n”);
    client.print(“Content-Length: “);
    Serial.println(“- stopping the client”);

  20. Hisham says:

    I want to make doorbell circuit.
    Which pin should I connect to doorbell?
    Please anyine help

  21. siva says:

    sound notification to andriod app when connected power to esp 8266
    same like this video https://www.youtube.com/watch?v=9c_Xc4_MUpY

    Thankig you
    siva 9397833459

  22. imam says:

    maaf gan mau nanya kalo eror di “const char* ssid” gmna ya caranya

  23. imam says:

    sorry gan want to ask if the error in “const char * ssid” gmna ya how
    please help
    thank you

  24. Uwe says:

    I tried your example and it works very good.

    I want to send values from sensors, but I don’t know how to change the parameter of the sendNotification-function.
    Please help.
    Many thanks.

  25. KidsinNeed says:

    It is not connecting to the wifi. pls send help

  26. 為什麼只能剛燒錄進去的時候傳到手機

  27. Otto van Zanten says:

    I accidentally filled in $message parameter without the dollar sign at the end (and nothing before it) and it sent me a notification with $message parameter

    I then fixed it by adding another dollar sign. Nothing. I removed the dollar sign again. Nothing.

    Do these services still work (properly)? If it didn’t work at all I’d go look for mistakes on my end. If it only works once though I have to wonder if there’s a bug on their end.

  28. Otto van Zanten says:

    Also from when is this guide? A date would be super useful as there are a whole lot of outdated guides out there.

  29. Renilson says:

    Parabéns pelo post. Já vou tentar implementar no meu código.

  30. Azwar says:

    Hello Teacher, when I uploaded the code , the notification sent itself automatically, how about if I press a button ( which is connected to node mcu ) GIVE the notification. Can you help me, Kindly?

  31. Andrei Ardelean says:

    Hello! What versions of ESP8266 are capable of sending push notifications on Android 9? If I use ESP8266-01 or ESP8266-01S like it is showed in the other tutorial and a simple breadboard, will it work for this project? The wiring is identical?

  32. Ambro says:

    Good day,
    I am sorry to interrupt you .
    I did follow all the instruction relevant to your project : it is working since I do receive notification on both my mobile and Opera browser. The content (or message ) of the notification is Just what I wrote in the PushingBox and not the one sent by the ESP 8266.
    I would like to understand what I have to write on the $parameter$ field in order to see the ESP message and not the message I did write on the PushinBox..
    I have to get notification with a ESP string or data as indicated by you : How could I have it please ?
    Thanks a lot for your kind assistance on this matter.
    All the best.

  33. ambro says:

    it is me again…
    could anyone let me know what should I write in the PushingBox message from the ESP $ ????? $ to notify what the esp is sending please ? Taking as reference the esp sketch.
    I will leave my address for a direct reply:
    thanks for all

  34. Ambro says:

    I did found the problem…. Someone else gave me His attention and the solution was found !

  35. zilvinas zilinskas says:

    can you include the esp8266WiFi.h library

  36. Emilio says:

    Howdy! This is my first comment here so I just wanted to give a quick shout out and
    tell you I really enjoy reading through your articles. Can you suggest any
    other blogs/websites/forums that deal with the samje topics?
    Thanks a ton!

  37. Jaco Venter says:

    Good day,
    I have done everything exactly as you explained. When I test the Scenarios it works, and sends me notifications, but not when I run the code in my NodeMCU. The Serial Monitor shows that the code executes, but I don’t receive any notifications. Where can I look for the problem?

  38. Ian Stumpe says:

    Can I do the samething using an ESP32 (Arduino MKR WiFi 1010) board? IF so how do I do it? I have looked for examples, but could not find anything specific to the ESP32 chip, everything that I have found was for the chip you use in this project.

  39. Chris says:

    Thanks for this code, it works great (once I ironed out my typos) but I am having difficulty making this work practically in a code.
    ie. Send a notification when a pin goes hi.

    Specifically, wake up the esp every 10 minutes (or so), check a pin status, send notification if pin is high, go to sleep.

    But as soon as I modify the code at all I get a lot of errors.

    Any help with this would be greatly appreciated

  40. Daniel Lessard says:

    Nice tutorial, thank you, work well, just need to stuff code to trigger action

  41. female says:

    Once you ve flashed your Raspberry Pi and are able to connect to it with adb, the next step is to make your Android project compatible with Android Things by adding the requisite dependencies and intent filters.

  42. Write more, thats all I have to say. Literally, it seems as though you relied
    on the video to make your point. You definitely know what youre
    talking about, why throw away your intelligence on just posting
    videos to your site when you could be giving us something
    enlightening to read?

  43. Oh my goodness! Impressive article dude! Thank you so much, However I
    am having difficulties with your RSS. I don’t know the reason why I cannot join it.
    Is there anybody having the same RSS problems? Anybody who knows the solution can you kindly respond?

  44. Vassago says:

    Im trying to use the code in a project that has the arduino uno conected to the esp8266, but i get an error saying that there is no such Esp8266 wifi library..

  45. Tomasz Cybulko says:

    Works very well on ESP8266 but doesn’t work on ESP32 – too bad.

  46. julian caste says:

    works well , only need an esp8266 NO ARDUINO NEEDED. test on 7 june 2021

Leave a Reply

Your email address will not be published. Required fields are marked *