element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • 'Choose another store...'
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Test & Tools
  • Technologies
  • More
Test & Tools
Blog Sound and Vibration Measurement: Instrument Network Service for LabVIEW Pt5: Beta phase of functionality - Acquisition Data stream to LabVIEW works
  • Blog
  • Forum
  • Documents
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Test & Tools requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 18 Apr 2022 1:49 PM Date Created
  • Views 1665 views
  • Likes 5 likes
  • Comments 8 comments
  • RoadTest
  • raspberry
  • mcc172
  • daq
  • labview
  • scpi
Related
Recommended

Sound and Vibration Measurement: Instrument Network Service for LabVIEW Pt5: Beta phase of functionality - Acquisition Data stream to LabVIEW works

Jan Cumps
Jan Cumps
18 Apr 2022
Sound and Vibration Measurement: Instrument Network Service for LabVIEW Pt5: Beta phase of functionality - Acquisition Data stream to LabVIEW works

For the Sound and Vibration Measurement Hat for Raspberry Pi road test, I'm reviewing Measurement Computing's IEPE Measurement DAQ HAT for Raspberry Pi.
The next series of posts are going to be a subplot. I'll make software to remotely control the DAQ, via LabVIEW.
In this post, everything is functional and in Beta status.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

I listed set a set of goals before the start. They are all implemented and working:

  • remotely accessible Instrument service
  • remotely accessible SCPI wrapper service
  • LabVIEW driver with example
  • support for all configuration parameters except trigger
  • support for finite and/or continuous data logging from LabVIEW or other remote application

All images and screenshots in this blog are from the actual designs. They reflect the status at the time of writing

Since previous post, I changed the data streaming approach. I was streaming doubles in readable format, because it's easy for a human to interpret the data. But that advantage didn't weight up against the issues I'd have to solve.
Because the readable format is variable in length (unless I'd allow for a silly length fixed string that could handle maximum positions before and after decimal sign), it becomes difficult to size buffer and make a nice cut in the data stream.

I've chosen (shabaz helped a lot while balancing the design options) to send the data in the Pi's microprocessor native 8 byte format. It makes the processing easier for both the C++ Instrument Service and the LabVIEW flow. I also found a way to help interpreting and validating the streamed data: I made a Dummy Instrument Service, that behaves identical to the real service I developed before, but mocks the data stream. Because I know how the stream is mocked, and what/how much data to expect, it makes validation at the LabVIEW side straightforward. It also allows for automated test of the whole integration.

Dummy Instrument Service

I made a mockup MCC172 instrument service for 2 reasons: to help with stream validation, as I wrote before. But also because fellow element14 member martinvalencia is helping with advanced vibration data analysis. Martin doesn't have a MCC172 hat. The dummy service will be our mechanism to work together. We can mock up any data set and make the dummy stream it. LabVIEW doesn't have a clue wether it's talking to the Hat or to the dummy service.

Currently, as proof of concept, the service streams the requested number of samples. The first value is the minimum range of the DAQ: -5.0 V. Each next sample adds 0.000001 V to it.

void scan(DaqHatInstrument* dh, tcp::acceptor* dataacceptor, tcp::socket* datasocket, uint32_t samples_per_channel) {

	dataacceptor->accept(*datasocket);

	int num_channels = dh->scanChannelCount();

    for (int i = 0; i < (int)samples_per_channel * num_channels; i++) {
        double val = (-5.0 + i*0.000001);
        boost::asio::const_buffer buff(&val, sizeof(val));
        datasocket->send(buff);
    }
}

This algorithm is simple on purpose. Easy to validate for precision, count, hick-ups, breaks and data loss.  

Switch from readable stream to binary flow, Mock Instrument Service

When I changed the data stream to binary, it had impact on the LabVIEW side. In my previous blog I used a common VISA connection to open the data port. In order to read the binary flow, I need to dip a level lower: the plain TCP LabVIEW blocks.

image

The 8 bytes double representation of a double isn't compatible with LabVIEW's binary format. I had to do some bit-fiddling to translate the binary stream into doubles (luckily, something I did before when writing a driver for a Multicomp Pro function generator).

First I had to translate the TCP chunk into 8 bytes.

image

Then translate that into a float. The bit order is OK, but bytes order is inverse.

image

Example Flow

image

The example flow proves the whole setup. It asks for a set of samples, collects the results and shows them on a LabVIEW waveform chart. I was able to keep the Producer-Consumer pattern that I tried in the previous post - turns out it's doing rather well. The image above shows how it's doing while running against the dummy instrument service. Below is how it behaves when the real DAQ hat is streaming data.

image

All software is available for download. Quality is beta. Functional, with known shortcomings: the example flow doesn't correctly show results if two channels are sampled (bug #18), flow fails in full-continuous mode (bug #17: solved). Beta should allow to firm current functions and fix the above 2. The video below is a preview of a sample of a linear rising signal from the dummy instrument service. I added a delay between each data read on purpose to see how the screen updates behave. The video at the start of this post is taken without waits, and with the real instrument and sensor.
Edit: release 1.0.2 is now available as source or binary download from github.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Link to all posts.

  • Sign in to reply
  • Jan Cumps
    Jan Cumps 5 months ago

    Github download (binary and source) of release 1.0.2: https://github.com/jancumps/daqhats_scpi_service/releases/tag/1.0.2

    : 

    Video processing failed.
    You don't have permission to edit metadata of this video.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps 5 months ago

    I released a new version of the linux services. Release 1.0.2 behaves better when streaming over WiFi or unstable networks.

    Action video:

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago

    1 billion samples continuous:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to Jan Cumps

    Continuous stress test: the system has exchanged 520 million samples, still going strong:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to Jan Cumps

    (embedding the video:)

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube