Analyze the Measurement Data on Cloud using Raspberry Pi 4 and Analog Discovery 2
Nowadays, most service providers offer cloud storage. From images to videos, music or movies, they keep files in the cloud to save storage space. Users can get access to the data anywhere and easily share these files with others.
With the evolution of IoT, embedded systems have also started to grow in the cloud area. From development projects to complicated measurements, the industry is moving towards cloud technologies.
Internet of Things (IoT) describes an emerging trend where a large number of embedded devices (things) are connected to the Internet. These connected devices communicate with people and other things and often provide sensor data to cloud storage and cloud computing resources where the data is processed and analyzed to gain important insights. Cheap cloud computing power and increased device connectivity are enabling this trend.
With the Digilent Analog Discovery 2, Waveforms and Raspberry PI 4, you can send measured data and signals directly to the ThingSpeak.com cloud and eventually analyze them.
Analog Discovery 2 is a USB oscilloscope and multi-function instrument that allows users to measure, visualize, generate, record, and control mixed-signal circuits of all kinds. Analog Discovery 2 is small enough to fit in your pocket but powerful enough to replace a stack of lab equipment. Driven by the free WaveForms software, Analog Discovery 2 can be configured to work as any one of several traditional instruments including an Oscilloscope, Waveform Generator, Power Supply, Voltmeter, Data Logger, Logic Analyzer, Pattern Generator, Static I/O, Spectrum Analyzer, Network Analyzer, Impedance Analyzer, and Protocol Analyzer
WaveForms is a software developed by Digilent and intended for use with the Analog Discovery 2 and the Analog Discovery Studio. WaveForms provides a user interface for a 2-channel oscilloscope, logic analyzer, arbitrary waveform generator, digital I/O, and more. It's free to download and compatible with Mac (Apple), Windows, and Linux (32-bit, 64-bit, and ARM).
Step 1: Download WaveForms
This tutorial will guide you through the steps involved in the installation process on a Raspberry Pi 4 Model B after downloading it from the website. We will be using the Raspberry Pi 4 Model B 1GB version within this tutorial. The 2GB and the 4GB versions of the Raspberry Pi 4 Model B also work with this tutorial.
Download the correct installation file for WaveForms for your distribution of Linux. Since we are using a Raspberry Pi 4 Model B with the Raspbian OS, we will choose the Debian flavor of the ARM build.
Step 2: Download Adept 2
Download the correct version of Adept 2. Make sure that the version of the Adept install file is the same as WaveForms. We chose the ARM version for WaveForms, so we will use the ARM version of both the Runtime and Utilities for Adept.
Step 3: Open the Adept 2 File
Open up the file you downloaded for Adept 2 in Step 2.
Step 4: Click Install
Click “Install” in the window when prompted.
Step 5: Open the WaveForms File
Open the file you downloaded to install WaveForms.
Step 6: Click Install
Click “Install” in the window when prompted.
Step 7: Open WaveForms
Go to your applications and open WaveForms.
Step 8: No Device
If you don't have an Analog Discovery 2 plugged in, a window will pop up with a warning stating that no device was detected. You don't need to have a device to run the software, so go ahead and click “OK” to proceed.
Step 9: Run Demo Mode
The device manager will now open. Click on “Demo Mode”, and then click “Select”.
Step 10: Demo Mode Oscilloscope
As mentioned previously, if you don't have an Analog Discovery 2 yet, that's okay. You can still run WaveForms in demo mode and get a feel for the interface and capabilities.
The below image is a demo of the oscilloscope displaying a sine and square wave.
Step 11: Plug in Analog Discovery 2
If you plug in the Analog Discovery 2, a window will pop up indicating that it was detected. Select “OK” to proceed.
Step 12: Device Manager
If you open the device manager, or you have the Analog Discovery 2 plugged in when WaveForms is open, the window displayed in the image below will appear. Select the Analog Discovery 2 just as you did for demo mode.
Now that you are connected and have WaveForms installed, you can view the tutorials for each Instrument on the WaveForms Resource Center.
Sending Data from WaveForms SDK to ThingSpeak.com
ThingSpeak, created by MathWorks, is an online platform for collecting, viewing, and analyzing data in the cloud. This guide runs through the steps required to send data captured by your WaveForms SDK compatible Digilent Test and Measurement Device up to ThingSpeak.
Go to thingspeak.com and sign in or sign up.
In the Channels menu select My Channels and create a New Channel.
Configure the channel settings, name, and fields:
Under API Keys, note the Write API Key that will be needed to push data to the server from the custom application or script:
Download the AnalogImpedance.py script, then edit it and replace the “8C####BU” with the Write API Key, as seen below:
url = "https://api.thingspeak.com/update?api_key=8C############BU"
Run the script on Windows, macOS, Linux desktop, or on an embedded device like Raspberry Pi:
Once the data has been sent to ThingSpeak, the default charts can be seen in the Private View and Public View tabs:
Now that data can be transferred between the test and measurement device and ThingSpeak, the script can be modified as needed for your project.
For more information on WaveForms SDK, see its Resource Center.