Using the Sensor Plotter
Introduction
The Sensor Plotter is a tool to view data from sensors attached to an Arduino on a real-time plot. You can view the data as a time series, histogram, or a scatter plot (with two sensors).
Getting Started
You'll need an Arduino, a Grove Shield, and some Grove sensors. The Basic Senor Kit, for example, has all the necessary components. You'll also need to install the WireGarden browser plugin and load the WireGarden sketch onto your Arduino. The Using Sensors documentation has more imformation.
When you first open the tool it will check to make sure that you have an attached Arduino with the WireGarden sketch, and that you have the most recent version of the WireGarden Library.
Using the Sensor Plotter
Controlling Recording
On the left side of the screen is a control box with buttons to control the Sensor Plotter. The Start and Stop buttons start and stop recording data. The Reset button will erase the data.
Adding and Removing Sensors
When you first open the Sensor Plotter, it will not show any sensors. To add a sensor to the plot, click the More Actions
button and select Add Sensor
in the menu. At this point, a list of the available sensor type will show. Pick the sensor
you'd like to add to the plot.
After selecting a sensor type, you'll be asked to set some options for that sensor. Below is a list of the options you may be asked to set. The sensor type will determine what options are available.
Name
: This is the name that will de displayed on the plot. You can choose any name that will help you identify the sensorPin
: For most sensors, the Sensor Plotter will need to know what pin they are connected to. Select the pin that you have connected your sensor to. Pins that start with D are digital pins, while pins that start with A are analog pins. Make sure that you've connected the sensor to the appropriate pin type.Sub-Type
: Some sensors return multiple values. For example, the BMP085 sensor can return values for temperature, pressure, and altitude. The sub-type determines which value is shown on the plot. You can add multiple sensors to the plot for one physical sensor, each with a different sub-type.
Important A note about available sensors: The WireGarden library has a large list
of sensors that it can communicate with. However, the Arduino Uno does not have enough memory for all of them to be enabled
at the same time. You can use the Options
tab in the Arduino Programmer to choose which types are enabled.
To remove a sensor, click the Remove
button for that sensor in the table under the plot.
Changing Sensor Bounds
In Time Series mode, the vertical axis for each sensor will scale to include only the values between the currently displayed
minimum and maximum values for that sensor. You can instead define a minimum and maximum values which will prevent scaling.
To set bounds values, click the Bounds
button for the sensor in the table below the plot. In the dialog that displays,
select fixed
and fill in the values you'd like to set as the minimum and maximum bounds.
Additional Sensor Information
In addition to the current and past values of a sensor, you can also display the minimum, maximum, mean, median, and
standard deviation. To display this information, click the Info
button for the sensor in the table under the plot.
Changing Data View
To change the data view, select a type in the Data View Modes
box. By default, the Sensor Plotter is in Time Series mode.
Below is a list of the modes and their individual features.
-
Time Series
: In this view you can see a plot of one or two sensors over time. You can use theplot A
andplot B
columns under the plot to select which sensors are shown on the plot. If plot B is selected, and different from plot A, they will be shown stacked, with plot A on top.Time Series mode also supports zooming and panning when the plot is paused. To zoom or pan the plot, click
Stop
to pause data collection. Then click theZoom In
orZoom Out
buttons to control zoom. ClickingZoom Out
when the plot is at its furthest zoom level will re-center the plot. You can click and drag the plot to pan it horizontally. When you click or hover over a portion of the plot, a flag will display the sensor value at that point. This mode also supports linear and quadratic fits on the data. See the Fitting Sensor Data section for more information. -
Data
: In this view, you can see a list of samples by time. Each row shows the values taken for the sensors at that time. -
Scatter Plot
: In this view, you can view a scatter plot of one sensor against another. The sensor selected as plot A is displayed as the horizontal axis, while plot B is the vertical axis. Each point is displayed as a blue dot. Clicking or hovering over a dot will display a flag with the values at that point. -
Histogram
: In this view, the sensor selected as plot A will be displayed as a histogram. Clicking on, or hovering over , one of the bins will display a flag with the count for that bin.
Setting Sensor Options
By default, the Sensor Plotter will continuously record samples from all the added sensors at a rate of 10 samples per
second, and keep 10 seconds of historical data. You can change this behavior by clicking More Actions
and selecting
Sensor Options
from the menu.
On the Sensor Options dialog you are presented with the following options:
Sensor History Length
: This determines how much historical data is kept. The default of 10 seconds means that after 10 seconds, new data starts overwriting the oldest data. You can record up to 24 hours of data.Recording Mode
: There are two ways to record data. The default is continuous. In this mode, the right-most part of the time axis is 0 seconds, or "now". As data is recorded, it moves to the left and is kept for the sensor history length. The alternate mode is stop after history length. In this mode, the Sensor Plotter will record a run of data for the sensor history length and then stop. In addition, the time axis is flipped so that 0 seconds is on the left and new data records to the right.Sensor Sample Interval
: This determines how often a sample is recorded from the sensors.
Fitting Sensor Data
In Time Series mode, you can apply a linear or quadratic fit to the recorded sensor data. The fit only applies to the
data for the sensor that is selected as plot A.
To apply a fit click More Actions
and select either Linear Fit
or Quadratic Fit.
A light green line will be drawn on
the plot to show the fit. A pop-up will display the parameters of the fit line or curve.
By default, all the recorded data is included in the fit. If you only want to use a portion of the plot for fitting, you can set the bounds as well.
Important Setting bounds for a fit will pause recording data to allow you to select the bounds on the plot.
To set bounds, click on More Actions
and select Set Fit Bounds
from the menu. A pop-up will be displayed that has two
buttons: Set Left Bound
and Set Right Bound
. Click the button for either the left or right bound and click on the blue
plot where you would like the bound to be placed. Click the button for the remaining bound and click the plot to place it.
The order of setting bounds is not important and they will switch if you accidentally place them backwards.
Once the bounds are set, click More Actions
and select either Linear Fit
or Quadratic Fit.
As with the global fit,
a light green line will be drawn on the plot to show the fit and a pop-up will display the fit line or curve parameters.
Saving and Sharing Data
If you have a ManyLabs account, you can also save data sets to share with others or view again later. When you have data
you'd like to save or share, click More Actions
and select Save/Share
. A new dialog will be displayed that will ask you
to name your data set and select a sharing level. You can choose to not share the data, share it with anyone that is in the
same class, or share it with everyone.
After the data set is saved it will be available in the View/Edit Data Sets tool.