This page is going to discuss how to use the CN0549 Machine Learning Enablement Platform for streaming high fidelity analog sensor data from a device under test (DUT), into to the Python based data analysis tools such as Tensorflow and Keras. The goal is that once you have the data in these tools, you'll be able to create your own algorithms and train your system using your own data.
This page will outline how to get the data from the sensor all the way to Python, using open source hardware and software from Analog Devices. At the end of this page links will also be provided to specific examples done in Tensorflow or Keras, where you can recreate each examples using the training data and scripts provided.
This user guide page assumes that you have the complete CN0549 system put together. This includes both hardware and software setup. If you have not completed this step, please refer back to the CN0549 user guide on how to get setup.
pip install pylibiio
pip install pyadi-iio
The user guide shows the USB OTG connector and the HDMI cable installed, but those two steps will not be needed here since we are streaming data over the network into the laptop.
If you don't have a network available and want to stream data directly from the Ethernet port of the DE10-Nano to the Ethernet port of your PC that is still possible, but requires some extra configuration. Please see the Network Configuration page for complete details.
PPT picture of high level block diagram for the hardware and software
Before you can start gathering data, you first must locate the CN0549 system setup on your network.
For Analog Devices Kuiper Linux
Username = analog and Password = analog.
Press the Enter key between each.
With your system fully setup, it's now time to stream data directly into Python.
Data streaming and device control are provided through the python classes in pyadi-iio. Devices or sensors which connect through the CN0540, such as the CN0549, will share a common base class called adi.cn0540. However, each specific sensor will have its own class that will contain documentation, methods, and properties specific to it. Therefore, end-users should always use the python class associated with the sensor and not the CN0540.
Below is a basic example where we will talk to a CN0540 with CN0549 attached. This is done remotely from a host PC, but can be done locally on the board or through another backend. See the pyadi-iio doc for more information. This example can be downloaded from GitHub directly.
# Import the module import adi # Define the URI we use to connect to the remote device uri = "ip:analog" # Connect to the device xl = adi.cn0532(uri) # Set number of samples to capture xl.rx_buffer_size = 2**12 # Pull rx_buffer_size samples back from the device data = xl.rx()
The example above can be run from a command prompt of terminal as so:
or by loading into your favorite editor like Spyder, VSCode, or PyCharm. Once run the return object
data will be a numpy array of 32-bit integers of shape
(2^12,1). Numpy is a common type used in many numerical libraries.
A key purpose of the CN0540 platform is to help aid in condition-based monitoring applications. A common tool used in that space is machine learning, where algorithms are trained for system identification, anomaly detection, or for other purposes. For those familiar with Tensorflow an example has been created to outline a machine identification problem, with datasets created from the CN0540+CN0549 mounted to a physical piece of hardware. This example is provided in the form of a Jupyter Notebook, which is a common medium for sharing code and implementations.
End of Document