Project tutorial
Smart IoT Postbox with the idIoTware Shield

Smart IoT Postbox with the idIoTware Shield © GPL3+

Next generation postbox is here!! Smart IoT postbox will keep you informed about new envelopes dropped inside a postbox by the mailman.

  • 14 respects

Components and supplies

Apps and online services

About this project

In this project, I am going to demonstrate how to build your own IoT aware Postbox with the help of the idIoTware shield in a few easy steps. This postbox alerts you about new envelopes dropped inside a postbox by the mailman.


The LDR ( Light Dependent Resistor) on IdIoTWare shield is used as sensor to detect a letter being dropped into the letterbox. The on board WS2812 Led (addressable RGB LED) on IdIoTWare shield is continuously ON (WHITE Color) which acts as a light source, and reflects light onto the LDR. As soon as a letter is dropped into the postbox, there is an interruption in light - the light intensity on LDR changes due to reflection. The Arduino continuously monitors the change in the value of the LDR and when it notices a change in value, it sends an email. Here we are using IFTTT to send a pre configured email.

So what is IFTTT?

IFTTT is a free web-based service that allows users to create chains of simple conditional statements, called "recipes", which are triggered based on changes to other web services such as Gmail, Facebook, Instagram, Twitter and many more. IFTTT is an abbreviation of "If This Then That".

User can use the maker channel to connect there hardware with other services and trigger them according to the recipes.

For example we can make a recipe on IFTTT that would trigger when someone post the letter in the letter box.Here the maker event will get trigger and tell the gmail to send the email.


1. Make an account on

2. Create a New Applet.

3. Search Maker channel.

4. Click on receive a web request.

5. Create trigger.

6. Once Maker channel is setup, it's time to setup Gmail.

7. Search Gmail.

8. Click on send an email. This will send an email whenever the Maker channel is triggered.


10. Enter an email ID with subject and body that you want to mention, when maker event is triggered. Once completed click on create action.



13. You will need the key from maker event. To get the key click on settings.


15. To trigger an event, make a POST or GET web request to:{event}/with/key/mGgAiLZS1_on-89533ExSCHP5Z2JazeWJF8DclQREOe

16. Once you got the key you need to copy that into Arduino code.

Once the IFTTT is setup you will need to setup the idIoTware shield.

Download the code and upload to Arduino.

Wasn’t that easy??!

Without connecting any wires for ESP8266 you got up and running with the internet of things. Now its your turn to experiment it. With the idIoTware shield the sky's the limit.


Smart Iot PostboxArduino
    In this example we are using ESP8266 and IdIoTWare Shield and Arduino Board. LDR on IdIoTWare shield 
    is used as sensor to detect letter in the letterbox. WS2812 Led (addressable RGB LED) 
    on IdIoTWare shield is continuously ON (WHITE Color) and reflects light on LDR. As 
    soon as new letter dropped in postbox light intensity on LDR changes due to reflection 
    and event gets triggered.
    Here we are using IFTTT to trigger an event.
    IFTTT is a free web-based service that allows users to create chains of simple conditional statements,
    called "recipes", which are triggered based on changes to other web services such as Gmail, Facebook,
    Instagram, and many more.IFTTT is an abbreviation of "If This Then That"
    Create account on IFTTT and create your recipe.
    We are using Maker and Gmail channel to trigger an event.
    If there is new letter in postbox, Arduino will send POST request to maker channel.  
    if Maker then Gmail
    If Maker Event "New Letter", then send an email from "" 

#include <Adafruit_NeoPixel.h>
#include "idIoTwareShield.h" // sets up and initialize idIoTwareShield
#include <Wire.h>         // Require for I2C communication
idIoTwareShield fs;             // Instanciate CGShield instance

#include <ELClient.h>
#include <ELClientRest.h>
char buff[128];

// Initialize a connection to esp-link using the normal hardware serial port both for
// SLIP and for debug messages.
ELClient esp(&Serial, &Serial);

// Initialize a REST client on the connection to esp-link
ELClientRest rest(&esp);

boolean wifiConnected = false;

// Callback made from esp-link to notify of wifi status changes
// Here we print something out and set a global flag
void wifiCb(void *response) 
      ELClientResponse *res = (ELClientResponse*)response;
      if (res->argc() == 1) 
           uint8_t status;
           res->popArg(&status, 1);

           if(status == STATION_GOT_IP) 
               Serial.println("WIFI CONNECTED");  //Wifi gets connected at this place
               wifiConnected = true;
               Serial.print("WIFI NOT READY: ");//Wifi not connected,check connection
               wifiConnected = false;

void setup() 
      Serial.begin(9600);   // the baud rate here needs to match the esp-link config
      color(255,255,255);   // set white color 
      Serial.println("EL-Client starting!");

      // Sync-up with esp-link, this is required at the start of any sketch and initializes the
      // callbacks to the wifi status change callback. The callback gets called with the initial
      // status right after Sync() below completes.
      esp.wifiCb.attach(wifiCb); // wifi status change callback, optional (delete if not desired)
      bool ok;
         ok = esp.Sync();      // sync up with esp-link, blocks for up to 2 seconds
         if (!ok) Serial.println("EL-Client sync failed!");
       } while(!ok);
      Serial.println("EL-Client synced!");

      // Get immediate wifi status info for demo purposes. This is not normally used because the
      // wifi status callback registered above gets called immediately. 
      ELClientPacket *packet;
      if((packet=esp.WaitReturn()) != NULL) 
          Serial.print("Wifi status: ");

      // Set up the REST client to talk to, this doesn't connect to that server,
      // it just sets-up stuff on the esp-link side
      int err = rest.begin("");
      if(err != 0) 
          Serial.print("REST begin failed: ");
          while(1) ;
      Serial.println("EL-REST ready");

void loop() 
// this function detects the new letter
int new_letter()
      int light_value = analogRead(A3); delay(10);
      int light_value1 = analogRead(A3);delay(10);  
      if(light_value1 >= 510)    //if there is change in light value (New Letter)
          sprintf(buff, "/trigger/new_letter/with/key/XXXXXXXXXXXXXXXXXX");//replace with your Maker channel's API Key
          logToMaker();  //Log to Maker using commands under void LogToMaker()
          // print to the serial port too:              
          Serial.print("New Letter!!");
//function to send POST request to Maker channel    
void logToMaker()
           // process any callbacks coming from esp_link

      // if we're connected make an HTTP request
        {  Serial.println("wifi connected!!");
          // Request  from the previously set-up server
          rest.get((const char*)buff);

          char response[266];
          uint16_t code = rest.waitResponse(response, 266);
          if(code == HTTP_STATUS_OK)     //check for response for HTTP request  
             Serial.println("ARDUINO: GET successful:");
             Serial.print("ARDUINO: GET failed: ");

Custom parts and enclosures

We made our own postbox using cardboard box and chart paper.




Similar projects you might like

Location Display With Idiotware Shield

Project tutorial by 3 developers

  • 3 respects

IOT On Air Sign

Project tutorial by 4 developers

  • 10 respects

IOT - Smart Jar Using ESP8266, Arduino and Ultrasonic Sensor

Project tutorial by Smazee

  • 15 respects

IoT Shield for Arduino

Project tutorial by Mektrasys

  • 14 respects

How To Use To Improve IoT Projects

Project tutorial by Kutluhan Aktar

  • 9 respects

Smart Personal Money Vault Monitoring System Based on IoT

Project tutorial by Salah Uddin

  • 1 comment
  • 11 respects
Add projectSign up / Login