What is IFTTT

IFTTT stands for – If This Then That. This service is used by users to create small tasks that coordinate Internet and certain web services by creating simple code snippets, conditional statements known as applets. The IFTTT is based on the following rules:

  • The above-mentioned services serve as the building blocks of IFTTT. These services refer to the actions that are controlled by various APIs, such as SMS. Sometimes they may represent a piece of information in the form of weather or stocks. So all these kind of services have two parts: Triggers and Actions.
  • Trigger refers to the first part of IFTTT, that is “this”. As the name suggests, these are responsible for triggering the actions. 
  • Actions refer to the second part of IFTTT, that is “that”. Actions are the result of the input provided by triggers.

So in the case of IoT, IFTTT proves to be an important feature. It can be used in IoT as Sensor as a trigger, posting a tweet, values in certain rage can result in sending a message.

What is ESP8266

It is a low-cost Wi-Fi chip. It has built-in TCP/IP software and microcontroller capability. Features of ESP8266 are as follows:

  • 32 KByte RAm
  • 32 kByte instruction cache RAM
  • 17 GPIO pins
  • SPI

What are LDR Sensors

LDR stands for Light-dependent Resistors. These are light-sensitive devices that are used to measure the intensity of light or to indicate whether the light is present or absent. They are also called photocells or photoconductive cells. These are nonlinear devices that are sensitive and their sensitivity varies with respect to the wavelengths of the light that is applied to them.

Setting up the IFTTT and Webhook for Email

  1. Creating a new applet and naming the event: Search for webhooks on the IFTTT website. Choose the “Request a web request” option.  Name the email confirmation event. And then replace the {event} with this name 
  2. Choosing an action service: Choose the required action service, here Gmail is preferable. 
  3. Filling up the details: value1, value2 and value 3 are set as email address, name and map title respectively. 
  4. Setting the service for the POST request: Request is used to send the post as follows:
    https://maker.ifttt.com/trigger/{event}/with/key/{your_key}
    {event} is replaced with the name created in step 1 and {your_key/} is replaced with the key generated on the documentation page while logged in.
  5. The code for webhook is as follows:
var webhook = 'https://maker.ifttt.com/trigger/aod_email_confirmation/with/key/{key}';
var body = {
  value1: item.email,
  value2: item.name,
  value3: item.title
};
request.post(webhook, {
  json: body
}, function(err, res) {
  if (err) return callback(err);
  return callback();
});
##### Now, this service sends requests to the specified URL and IFTTT handles all the email sending activities. 

Wiring of the ESP8266 with LDR sensor

Requirements:

  • ESP8266 NodeMCU
  • LDR
  • 10-ohm resistor
  • Breadboard
  • Micro USB cable
  • Connecting wires
  • Arduino IDE

Steps:
The LDR output being analogue gets connected to the A0 pin of NodeMCU. 
Set up the connection as shown in the figure.

On the Arduino IDE write down the following code:

void setup() {
	Serial.begin(9600);   // This initialises the serial communication
}
void loop() {
	int sensor = analogRead(A0);   // The input is on pin 0
	float voltage = sensorValue * (5.0 / 1023.0);   // Conversion of analog
  values 
	Serial.println(voltage);   // Printing the values that are read
}

Applications of IFTTT

  • The changes that occur in the apps like Gmail, Facebook and so on, can be detected by using actions that can be further used to decide.
  • An automatic email can be sent using an applet when the user tweets using a certain hashtag.
  • When someone archives a post or photo when tagged by someone on Facebook, the photo gets copied.
Spread knowledge

Leave a Comment

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