TELEGRAM WITH RASPBERRY PI

In this video I will show you that how you can connect IFTTT with Raspberry Pi and whenever you send message from your phone chat to raspberry pi and the LED connected to raspberry pi will glow.




STEPS TO DO IT

First you need to open terminal on your raspberry pi and write the following command:-

bash <( curl -sL https://particle.io/install-pi ) After writing it press enter. Then after few seconds it will ask you for an email, password and aname for your raspberry pi to setup an account. Then after setting it up you would have to open build.particle.io  on your computer and sign in with the account you created on your raspberry pi terminal.
Now an IDE will be opened like this :-



After this copy the code given below and paste in the IDE :-

void setup() {
   

  pinMode(D2,OUTPUT);

  digitalWrite(D2,LOW);

 
  Particle.subscribe("your_code", myHandler);//change your_code with a unique code of your wish


}

void loop() {
}

void myHandler(const char *event, const char *data)
{
 

  if (strcmp(data,"led-off")==0) {
    digitalWrite(D2,LOW);
  
  }
    else if (strcmp(data,"led-blink")==0) {

    digitalWrite(D2,HIGH);
   delay(1000);
   digitalWrite(D2,LOW);
   delay(1000);
  }
  else if (strcmp(data,"led-on")==0) {
 
    digitalWrite(D2,HIGH);
  
  }

}

NOTE: DON'T FORGET TO CHANGE your_code with any unique code that do not match with anyone else

After this flash the  code into your raspberry pi by clicking the flash icon located at left.
So with it wirelessly code gets flashed in raspberry pi.

CIRCUIT

Connect LED +ve pin GPIO 27 OF Raspberry Pi
And -ve to GND OF Raspberry pi.

NOW YOU NEED TO DOWNLOAD IFTTT APP AND TELEGRAM ON YOUR MOBILE  
PHONE AND THEN LINK IFTTT WITH TELEGRAM

CLICK ON THE MAKE YOUR OWN APPLETS FROM SCRATCH



CLICK ON THIS IN YOUR PHONE


                                                                 SEARCH TELEGRAM


NOW CLICK ON NEW
 MESSAGE WITH KEY
 PHRASE @IFTTT


WRITE turn on IN KEY PHRASE
 AND ok IN REPLY



CLICK ON THAT 
IN YOUR MOBILE




SEARCH PARTICLE

CLICK ON PUBLISH AN EVENT


NOW IN EVENT NAME WRITE SAME
 UNIQUE CODE YOU HAVE WRITTEN IN THAT IDE

AND IN DATA WRITE led-on
AND CHOOSE PUBLIC
 AFTER THAT CLICK CONTINUE


                       NOW CLICK FINISH



NOW YOU HAVE CONNECTED YOUR TELEGRAM WITH PARTICLE



NOW DO SIMILARY FOR LED BLINK AND TURN OFF LED
REMEMBER THAT YOUR UNIQUE CODE WILL REMAIN SAME IN EVERY APPLET YOU MAKE.

NOW OPEN TELEGRAM SEARCH IFTTT AN IFTTT BOT WILL APPEAR AND WRITE TO IT TURN ON LED TURNS ON
WHEN YOU WRITE BLINK LED BLINKS AND WHEN YOU WRITE TURN OFF LED TURNS OFF.








Popular posts from this blog

ARDUINO WITH PCA9685

ARDUINO WITH KEYPAD