Google Assistant Controlled Raspberry Pi GPIO With IFTTT and

Control your device using Raspberry Pi and Google Assistant.


Instead controlling your device through app clicked, now you can try with your voice. This tutorial require Android smartphone with Google Assistant (sorry iPhone and Siri). To program Raspberry Pi, you need to use Particle Web IDE. Please refer to the previous tutorial (link provided below) to get started with Particle IoT platform.


This video will show you how to control GPIO on Raspberry Pi through Google Assistant.

Sample Program

This is sample program for Raspberry Pi using Particle Web IDE.

Program with Particle Web IDE
Board (tested with):
– Raspberry Pi Zero WH
– Raspberry Pi 3 Model A+
const int led1 = D1; // D1 is refer to GPIO17
const int led8 = D2; // D2 is refer to GPIO27
const int buzzer = D8;
bool led1State = LOW; // a virtual boolean variable
bool led8State = LOW; // a virtual boolean variable
bool led8PrevState = LOW;
long prevMillis = 0;
int interval = 500;
void setup()
pinMode(led1, OUTPUT); // led1 pin is set as output
pinMode(led8, OUTPUT); // led8 pin is set as output
pinMode(buzzer, OUTPUT);
digitalWrite(led8, LOW);
// Subscribe to events published by IFTTT using Particle.subscribe
Particle.subscribe("Light_On_Event", lightOnHandler); // Turning on function declaration
Particle.subscribe("Light_Off_Event", lightOffHandler); // Turning off function declaration
beep(2, 70);
void loop()
if (millis() – prevMillis > interval) {
led1State = !led1State;
digitalWrite(led1, led1State);
prevMillis = millis();
if (led8State != led8PrevState) {
led8PrevState = led8State;
digitalWrite(led8, led8State);
beep(1, 70);
// Our events are called when IFTTT applets are triggered
void lightOffHandler(const char *event, const char *data)
led8State = LOW;
void lightOnHandler(const char *event, const char *data)
led8State = HIGH;
void beep(int times, int delayMs)
do {
digitalWrite(buzzer, HIGH);
digitalWrite(buzzer, LOW);
} while (–times);

Thank You


Thanks for reading this tutorial. If you have any technical inquiries, please post at Cytron Technical Forum.

2 thoughts on “Google Assistant Controlled Raspberry Pi GPIO With IFTTT and”

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

DIY Interactive Robot Using REKA:BIT With Micro:bit
BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
DIY Automated Vacuum Cleaner Using REKA:BIT With Micro:bit
Rainbow Spark in Mini House using Maker Uno.
Tutorials of Cytron Technologies Scroll to Top