Asking Amazon Alexa for the temperature and humidity from a Particle Photon
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
alexa
ino
.gitignore
LICENSE.md
README.md

README.md

particle-weather-station-alexa

Ask Amazon Alexa for the temperature and humidity from a Particle Photon. A DHT11 sensor is used to measure the data, and the variables are exposed through the Particle Cloud. The Alexa skill then gets the data using the JavaScript Particle API.

See particle-weather-station for the original version of this project that visualizes the data on a realtime dashboard.

Note: You don't need an Amazon Alexa device to get started... although it's certainly more fun if you have an Echo, Tap, or Dot! You can use Echosim.io, which is a web-based Alexa skill testing tool.

Supplies

Setting up Particle

Hardware configuration

Go through the Particle Photon Getting Started Guide to get your Photon up and running. Then, wire up the board.

Here's a picture of the circuit:

Circuit

And, here's a schematic that makes the wiring a bit clearer:

Schematic

First, let's wire up the Photon:

  • Place the Photon on the left side of the breadboard.
  • Connect a jumper wire from the 3V3 pin to the power line of the breadboard.
  • Connect a jumper wire from the GND pin to the ground line of the breadboard.

Now, let's wire up the DHT11 sensor:

  • Add the DHT11 sensor to the right side of the breadboard, with the perforated side facing you. Note that there are 4 pins, from left to right: VCC, Data out, Not connected, and GND.
  • Connect VCC to one of the breadboard's power pins.
  • Connect GND to one of the breadboard's ground pins.
  • Connect the Data out pin to D5 of the Photon.
  • Connect the resistor between the VCC and data pins.

Using the Particle Dev IDE

  • Download the Particle Dev IDE and follow the instructions on how to log into your account and select your device.
  • Open ino/dht11.ino in the IDE.
  • Send the code to the board
    • Select the Compile button. If it's compiled successfully, the status bar on the bottom should say, "Success!"
    • Send the code to the board by selecting the Flash button. Again, if it's successful, the status bar should say, "Success!"

Setting up Amazon Alexa Services

AWS Lambda Setup

  1. Navigate to particle-weather-station-alexa/alexa/src
  • Type npm install to install the required Node.js packages
  • Zip up all the files in the src folder—including node_modules— but not the src folder itself!
  • Go to your AWS Console and navigate to AWS Lambda
  • Make sure the region is US East (N. Virginia)
  • If you have no Lambda functions yet, click Get Started Now; otherwise, click Create a Lambda Function
  • Skip the step Select blueprint
  • In Configure triggers, select Alexa Skills Kit from the gray dotted box, then click Next
  • In Configure function:
    • Name: ParticleWeatherStation
    • Runtime: Node.js 4.3
    • Code entry type: Upload a .ZIP file
      • Select the .ZIP file created in step 3
    • Handler: index.Handler
    • Role: Choose an existing role
    • Existing role: lambda_basic_execution
    • Memory (MB): 128
    • Timeout: 0 min 8 sec
      • I increased the default from 3 sec to 8 sec to give enough time for the request to process
    • VPC: No VPC
  • Then, create the function
  • Make note of ARN for the new Lambda function, which is on the upper-right of the function page... you'll need this when setting up the Alexa skill

Alexa Skills Setup

  • Go to your Amazon Developer Dashboard and select Alexa
  • Select Get Started with Alexa Skills Kit
  • Select Add a New Skill
  • In Skill Information:
    • Skill Type: Custom Interaction Model
    • Name: ParticleWeatherStation
    • Invocation Name: particle weather station
    • Audio Player: No
  • In Interaction Model:
    • Intent Schema: Copy and paste the content from particle-weather-station-alexa/alexa/speechAssets/IntentSchema.json
    • Custom Slot Types: Select Add Slot Type
      • Enter Type: LIST_OF_SENSORS
      • Enter Values: Copy and paste the content from particle-weather-station-alexa/alexa/speechAssets/slotValues.txt
    • Sample Utterances: Copy and paste the content from particle-weather-station-alexa/alexa/speechAssets/SampleUtterances.txt
  • In Configuration:
    • Endpoint: Lambda ARN
      • Copy and paste the ARN from the last step of AWS Lambda Setup
    • Account Linking: No

Using Echosim.io

  • Go to Echosim.io
  • Try out either one of these commands:
    • Alexa, ask particle weather station for the temperature
    • Alexa, ask particle weather station for the humidity

And, Alexa should respond with the current value, depending on which value you asked for! You can also try this out with your own Alexa-enabled device.

References