How to Trigger LED using IFTTT and Raspberry Pi

How to Trigger LED using IFTTT and Raspberry Pi

IFTTT (If This Then That) is a free IoT service that allows you to send a trigger from one device, and allow that trigger to make something happen elsewhere. By using IFTTT you can create Applets that work with any device or app that can make or receive a web request.

In this IoT project we use Raspberry Pi with IFTTT to trigger an LED from anywhere in the world. For this we have to create an IFTTT account and then we have to interface it with Raspberry Pi. IFTTT has many services which allow you to control smart washing machine, order Dominos Pizza, use Google Assistant etc from anywhere in the world using internet.


Components Required

  • Raspberry Pi
  • LED
  • Resistor(250 ohm)
  • Breadboard
  • Jumper Wires


Circuit Diagram

Circuit Diagram Trigger LED using IFTTT and Raspberry Pi


Connection in this project are very simple. LED’s positive pin is connected with Raspberry Pi’s 3rd pin while negative pin is connected with a 250 ohm resistor. Other part of resistor is connected with ground pin of Raspberry Pi. 


Step 1:  IFTTT Account Setup

First of all we need to set up our IFTTT account. To create your account go to the IFTTT website ( and select 'sign up' in the top-right corner.

 IFTTT Account Setup Trigger LED using IFTTT and Raspberry Pi


After sign up it will show you a screen asking you to pick 3 services to start off with - ignore that and just click the 'X' in the top-right corner.

After that you'll then be taken to the homepage - that's means your IFTTT account created.


Activate Webhooks Services

Now after creating your account you need to activate your Webhooks services. For this click on your username in the top-right corner.

 Activate Webhooks Services Trigger LED using IFTTT and RaspberryPi


When you click on username you will see some options, from them click on ‘services’.

 Webhooks Services Trigger LED using IFTTT and RaspberryPi


You will see a small selection of services - these are the default services that all users start with. At the bottom of the page, select 'All services'.

In the next page type 'Webhooks' into the filter box, which will single out the webhooks service.

 IFTTT Webhooks Trigger LED using IFTTT and RaspberryPi


Click on the Webhooks icon, then in next screen click on the 'connect' button to enable that channel.

After this you will be directed to the next screen and you'll see a 'Documentation' button appear on the right.

 IFTTT Trigger LED using IFTTT and Raspberry Pi


Now click on that button to find your unique 'key'.

 API Key of IFTTT for Trigger LED using IFTTT and RaspberryPi


Copy your unique key, it will be used in python program to setup connection.


Step 2: Raspberry Pi Setup for IFTTT

If you are using a new Raspberry pi then update it using it these commands:

sudo apt-get update



sudo apt-get upgrade


After updating you Raspberry Pi install libraries that will be used in python program:

sudo apt-get install requests


Note: - You can also use ‘pip’ to install libraries.


Step 3: Python Program

Complete Python program is given at the end of this article. In this python program you will need to change the LED pins according to your circuit diagram and you will also need to change the ‘key’ with your key that you copied from IFTTT page.

You can copy the program and paste in some file and save it using .py extension. First create a file using below command



After creating this file copy your code to this file and save it using CTRL + X and then ‘y’ and Enter.


Then run the python file any time using below command:

python /path/


If it works correctly you will see a “Congratulations you have triggered the LED” in the Raspberry Pi’s terminal window.

 Trigger LED using IFTTT and Raspberry Pi


After this navigate to your IFTTT page in your browser and click on test button. When you click on test button LED will be triggered Off/On.

 API Key of IFTTT for Trigger LED using IFTTT and RaspberryPi


import requests
import RPi.GPIO as io
import time
from time import sleep

while True:

        data =" Trigger/with/key/hUAAAz0AVvc6-NW1UmqWXXv6VQWmpiGFxx3sV5rnaM9")
        print data.text
        if (data.text=="1"):
          print 'led on'

        elif (data.text=="0"):
         print 'led off'


data.text ist "Congratulations you have triggered the LED

never "1" or "0"

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.