Data Visualization and Dashboard with Initial State (Single Values)

Data Visualization and Dashboards with Initial State

bg opacity:.75

What do we do with all this data?

  • A single IoT device can generate significant of sensor data
  • A fleet of thousands of devices compounds this
  • A dashboard can help provide visual feedback and control over our IoT devices and data

Example Environmental Dashboard

image-20200724004339825image-20200724005050658

Uses of Dashboards

  • View real-time sensor data
  • Compare data to historical trends
  • Monitor IoT devices for errors or network issues
  • Map devices GPS location
  • Remote control (execute functions) on devices

Dashboard Platforms

Initial State (https://initialstate.com)

  • Initial State is a data visualization service for IoT
  • Send data from Photon 2 to be stored at Initial State
  • Create complex graphs and dashboards with the values from your Photon 2
  • Generous free tier!
  • Initial State can also send SMS and email alerts based on the data (though this requires a paid plan)

Configuring Photon 2 and Initial State

  • The following examples are provided as a quick reference
  • More detailed steps are described in the lecture

Steps to Connect Photon 2 and Initial State

  1. Create account at https://initialstate.com (make sure to use your student email and change )
  2. Create stream bucket at https://initialstate.com
  3. Create an integration -> webhook on Particle console
  4. Write firmware sketch and flash Photon 2

Aside: Access Key (or API key)

  • Many webservices require you to register and then they provide you with an API key (ex: zaCELgL. 0imfnc8mVLWwsAawjYr4Rx-Af50DDqtlx)
  • This randomly-generated string serves as the login and password (credentials) to your account
  • Purposes
    • Account security (no one but you can read / write data)
    • Prevent abuse / hacking
    • Throttling / account limits (enforce limits on read/write frequency)

Example 1: Send Single Data Point from Photon 2 to Initial State

Initial State Settings

img

Example 1: Send Single Data Point from Photon 2 to Initial State

Particle integration settings

image-20210201152825606

Example 1: Send Single Data Point from Photon 2 to Initial State

Particle integration settings

YOUR_CUSTOM_DATA_LABEL > {{{PARTICLE_EVENT_VALUE}}}

img

Example 1: Send Single Data Point from Photon 2 to Initial State

Photon 2 code

double temp;

void loop() {
  temp = 89;		//just example; temp should come from sensor
    
  // Trigger the integration
  Particle.publish("inital_state_single", String(temp), PRIVATE);
  delay(60000);	//use delay or millis to avoid publishing too frequently
}

Exercise - Send Temperature Value to Initial State

  • Connect TMP 36 to Photon 2
  • Read temperature value and send to Initial State

Exercise - Send Temperature Value to Initial State

Screenshot 2024-06-03 at 2.28.35 PM

Credits

Updated: