Background

The last studio introduced integrations using WebHooks as well as new hardware (the OLED display and Piezo) and the mini-studio introduced IFTTT as a tool for combining different services.

Objectives

The objectives of today’s Studio are:

  • Continue working with IoT integrations via webhooks
  • Continue to work with IFTTT
  • Investigate the use of webhooks to coordinate different web services/platforms
  • Develop an example of IoT data logging

1. Studio Setup

1.1. Find a Group & Get Roll Assignments

Roles for today are posted here

Please take your role seriously. When you get your role, review the responsibilities and make sure you follow through on them.

Role Reminders
  • Common Roles
    • Participate in discussion and work
    • Review & revise the final report for the studio
  • Manager
    • GitHub: Create group (following the naming convention) & Verify that everyone else joins it
    • Time management: Ensure the group is making progress, is on-task, and asks for help when stuck
    • Human Resources: Ensures civil conduct of all members
    • Submission management: Ensure the group completes and submits all parts of the studio on-time
    • Hardware / Wiring Review: Review any circuitry for safe operation
  • Recorder
    • Record who will be taking on each role (complete process/Roles.md)
    • Compose answers to questions in README.md
    • Record details of the studio session (complete process/SessionNotes.md):
      • Notes on the session (what was said, order of work, etc.)
      • Summarize important findings or techniques
      • Summarize outstanding questions or issues
  • Spokesperson
    • Enter the group’s answers for the questions in process/Debrief.md
    • Report out the results of the Studio at checkout
    • Coordinate and schedule out-of-class meetings if necessary.
    • Organize parts for circuits
  • Technician
    • Create project code
    • Assemble any circuits
    • Enter/modify code
Special Circumstances: Groups of three

Groups of three will be allowed if:

  • You plan to work with someone who is absent and all members of the group agree to work as a group of three for this studio.
  • There aren’t enough people present to form groups of four.

In groups of three the Manager must also take on the responsibilities of the Spokesperson.

1.2. Studio Distribution

As in the previous studios, all group members will need to be in a GitHub group (and repository)

  • The group’s Manager should create the repository. The GitHub group name should include the surnames of all group members.
  • All other members should join the group.

The link for this studio is: https://classroom.github.com/g/cIDDPhAu

Today the Recorder, Technician, and the Spokesperson will want to be able to work with the repository (i.e., it should be on at least two computers). The Technician will be working with the Photon (C++).

1.3. Recorder

The Recorder should update process/Roles.md to record everyone’s roles for this studio (use full names). In addition, the Recorder should take notes about the interaction of the overall session. Be sure to pull/merge/commit/push at the end of the day!

1.4. Spokesperson

Today you will be doing the bulk of recording answers to questions. Read the questions in process/Debrief.md to the group and the group should come to a consensus for each. Be sure to enter the responses. Be sure to pull/merge/commit/push at the end of the day!

1.5. Technician

The Technician will be programming the Photon and the UI. Consequently their computer will need to be logged into the account for the Photon being used for testing. (Particle Desktop will need to be logged in)

You will be managing the code for today’s studio. DO NOT open it in Particle Dev. Instead create new projects within the repo folder. Be sure to pull/merge/commit/push at the end of the day!

2. Studio: Examples

This studio will work through some examples and require that you build comparable examples from them.

2.1. Temperature Logger

Work through the Temperature Logger tutorial, but heed the following modifications:

  • The Technician should create a new project (using Particle Dev) within the repo folder. Name the new project TempLogger
  • When you get to adding the OneWire library, add it via the Browse and Manage Particle Libraries button on the left button ribbon. (The one that looks like a bookmark)
    • Search for OneWire (2.0.1)
    • Click the Use button.
    • Click the Copy to current project button
    • Update the main .ino to include the library by adding the following to the file (before any actual code):
      #include"OneWire.h"
      #include"DS18.h"
      
  • Add the code for the temperature logger and verify that you see events being published.
  • Review the code
  • For the *that, search for Sheet to find the ability to interact with google sheets. You may need to connect the Particle account to a Google account.
    • The “Created At” string shown in the *that is highlighted to indicate that it was entered via the Add ingredient button. It’s a special string that will be replaced with data. You can either use Add ingredient or type "{{CreatedAt}}" . Notice the use of both double quotes to ensure a string is used in the cell and the {{}} notation to ensure the event variable is used.

Complete README.md Q1.1-1.2

Update your circuit and code so that it uses both temperature sensors in your kit at the same time.

  • Hint: Wiring changes can be very minor as can code changes (~3-4 lines)).
  • Publish the two temperatures as separate events or combine them into a single string and only publish when both have been received.

2.2. PIR and Slack Integrations

Work through the Conference Room Monitor tutorial, but heed the following modifications:

  • The Technician should close/remove the previous project and reate a new project (using Particle Dev) within the repo folder. Name the new project ConfMonitor
  • The URL for the hook requires a HTTP POST. Use Hurl.it to test the URL for the webhook.
    • The message body should be the JSON provided in the example.
    • Note that Particle replaces content in {{}} with variable values. When using Hurl.it you should replace this with data you want to use.
  • It may be easier to test your work by connecting D0 to GND and VIN to simulate an empty or full room respectively.
  • The provided code doesn’t actually send the message correctly (It’ll say “The conference room is null”). Update it so the message posted to slack is “The conference room is available” when the room is actually available.
  • The provided code also doesn’t indicate when the conference room is in-use correctly. Update it so when the room is in-use the message “The conference room is inuse” is posted to the slack channel.

Complete README.md Q2.1-2.2

3. In-Class Checkout

Commit your work to GitHub:

  • The Spokesperson should complete changes, save them, commit them locally, then push to GitHub using GitHub desktop.
  • The Recorder should save any changes, commit them locally, use GitHub desktop to Pull and merge any changes to the repo, and finally Commit/Push the additions back to GitHub.
  • The Technician will be using the cloud-based IDE today, but code will still need to be merged into the repo locally.
  • Verify your commits from the Recorder, an Spokesperson, and Technician are on GitHub.
  • Show a TA your progress

4. Post-Class Checkout

Complete any unfinished work and commit it to your repo by 11:59pm Sunday, April 1st.