Difference between revisions of "EBC Exercise 38 Logging to ThingSpeak"
m (→Set up ThingSpeak: Added) |
m (→Set up the Bone: Added) |
||
Line 18: | Line 18: | ||
* Click on the '''API Keys''' tab | * Click on the '''API Keys''' tab | ||
* Note the '''Channel ID''', '''Write API Key''' and '''Read API Key''' | * Note the '''Channel ID''', '''Write API Key''' and '''Read API Key''' | ||
+ | |||
+ | == Set up the Bone == | ||
+ | |||
+ | * Go to the ThingSpeak directory on the Bone. | ||
+ | bone$ '''cd exercises/iot/thingspeak''' | ||
+ | * Install | ||
+ | bone$ '''npm install mqtt request''' | ||
+ | * Edit '''keys_office.jon''' to include your API from above. | ||
+ | { | ||
+ | "channel_id": "605714", | ||
+ | "write_key": "TLSN4NNY8B3EKB8Y", | ||
+ | "read_key": "TQ3TK3VAWCDVQHTL" | ||
+ | } | ||
+ | * Save and run. | ||
+ | bone$ '''./temp.js''' | ||
+ | Every 15 minutes it will log the current temp to ThinkSpeak. | ||
+ | * Click on the '''Private View''' tab and you'll see your data plotted. | ||
+ | [[File:ThingSpeakPlots.png|ThingSpeak temperature plots]] | ||
{{YoderFoot}} | {{YoderFoot}} |
Revision as of 14:06, 19 October 2018
Embedded Linux Class by Mark A. Yoder
Here are instructions on how to log data to a ThinkSpeak, a site from MathWorks, the maker of MATLAB
Here's we'll set up ThinkSpeak to log data from two TMP101 sensors.
Set up ThingSpeak
- Go to https://thingspeak.com/ and create an account
- Go to My Channels
- Click on New Channel
- Fill in fields as shown
- Scroll down and click Save channel. You will now see the default plots for the channel
- Click on the API Keys tab
- Note the Channel ID, Write API Key and Read API Key
Set up the Bone
- Go to the ThingSpeak directory on the Bone.
bone$ cd exercises/iot/thingspeak
- Install
bone$ npm install mqtt request
- Edit keys_office.jon to include your API from above.
{ "channel_id": "605714", "write_key": "TLSN4NNY8B3EKB8Y", "read_key": "TQ3TK3VAWCDVQHTL" }
- Save and run.
bone$ ./temp.js
Every 15 minutes it will log the current temp to ThinkSpeak.
- Click on the Private View tab and you'll see your data plotted.
Embedded Linux Class by Mark A. Yoder