The following is a detailed description and tutorial on the use of ppLOGGER – an open source multi-channel data logger for the Raspberry Pi. Data loggers are used for a number of applications such: monitoring data from an experiment, logging temperature, pressure, humidity and other values, and controlling a processes. By combining the ppLOGGER software with a DAQCplate, you will have access to features that would cost hundreds of dollars from other companies. And, since you can stack up to eight DAQCplates together, ppLOGGER will allow you to log up to 64 analog channels and 64 digital channels.
With ppLOGGER you will connect signals to the Analog and Digital inputs of your DAQCplate. The location of these inputs is shown in Figure 1:
ppLOGGER is designed to run under the X-windows environment on the Raspberry Pi and is written in Python using Tkinter and PMW for the graphical user interface. Note that this software is copyright 2016 under version 3 of the GNU General Public License. The terms of this license can be found in the Help menu or at this link: http://www.gnu.org/licenses/gpl-3.0-standalone.html
To use ppLOGGER you will need the following:
- A Raspberry Pi running the Jessie build (or later) of the Raspian operating system. While this program should run on any version of the RPi, we recommend a version 2 or 3 as a minimum.
- At least one DAQCplate from Pi-Plates. If you don’t have one yet, we invite you to visit our website at https://pi-plates.com and check out our products.
- Version 1.02 or later of the DAQCplate Python module. Use “sudo pip install pi-plates” if you have a new setup or “sudo pip install –U pi-plates” to update.
- The PMW megawigdets. Use “sudo apt-get install python-pmw” at the command line to install.
- The Initial State module if you wish to stream your data and watch it in real time. Use “sudo pip install ISStreamer” to install their Python module then visit initialstate.com to register and create a key.
- This program runs at a fixed screen size of 800 x 600. Therefore, it is recommended that the screen resolution be 1280×720 or greater. If you are using VNCSERVER for remote access or headless operation, be sure to set the GEOMETRY option to 1280×720 or greater.
Finally, you will need to download and install ppLOGGER:
- Download the files from our server with: sudo wget https://pi-plates.com/downloads/ppLOGGER-1.0.tar.gz
- Then decompress them into your home directory: sudo tar -xzvf ppLOGGER-1.0.tar.gz
- Finally cd the directory to ppLOGGER folder with: cd ppLOGGER-1.0
Main Screen Elements
Launch ppLOGGER by opening a terminal window in your X-windows environment and typing the following at the command line:
sudo python ppLOGGER.py
The opening screen of the ppLOGGER is shown in Figure 2 below. There are five primary areas highlighted:
- Menubars: this is where you’ll open log files, make and save global setup values, start and stop data logging and view your data. All of these options are covered in excruciating detail below.
- Tabs: ppLOGGER will display a selection tab for each DAQCplate on the stack. To see the real time data from a particular DAQC or to change the selected channels, just click its tab.
- Bulk Channel Controls: these two buttons provide a simple means of selecting or deselecting all of the input channels on the selected DAQCplate.
- The Channel Select Box / Name / Current Value: these three fields are displayed for each input channel on the selected DAQCplate.
- By checking a channel select box, you will be able to monitor its value in real time on the Input Window to the right as well as saving the values to a file when a logging session is executed.
- The channel name field can be changed to reflect a more descriptive name of your input signal. This name will be saved to the log file along with the data. To modify, just click anywhere in the text box to edit the default title.
- The value shows the current measurement of a channel if it is enabled.
- Analog and Digital Input Widows: these are mini real time plots of each selected channel. There are approximately 600 points on each graph with the newest data appearing on the right and old data sliding off to the left.
Note that the ppLOGGER screen size is fixed and cannot be changed.
There are three operational modes when using the ppLOGGER: Idle/Setup, Logging, and Viewing Logged Data.
Idle / Setup
This is the default mode for ppLOGGER. It is here where you can select the channels you wish to monitor, change their names, create a logging file, test your setup, save and restore configurations, and enter your Initial State streaming parameters.
There are four steps for creating a log:
- Choose a log destination: stream, file or both.
- If saving data to a file, create or open a log file
- Select the sample rate and sample count for your log
- START the log
Saving to a File
If you choose to save your log to a local file, click on the File->Open New File for Logging:
A new dialog box will pop up and prompt you to enter the name of your new log file. You can also over write an existing log file. Note that all log files are automatically assigned the extension “log.” Once you have typed in or selected you file click the Save button. If you chose to over write an existing file, the system will ask you to verify this action. When you are done with this step, the data from all selected channels will be written to this file while the program is in the Logging mode.
In addition to saving your log data to a file, it is also possible to stream directly to the Initial State service. There are many advantages to streaming including:
- Viewing your data in real time – something we don’t recommend when saving to a file.
- Viewing your data from anywhere using a web browser
- Beautifully formatted graphs which can be manipulated to best view your data
Initial State has a number of cost tiers including a free one so there is no downside to using their service. Assuming you have already installed the ISStreamer Python module then you should see the “Streaming” under the Setup menu:
Clicking this will cause the following menu to popup:
Here you can enter your assigned stream key as well as the bucket name (visible) and bucket identifier (hidden; also known as bucket key) for your data. Again, visit www.InitialState.com for more detail.
To enable analog and digital test signals on the DAQCplates in the stack, select the Setup -> Test Signal menu item and select the signals you want. If digital test signals are chosen the seven Digital Output pins on each DAQCplate (see Figure 7) will start to count from 0 to 127 before repeating. Connect these outputs to any of the digital inputs you want to test.
In a like manner, the two Analog Output pins on each board (see Figure 8) will start generating sine waves. Again, attach these pins to Analog Input terminals to test your analog inputs. The signals captured in Figure 6 were generated with these test signals. Note that the update rate of these signals is equal to the sample period.
Sample Rate / Count
To change the sample period and count, go to Setup->Logging via the menu bar. A small menu will pop up and you will be to modify these two values. A couple of things to note:
- The minimum sample period is dictated by the number of DAQCplates on your stack. A single DAQC will require 0.2 seconds to capture all eight analog inputs, capture all eight digital inputs, and to update the miniplot in the ppLOGGER window. Two DAQCplates will force the minimum period to 0.4 seconds. Three will force it to 0.6 and so on. So, for maximum sample rates, keep your DAQC count low.
- The Log Duration is the product of SampleCount X SamplePeriod. So, if you choose a Sample Period of 0.4 seconds and you set the Sample Count to 1500, then the logging duration shall be 1500 X 0.4 = 600 seconds or 10 minutes.
Note that the Period and Count values are part or the information saved when you choose File -> Save Configuration.
As mentioned previously, you can choose the channels on each DAQCplate that you want to monitor simply by clicking the checkbox in front of its name as shown in Figure 2. You can also edit the channel names by clicking in the text field and changing the default entries to values that are more descriptive of their source. Your data from your selected channels and the custom names will be saved to the log file.
Saving and Restoring a Configuration
In the File dropdown menu in Figure 3 there are commands for Saving and Restoring the Configuration. This is a pretty handy feature if you have a setup that you plan to use repeatedly. The configuration will include the selected channels, their names, the sample period, the sample count, and your optional streaming parameters.
Be advised that if you save a configuration and then modify your stack by adding or removing a DAQCplate, the ppLOGGER program will show an error message when you try to restore that old configuration.
The moment has finally arrived! You’ve created a log file and set up you sample time and count. Maybe you selected and renamed specific channels and setup a streaming pipe as well. It’s logging time. Actually, it’s pretty anticlimactic: just click the word START on the menu bar and ppLOGGER will start saving data to your selected file and/or streaming it to the Initial State cloud. The status of the logger along with the remaining number of samples and time to completion will be displayed in the title bar of the program as shown in Figure 10. After the logging has completed, you will be alerted with the message shown in Figure 11
If for any reason you want to halt the logger then simply click on the word STOP in the menu bar.
A few things to note:
- If you stop a log and then click START again, the data previously saved to your log file will be lost. To avoid this, choose a new log file before starting another session.
- If you’re streaming to the Initial State service, restarting after a STOP will simply append new data to the old data.
Also note that while logging, most menu items are disabled.
Viewing Logged Data
ppLOGGER saves data to files in a format called CSV or Comma Separated Variables. This format makes it easy to read with a simple text editor. CSV files can also be imported into many popular spreadsheet programs such as LibreOffice Calc. which comes preinstalled on the later Raspian distributions for the Raspberry Pi.
The program provides four methods to view your log data. To access these, click VIEW on the menu bar. The following buttons will then pop up.
Be advised that some of the VIEW options such as Plot can cause the logging process to pause.
Clicking the Plot Data button will bring up a simple data plotter that draws all of the data in a log file on a single pair of scales. One scale is for all of the data collected on the analog inputs and the other scale is for all of the collected digital data. Open an existing log file by following the prompts and you will be presented with a screen similar to Figure 13.
Clicking this button will simply bring up an information box with the URL of Initial State. You will need to log into their site to see your streamed data. One advantage of logging to the stream is that you can view your log data in real time without pausing the process.
Clicking the View Data File and following the prompts allows you to view your raw log data using the Leafpad text editor that comes installed on Raspian (Figure 14).
The first line of text is the channel names while the remaining lines are a time stamp followed by the channel data. Analog data is represented by numbers in a decimal format (3.82, 2.96, 1.00, etc.) while the digital input data is represented by ones and zeros.
While you can edit this file, be careful not to delete any of the commas separating the data. Otherwise, you won’t be able to plot it correctly using the built in Plot program or open it with LibreOffice Calc.
The final button, Open Data in Spreadsheet passes the selected log file to LibreOffice Calc. When this occurs you will be prompted to choose the delimiter that separates the data in your file as shown in Figure 15. Click the checkbox in front of “Comma” followed by the OK button. Your log file data will now be presented to you in tabular form.
By using Calc, not only is your data organized and viewable in a nice clean format (Figure 16) but it’s also possible to plot it out using a number of different formats.
For example, while holding down the shift button, click on columns headers A, B, and C. Then click on the Plot Functions Icon. A preliminary plot will appear but we’re going to create a simple line graph. Choose that now and then stick with all of the default values. When finished, you should have a graph similar to Figure 18.