Getting Started with the Mechatronics Prototyping Board

Overview

The Mechatronic Prototyping board allows students to continue through the mechatronics design process by providing them a base for prototyping their ideas at a lab workstation that combines a standard design grid, instrumentation and deterministic real-time processing and control.

Contents

Key Features

The Mechatronics Prototyping Board provides two 34-Pin MXP Through connections that allow for plugging in MXP boards to the RIO control module. These connectors directly tie to the MXP A and B ports of the RIO Control Module. This board also features a grid of threaded holes that are sized to coincide with Pitsco Tetrix Prime standard screws. This enables securing Tetrix Prime pieces to the Prototyping board for design purposes. Dimensions for the board are included to enable further design of custom project parts.

Installing the Mechatronics Prototyping Board

1. Position the Prototyping Board on the NI ELVIS Workstation below the NI ELVIS RIO Control Module.

2. Using the Finger Support Grips, slide the Mechatronics Prototyping Board into the MXP connectors of the NI ELVIS RIO Control Module, ensure it is seated properly in both connectors of the module.

Note: Removal of the Mechatronics Prototyping board requires use of the Finger support grips. Do not attempt removal of the Mechatronics Prototyping board by pulling the back panel where the 34-Pin MXP breakout connectors are located.

Software Installation PC

The first step is insert the first DVD of the ELVIS RIO CM Software Bundle.

     Important Note: if you are using Windows you could get the following popup message:

Select autorun.exe.

The NI ELVIS RIO Control Software Bundle main window will open. You can select four options:

I. Install NI LabVIEW 2016 ELVIS RIO Control Software Bundle: Allows the user to select what software to install. Recommended Option:

Click Next.

In the following window, select the software you want to install:

Important Note: For the following project you will only need the NI ELVIS RIO Control Module Required Software. (LabVIEW English (Base, Full, Professional), ELVIS RIO Control Toolkit and the Real Time Module).

Continue through the installation. After using your serial number information, you will get an installation summary:

Wait until all the processes are completed:

Important Note: You can activate the products right away or wait and do it later. All software includes a week of trial.

II. Install NI LabVIEW 2016 ELVIS RIO Control Toolkit: Install just the toolkit.

         Important Note: You need LabVIEW and the LabVIEW Real Time Module to install it.

III. View Readme: Find all the necessary information about the NI LabVIEW 2016 ELVIS RIO Control Software Bundle.

IV. Exit: Closes the Program when the ELVIS RIO Control Module is connected.

Software Installation ELVIS RIO CM

The first step once the NI ELVIS RIO Control Module is connected is to open the NI Measurement and Automation Explorer or NI-MAX:


Once NI-MAX is open go under Remote Systems and search the NI ELVIS RIO Control Module.

Important Note: You will find the Serial Number of your device in the name will the following format:
NI-ELVIS-RIO-CM-XXXXXXXX
XXXXXXXX will be an alphanumeric text of eight characters.

You will find two listed sections under the NI-ELVIS-RIO-CM:
I. Devices and Interfaces
II. Software

Under the main page of the device you will find four tabs:

I. System Settings: Under System settings you will find information about the characteristics of the device.
II. Network Settings: You can configure the network settings of the device.
III. Time Settings: You can configure the Time Zone of your device. By default is set to be
IV. Help: You can find help documentation for the RIO and ElVIS platform.

Under Devices and Interfaces you will find the NI ELVIS RIO CM “RIO0” FPGA, two ASRL ports and the network devices section.


By clicking on the RIO0 device two additional tabs could be found:


I. Settings: You can verify the status of the device and update the firmware.
II. General: You can change the device identification and verify the product information (including the serial number).


Right click under the device name and select: “Format Disk”

Important Note: The default username is: admin and password is empty:


Select the option: Attend to restart into safe mode and select Reset all of the network adaptors to their default settings. Finally click Format:

You will get the following message.:

This operation could take several minutes. And the end you should get a success message:

Right click on Software and select: Add/Remove Software:


You will get a Warning message indicating that the Windows Firewall could ask you for permissions. Be sure to select Unblock this program to allow MAX communicate with the NI ELVIS RIO Control Module.


The LabVIEW Real Time Software Wizard will pop-up and will ask you to select the set of software to install. Be sure to select LabVIEW Real Time 16.0.0 with NI ELVIS RIO Control Module 16.0 – August 2016.

Important Note: You can do a custom software installation, however for the purpose of this guide you can select the recommended software bundle.
Click Next and select NI Scan Engine (NI-RIO IO Scan 16.0) in the optional software add-ons section.

Review the summary of software to install:

Wait for the installation process to complete:


Important Note: Is probable that the device reboots several times during the installation process. This process could take several minutes to complete.

After the process is complete you will get a message indicating that the process completed successfully:


Click Finish to continue.

Now you should be able to find the list of installed software under the Software section in NI-MAX:

LabVIEW Getting Started Window

In the Create Project Wizard select NI ELVIS RIO CM as the source of templates. Select NI ELVIS RIO CM Project:

Click Next. Name the project as NI ELVIS Mechatronics Encoder Project:

Important Note: for the purpose of this project select the default FPGA Personality just like in the image above.

Since the target is already connected through USB select the option Target – Plugged into USB. Once the device is selected click Finish.

Your project window will look similar to the one seen below:

Important Note: You can open the html file named EL-RIO-CM Project Documentation. Html for more information. You will also get the image named EL-RIO-CM_Project_Diagram.png with the basic structure of the main VI.

Right Click on the NI-ELVIS-RIO-CM icon and select Connect.

Open the Main.vi.

Front Panel View:

Block Diagram View:

You will get a VI that allows you to control a Front Panel LED based on the input from the Button0 of the ELVIS RIO Control Module.

Note: You could change the name of the VI to: Main RT.vi.

Motor Speed Control

In this first section we want to control the speed of a DC motor connected to our NI ELVIS RIO Control Module. This can be done by using the PWM functionality of the device.
Important Note: Refer to the Wiring and Hardware Setup Section for more information on connecting your motor to the ELVIS RIO Control Module.
You can control motor speed by changing the Duty Cycle of the PWM control signal. This control will be done in a while loop to allow for continuous update of the output duty cycle.

The PWM function can be found by right clicking on the block diagram and selecting:

NI ELVIS RIO CM -> PWM:

PWM Configuration:

Set both the Duty Cycle and Frequency to “Set using input to Express VI” this allows you to wire controls to the PWM Express Vi.

Once the VI is configured and placed, right click on the “Frequency” and “Duty Cycle” terminals and select “Create Control. This will provide the basic Numeric Input which you can change to a different control on the Front Panel later.

You can find the “Or” Function by right clicking and going to:

Real Time -> RT Timing -> Tick Count:

ELVIS RIO CPU Load Loop

This loop will allow the user to monitor the ELVIS RIO Control Module CPU Consumption.

You can find the RT Get CPU Loads VI by right clicking and going to:

Real Time -> RT Utilities -> RT Get CPU Loads

Run the code which should now include the Motor Control Loop and the ELVIS RIO CPU Load Loop. Connect the included MXP Breadboard to Connector A of the RIO Control Module then, using wire and BNC Cables for the Oscilloscope Channel 0 of the NI ELVIS, connect to pin 27 and read the signal being produced. Change the Duty cycle control value and note how the signal changes.

Scope Pic 0.5 duty cycle.
Scope Pic 0.75 duty cycle.

Stop both the VI and the Scope Instrument. If you have not done so already, connect the DC motor to your ELVIS RIO Control Module using the instructions provided in the Wiring and Hardware Setup Section.

Hall Sensor Reading Loop

Recommended code for measuring speed (Based on Hall Sensor One or Phase A, of the encoder) and measuring direction based on the rising edges caused by two hall sensors Phase A and Phase B.

Configuring the Time Loop:

Hall Sensor One Configuration – Digital Input VI found on the NI ELVIS RIO Control Module Pallet:

Hall Sensor Two Configuration- Digital Input VI found on the NI ELVIS RIO Control Module Pallet:


Speed Calculation

For measuring the speed, the following architecture is proposed:

Important Note: Using the Greater? VI located on the Comparison Pallet (Right click Programming -> Comparison) and a Shift Register it is possible to detect a change of state from false to true (Rising Edge).

In the case where a rising edge is detected, call the Tick count function found on the RT Timing Pallet (right click Real Time -> RT Timing -Tick Count) and compare that value to a tick count value found from the previous iteration where this true case was entered or since the initial time the code is called. This is configured to measure the time between rising edges in microseconds.

Building the VI named MS to RPM.vi is recommended.

In the following image you can find the front panel of the VI:

Important Note: As you can see in the context help the Counter Period ms and the Number of holes on the Encoder Wheel are required inputs.

Important Note: The proposed motor’s maximum speed is 1500 rpm. Using two disk magnets in the encoder wheel, we will only get one pulse per revolution. Meaning that the period of the signal is going to be the duration of one revolution in milliseconds. Being 40 ms the minimum expected period.
In the following image you can see the procedure for calculating the speed. (Need to change, this calculation is incorrect)

In case of error, pass the error information and set the speed in rpm to 0:

For measuring the direction of the motor it is necessary to analyze both signals from the two connected encoders. We want to assess which rising edge occurred first. For detecting the rising edges the vi named Rising Edge Detector.vi should either be used directly or created.
Rising Edge Detector.vi Front Panel

Important Note: As you can see in the context help the A and the B are required inputs of the VI:

This VI uses a Feedback Node to store the information of the previous call and verify if there has been change of state by the combination of the following logic gates:

In the case the previous state was False is negated and if the current state is True it means that a rising edge occured. The and gate will generate a True value and subsequently the Or gate will generate a true as well. This will set the value for Edge Detected.

Check following image to understand the logic. Note: The T stands for True and the F stands for False.

This logic is repeated for Phase B, allowing the user to detect rising edges on both phases.

The Edge Detected? output of the vi is used as the input of a case structure that will allow the users to capture the state of both phases at the moment of a rising edge. A pattern like the one in the following image is obtained:

For detecting the direction based on the proposed method, four samples are required. For taking these four samples the following procedure is proposed:

The values of Phase A and Phase B are stored at the moment of a rising edge in a 1-D array, and then these values are stored in a 2-D array that would keep multiple samples. For taking exactly four samples a counter is being used. Each time a rising edge is detected the counter value is increment by one and using the Quotient and Reminder function with the counter and a constant value of four we are able to detect each time the counter has a value of four (By comparing the result of the floor operation between the counter and the constant of four). The floor value is equal to one it means that the four needed samples has been recorded on the 2-D array, the direction is then analyzed, and the counter and the 2-D array are reset.

In the following image one of the two possible expected patterns is shown:


In the following table you could find the states of Phase A and Phase B during the rising edges.

Important Note: The rising events are highlighted on the image using the arrow symbols.

Phases Values:

Phase A

Phase B

True

False

True

True

True

False

True

True


In case the motor is rotating in the other direction the possible values are shown on the following table:

Phases Values:

Phase A

Phase B

False

True

True

True

False

True

True

True


Then using the following logic, the patterns are analyzed to determinate the direction:

First Pattern:

Second Pattern:

Front Panel Proposal for the Main RT.vi:

Wiring and Hardware Setup Section

Example Motor Circuit:

Example Encoder Circuit:



Example Photocell Circuit:


Mechatronics Prototyping Board Schematic

Note: Unless Otherwise Specified Dimensions are in millimeters (mm).

Was this information helpful?

Yes

No