Gustavs Andersons
Created December 31, 2024

Turn on and off your computer with google home assistant!

An easy low-cost way to remotely turn on and off your computer with google assistant (Also works with Alexa!).

26
Turn on and off your computer with google home assistant!

Things used in this project

Hardware components

Arduino MKR WiFi 1010
Arduino MKR WiFi 1010
×1
SparkFun 5v relay
×1

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud

Story

Read more

Schematics

Schematic

Code

SmartHome.ino

C/C++
#include "thingProperties.h"

int PCpin = 5;
int lock = 1;

void setup() {
    Serial.begin(9600);
    delay(1500);
    pinMode(PCpin, OUTPUT);
    initProperties();
    ArduinoCloud.begin(ArduinoIoTPreferredConnection);
    setDebugMessageLevel(2);
    ArduinoCloud.printDebugInfo();
}

void loop() {
    ArduinoCloud.update();
}

void onPcPWRChange()  {
    if ( (lock % 2) == 0){
        Serial.print(" Called - PC ");
        digitalWrite(PCpin, HIGH);
        delay(400);
        digitalWrite(PCpin, LOW);
    }
    lock++;
    Serial.print(lock);
}

thingProperties.h

C/C++
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char SSID[]     = "YOR WIFI NAME";    // Network SSID (name)
const char PASS[]     = "YOUR WIFI PASSWORD";    // Network password (use for WPA, or use as key for WEP)
void onPcPWRChange();
CloudSwitch PcPWR;
void initProperties(){
ArduinoCloud.addProperty(PcPWR, READWRITE, ON_CHANGE, onPcPWRChange);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

Credits

Gustavs Andersons
8 projects β€’ 6 followers
Like coding πŸ–₯️ , drone photography + FPV πŸ›« , soldering πŸ”‹ , 3d modeling πŸ–±οΈ , animations & video editing + event lights and audio 🎚️ !

Comments