element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
  • Settings
NI LabVIEW Community
  • Products
  • Dev Tools
  • NI LabVIEW Community
  • More
  • Cancel
NI LabVIEW Community
LabVIEW Challenge Blogs A Course in LabVIEW and Test Automation
  • Blog
  • LabVIEW Challenge Blogs
  • Forum
  • Documents
  • Quiz
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join NI LabVIEW Community to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fyaocn
  • Date Created: 27 Oct 2023 7:39 AM Date Created
  • Views 618 views
  • Likes 6 likes
  • Comments 2 comments
  • A Course in LabVIEW and Test Automation
Related
Recommended

A Course in LabVIEW and Test Automation

fyaocn
fyaocn
27 Oct 2023

A Course in LabVIEW and Test Automation

Table of Contents

  • 1 Briefing of labview and the challenge
  • 2 The Plan and the outcome
  • 3 Preparation
  • 4 The Labview and How-to PICO
  • 5 The Design and VI
  • 6 The Result
  • 7 Step furher
  • 8 Conclusion

1 Briefing of labview and the challenge

Unlike other challenge, I have collaborated with NI FAEs in some projects and got to know Labview for some time. I am glad to be selected as challenger to code with Labview in GUI.

The labview is such a strong tool enough to build whole Automation factory PLC system in high standard. Since NI Labview is the first to bring about theconcept of Virtual machine, NI has invented this and widely applicable to high-end application such as aerospace, precise instrument, most of which is very expensive. There are wide range of sensors and actuators within the ecosystem fit for larger project. Industrial users can use lite version of host compater like NI Compact RIO for different applications.

This challenge is unique, since as far as I know this is the first of many kind can brings affordable sensor end with PICO SCPI Labtool.

2 The Plan and the outcome

The plan is to test motor operation and the performance, such as voltage, current, velocity, waveforms, etc, just like STM32cube Motor control GUI can do. In the end, I manage to catch some data, but not all. Since it would take much time on porting the Motor Control algorithm in Labview, the driver lib of BLDC is not so easy, I am not familiar with Labview enough to find some applicable Sub-VI to same time, even I know it does availalbe like SimpleFOC for arduino.

I manage to catch both Digital input data

image

and Analogue input data with usbtmc_scpi_labtool, 

image

Details in follows chapter.

3 Preparation

The fist this is to download and install Labview Community Version, it is easy once you have one NI account. There are cluster of programs to be installed if you like, but without licence they can not start. As I have mentioned before, this bundle is stong enough and worth the price. Mastering these tool with test-pass certification can be sought-after ability by clients. So start the labview 

image

Then make one Raspberry Pi PICO ready with  SCPI Labtool firmware flashed. 

image

Then understand and familiar with PICO SCPI Labtool and how to use it.

image

Finally, the BLDC with digital reading Hall sensors,

image

Analogue data reading Hall sensor expension board,

image

LED tester and motor driver board(available but not pass test at this moment), Raspberry Pi Pico expension board, DC power, multimeter, etc.

image

4 The Labview and SCPI Labtool 

4.1 The Labview

There have been reading document on how to use labview, but the best guide is to try and test. The knowledge matrix is complex, one have to go layers by layers to find the applet sub-VI to be used in coding. But the best part of labview is that it can be self guide and prompt errors with UI popup to find it. Start from correctly running code, noting the yellow part.

image

It add one wrong wire, noting the logo in read oval which report wrong instantly and prompt the reason in docking label once mouse move over the wrong wires.

image

4.2 SCPI Labtool 

Thanks to hardwork of TOP members, the idea  SCPI Labtool can be shorten to one bridge, one part runs on host compter, mimic one VISA port, can be access with NI VISA interactive control portal,

image

Double click the USB Instrument Resouces USB0:xxxxxxxxx, this is the Raspberry Pi PICO , parameters shall be 

image

Do 1-2-3 as follows repeatly with different SCPI script, one can access Pins in Raspberry Pi PICO

image

The other part is firmware of Raspberry Pi Pico, it is bridge, get the script from host computer like

*IDN?\n

image

Then parse the code, bridge the command to ports as read/write, digital/analogue,

Then binggo, the Raspberry Pi PICO is transparent, as if it does not there, the host computer control the ports.

That is it.

Another reason I can not complete original plan is that I can not allocate the ports properly, since this version of Labview_labtool support only 3x4=12 pins, there are more pins needed for motor testbench,such as Ua,Ub,Uc, Ia,Ib,Ic, Uresidue, Hall_A, Hall_B, Hall_C, Driver_AH, Driver_AL, Driver_BH, Driver_BL, Driver_CH, Driver_CL,  etc. But as to this primary function test ,that is enough and perfect.

5 The Design and VI

The design of Labview is creating and editing VI, create VI with blank project, of course, some sample project can be very useful as reference,

image

Press save and name the VI instead of Untitled, the VI can be compile to standalone runtime exe file if configuration build specifcation first,

image

image

image

Add the SCPI labtool library first,

image

And create one VI as main.v as entrance VI, the function panel and front panel popup.

image

save to change name to main.v

image

add functions and sub-VI one by one in front panel , for SCPI labtool, the Init and Close shall be put first with search VI 

image

add VISA component In, this is where the USB0 resource come in,

image

Wire them accordingly, the following is basic program , doing nothing, but form the framework of this design.

image

Complete the fist design with reference to example digital read out,

6 The Result

Start the VI, control the digital output to control LED,

image

The  LED is On - Off -On in sequence.

image

This is the raspberry Pi Pico on expension board, it works.

7 Step furher

As planned, add more pins from digital input from BLDC hall sensor and analogue input from Hall sensor board,

image

Revise the design

image

Start the VI, the front panel, show the three Hall sensor reading while the BLDC turns , 

image

The sequence shall be as blow, marking the position of rotor,

image

Then the digital reading from BLDC Hall sensor in X-Y plotter

image

Then the analogu reading from Hall sensor in X-Y plotter

image

It works fine.

8 Conclusion

This final blog can brief  outline how Raspberry Pi PICO run with SCPI labtool in NI labview environment, it is perfect. The reading of hall sensors mark the angle position of rotor, with the span time period, the running of motor in RPM can be calculated.

The high performance of Raspberry Pi Pico in ADC up to 1M/s can be enough for most voltage/current sample rate of 100-400kHz, the design of VI can be expended easily with more sensors added into this design.

Here is the source code in zip for reference.

Hall_sensors.zip

  • Sign in to reply
  • fyaocn
    fyaocn over 1 year ago in reply to Andrew J

    Thanks. Your comment is definitely right.

    1. The True/False case structure is temporary Position Holder for revision. Constant True/False as input for case during debugg. Some buttons are not in used in this VI design. It would trigger case selection as input.

    2. The error control is very important, in case dead loop or I/O errors happen. 

    3. The labview structure design is very flexible, Even empty structure help a lot in objective orient design.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Andrew J
    Andrew J over 1 year ago

    Good job, I like that you’ve used the charting/graphing controls. If I could make one comment: you have a case structure with your code in the true case and a true Boolean wired to the Boolean.  That means it always runs of course so really, the case structure isn’t needed.  However, what is normally done is for an error control to be wired to the case conditional so your code only runs when no error is present.  Wire the error out of the Visa init vi to the case conditional so your code only runs when the init has no errors.  There are additional things you could do with the error flows but that would just be tidying up loose ends.

    • 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 © 2025 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