Create Temperature Sensor Data Graphs With Temboo
Want to learn how to create temperature sensor data graphs with Temboo? Check out this tutorial to learn more about creating a sensor data graph.
Join the DZone community and get the full member experience.
Join For FreeIn this tutorial, we'll show you how to use Temboo's Data Visualization tools to graph temperature sensor data in your browser. Here's what we'll cover:
- Setting up the Texas Instruments LMT84 temperature sensor
- Auto-generating sensor monitoring code
- Accessing your sensor data graph
- Triggering email alerts with your temperature sensor
Monitoring Sensor Data
Before You Start
- You'll need a free Texas Instruments to account to use their online IDE, CCS Cloud. You can sign up here.
- If you haven't already done so, prepare your board for making secure connections by following our Setting up CC3220 for SSL tutorial.
- Log in to Temboo. If you don't already have an account, you can sign up for free.
Set Up Your Sensor
- Once you're logged in, go to our code generation tool and find the Gmailv2 > Messages > SendMessage Choreo. A Choreo is a cloud-based process that connects your CC3220 to any web-based service, and every Temboo application is associated with at least one Choreo.
- Use the drop-down menu at the top of the Choreo page to select a CC3220 board as your device.
- The first step in monitoring sensor data is to set up the sensor you wish to monitor. We provide unit converted data for specific sensor models, such as Celsius and Fahrenheit for temperature sensors. We also support unconverted data, which is reported as raw values for analog data and high/low for digital.
For this tutorial, we're going to read temperature data from a Texas Instruments LMT84P. Our unit conversion formula assumes that your temperature sensor is connected to your CC3320's 5V pin for its voltage in and set up as specified in the sensor's data sheet.
Using the virtual pinboard on the Choreo page, select pin 60 to set up your sensor. Select the category 'Temperature,' then choose the Texas Instruments LMT84LP. - Now that you've selected your sensor, Temboo will give you a choice of unit conversions — we'll use Fahrenheit.
Each time you set up a sensor, you'll be asked to specify the safe bounds and the caution bounds. These bounds are used to determine the color coding of the data that appears on your graph. Safe data is colored green and data near the bounds is orange. Data outside the bounds is red.
Set the safe bounds as 40º and 45º, and the caution bounds as 5º. That's all we need to do to set up our sensor, so press Save. - We will focus on getting sensor data graphs running first. In part two of this tutorial, we will set up the email alert. So, for now, set a condition based on that sensor so that it doesn't trigger the email. Use the conditions interface to set a condition that will always be false so we don't send any emails.
Generate the Code
- Next, we'll generate the code that will send our sensor data to Temboo. Scroll down and find the code box. Click the triangle next to Simple Code to open the code menu and choose Enhanced Code.
- Now, you will register your device. To do so, name your device and, optionally, give it a description. Specify the device location — this will allow you to view your devices on a map. For testing purposes, it's good to set a relatively short sensor interval so that you can see sensor data populate your graphs quickly. You can use the custom interval option for this. Press Save when you're done.
Run Your Code
- Click the "Send to CCS Cloud" button to the right of your generated code. Name your application, then click Send. Click the link that appears to visit the CCS Cloud IDE in your browser.
- Plug your CC3220 board into your computer via USB. Select its USB connection in CCS Cloud via the Target > Connect COM port... menu.
- Now, run the code on your CC3220 from CCS Cloud.
View Your Sensor Data
- Now that the code is running on your CC3220, keep this Choreo page open and save it for later to use with part two of this tutorial. Open a new browser window to head over to your Devices page to see it in action. A virtual representation of your device will be waiting for you.
- Select your new device, and you'll see a sensor data graph for the sensor that you set up. Over time, you'll be able to see sensor data graphs for various time periods. Additionally, at any time, you can request the latest value of your sensors. This is a handy feature for when you're between sensor intervals but want to know what's happening on your device.
That's it! You now know how to monitor sensor data with Temboo. Follow along with part two of this tutorial to add email alerts triggered by sensor values to your new application.
Data visualization
Published at DZone with permission of Jessica Califano. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments