Skip to content

Commit 155b20e

Browse files
Merge pull request #1939 from arduino/Hannes7eicher/Google-Home
Add Google Home™ Docs
2 parents 52feef5 + ee42b8b commit 155b20e

File tree

6 files changed

+132
-0
lines changed

6 files changed

+132
-0
lines changed
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
title: 'Google Home'
3+
description: 'Learn how to connect the Arduino Cloud with Google Home™.'
4+
tags:
5+
- Google Home
6+
author: 'Hannes Siebeneicher'
7+
featuredImage: 'cloud'
8+
---
9+
10+
## Introduction
11+
12+
This tutorial guides you on how to connect the Arduino Cloud to your Google Home™ allowing you to interact with your devices, simply through your Google Home Assistant: use voice commands, the Google Home app, or create new routines integrating Arduino solutions.
13+
14+
It requires your board to be [compatible with the Arduino Cloud](https://docs.arduino.cc/arduino-cloud/hardware/devices/).
15+
16+
## Goals
17+
18+
The goals of this tutorial are:
19+
20+
- Create a Google Home compatible variable.
21+
- Control the built-in LED with Google Home.
22+
23+
## Hardware & Software Needed
24+
25+
- [Arduino Cloud](https://cloud.arduino.cc/).
26+
- [A Cloud compatible Arduino board](https://docs.arduino.cc/arduino-cloud/hardware/devices/).
27+
- [Google Home™](https://home.google.com/welcome/).
28+
29+
To familiarize yourself with the Arduino Cloud check out our [getting started guide](https://docs.arduino.cc/arduino-cloud/guides/overview/).
30+
31+
## Cloud Setup
32+
33+
Before we start, make sure you have an Arduino Cloud compatible board.
34+
35+
Then, we need to configure a Thing in the [Arduino Cloud](https://app.arduino.cc/things) consisting of one CloudSwitch variables called `led`. Follow the instructions below to do so.
36+
37+
### Thing & Device Configuration
38+
39+
1. Create a new Thing, by clicking on the **"Create Thing"** button.
40+
2. Click on the **"Select Device"** in the **"Associated Devices"** section of your Thing.
41+
3. Click on **"Set Up New Device"**, and continue to set up your device.
42+
43+
If you need more information on how to set up your device check out our [getting started guide](https://docs.arduino.cc/arduino-cloud/guides/overview/#2-configure-a-device).
44+
45+
### Create Variables
46+
47+
The next step is to create a Cloud variable, which we will later interact with via Google Home.
48+
49+
1. While in Thing configuration, click on **"Add Variable"** which will open a new window.
50+
2. Name your variable `led`, select `Smart home`, and select it to be of a `Switch` type.
51+
52+
![Create Variable](./assets/thingConfig.png)
53+
54+
3. Click on **"Add Variable"** at the bottom of the window.
55+
4. Make sure the **Smart Home Integration** is set to Google Home.
56+
57+
![Smart Home Integration](./assets/smartHomeIntegration.png)
58+
59+
***Most Cloud variables are compatible with both Alexa and Google Home but there is an icon on the right side of the type that indicates the compatibility***
60+
61+
Your Thing should look something like this when you are finished:
62+
63+
![Finished Thing interface.](./assets/thing.png)
64+
65+
***Learn more about how variables work in the [Variables documentation](/arduino-cloud/cloud-interface/variables)***
66+
67+
### Upload Sketch
68+
69+
Navigate to the Sketch tab and upload the following sketch to your Arduino board.
70+
71+
```arduino
72+
73+
74+
#include "thingProperties.h"
75+
76+
void setup() {
77+
// Initialize serial and wait for port to open:
78+
Serial.begin(9600);
79+
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
80+
delay(1500);
81+
82+
// Defined in thingProperties.h
83+
initProperties();
84+
85+
// Connect to Arduino IoT Cloud
86+
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
87+
88+
/*
89+
The following function allows you to obtain more information
90+
related to the state of network and IoT Cloud connection and errors
91+
the higher number the more granular information you’ll get.
92+
The default is 0 (only errors).
93+
Maximum is 4
94+
*/
95+
setDebugMessageLevel(2);
96+
ArduinoCloud.printDebugInfo();
97+
}
98+
99+
void loop() {
100+
ArduinoCloud.update();
101+
digitalWrite(LED_BUILTIN, led);
102+
103+
}
104+
105+
106+
/*
107+
Since Led is READ_WRITE variable, onLedChange() is
108+
executed every time a new value is received from IoT Cloud.
109+
*/
110+
void onLedChange() {
111+
// Add your code here to act upon Led change
112+
}
113+
114+
```
115+
116+
Your board setup is now complete and you can continue to the Google Home app.
117+
118+
### Detect Your Device with Google Home
119+
120+
- **Network Connection:** Ensure the board is connected to the network.
121+
122+
- **Google Home App:** Open the app, navigate to Devices, and click "Add Device."
123+
124+
- **Integration Method:** Select "Works with Google Home" and then choose the "Arduino" action.
125+
126+
![Setup Device](./assets/googleHome_1.png)
127+
128+
- **Device Pairing:** Link your Arduino account if requested and proceed to add your devices (one for each variable) by associating them with a room.
129+
130+
![Link Accounts](./assets/googleHome_2.png)
131+
132+
**Congratulations!** Your device is now successfully configured to work with Google Home.

0 commit comments

Comments
 (0)