Controlling a Motor Using a SeaI/O Module with DAQFactory HMI Software

Downloads:

Sealevel DAQ Factory Motor Control Demo v10.0
Size: 9.32 KB  •  Type: zip

By: Will Rostron, Applications Engineer

Introduction

This support article compliments the application example video, below.

Video: Controlling a Motor Using a SeaI/O Module with DAQFactory HMI Software

Sealevel offers many digital and analog I/O adapters that are compatible with the industry standard Modbus protocol. Modbus is supported by many third party data acquisition and HMI software applications. One of my favorite 3rd party software choices is AzeoTech’s DAQFactory HMI software. If you haven’t watched the video yet, click the screenshot above to check it out.

This article provides more detail than can be covered comfortably in the video. Here, we will give an overview of how to configure DAQFactory to communicate with a Sealevel I/O adapter, in this case a SeaI/O-470M module, which can be used to control a motor.

To follow along, download and install a free copy of DAQFactory Express. Then, download and open a copy of the application demo, linked at the bottom of this page. The application demo starts in safe mode, which prevents communication with the serial port and SeaI/O hardware that the demo expects.

Page Design

This application controls a motor with relatively few inputs, so all of our controls fit on one page. Since we want to programmatically control nearly everything, we have given each HMI control a unique name.

Image: DAQFactory Page Design

We need several controls for the motor speed control, so we group them in a panel, labeled “Motor Voltage”, at the top and give it a different color than the rest of the page.

Since status is so important to the brake, brake release and reverse functions, we have made their buttons obvious and easy to see.

The parking brake and parking brake release, in a car, are often two different controls, so we have mimicked that familiar user interface giving the user a nice status feedback for that channel’s state.

The reverse control is significant. We will update the user with color changes to show direction (black/white) and the status (gray) of the change direction sequence.

The RPM graph provides feedback to the user of changes over time. In our application example, a one minute time scale works well for our purpose.

User Interface Components

In the Workspace panel, expand Page_0 by clicking the “+” symbol.

Image: DAQFactory User Interface Components

We added the motor voltage controls over the Motor Voltage panel (motor_volt_panel), which are:

  • ‘OFF’ (off_button)
  • ‘<<’ (decrement_big)
  • ‘<’ (decrement)
  • Voltage display (show_volts)
  • ‘>’ (increment)
  • ‘>>’ (increment_big)
  • ‘MAX’ (max_button)

Each press of the increment and decrement buttons changes the speed control voltage by 0.25 Volt. Each press of the increment_big and decrement_big buttons changes the speed control voltage by 1.0 Volt.

The Brake (brake_button) and Release (release_button) components set and release the motor’s brake. Their colors are updated to show the button status.

Reverse (reverse_button) starts a sequence that slows the motor to a stop before changing the direction. The change_direction sequence prevents damage to the motor by stopping the motor before changing direction.

The graph at the bottom of the page (RPM_Graph2D) displays 60 seconds of motor speed history to the user.

Device Configuration

The hardware configuration structure in DAQFactory allows communication with a wide range of devices and is suitable for a variety of application scenarios.

Image: DAQFactory Device Configuration

The hardware connection to the SeaI/O-470M module is created in the Device Configuration dialog. In the Menu, click Quick > Device Configuration. We used “New Serial (RS232/485) / Ethernet (TCP/IP) device” and clicked the Select button. This click opens the “Ethernet / Serial Device” window where we set the Device Name to “SeaIO” and then click the button to add a “New Serial (RS232/422/485)” connection.

Assign the Connection Name, which we have labeled “COM_Port”, set the communication parameters, and click Save. Select the port you just created and assign the device protocol, in this case we selected Modbus RTU. Click OK to create the device.

For Sealevel Modbus devices, the protocol will either be Modbus RTU (serial and USB) or Modbus TCP (Ethernet and wireless). We can create new connections for additional hardware devices, as required by more complex application scenarios.

DAQFactory Channels: Sealevel Hardware I/O Points

The SeaI/O-470M module used in this application provides an analog output that is well suited for controlling the motor’s 0-5V speed control. The module also provides open collector outputs that will work well with the motor’s single bit controls for the Brake and Reverse controls. The analog input is perfect for tracking the motor control voltage, which we translate to RPM.

The Sealevel MaxSSD test utility is crucial for verifying that we can communicate with the SeaI/O module and for configuring the A/D input used in this application.

With the “SeaIO” hardware connection added in the previous section, we can add the channels and other supporting elements. In the Workspace panel, click Channels to open the Channel Table View.

Image: DAQFactory Channels: Sealevel Hardware I/O Points

We added channels for the four I/O points, from the SeaI/O module, used in this application example. These channels are:

  • Brake (1st open collector output) — primarily controlled by the Brake and Release buttons; also controlled by the change direction sequence
  • Direction (2nd open collector output) — controlled by the change direction sequence, which is initiated by the Reverse button
  • RPM (A/D input) — analog input channel for the RPM graph
  • Set_Volts (D/A output) — analog output channel that sets the motor speed control voltage, which is primarily controlled by the buttons in the Motor Voltage panel

The fields in the Channel Table configure the I/O points and how they will be used in the application:

  • Channel Name — creates the specific I/O point for a device used in the application; it’s recommended to assign an easily recognizable name
  • Device Type — selects the I/O device used in the application (SeaIO)
  • D# — selects the Modbus device address (247)
  • I/O Type — selects the Modbus  function used to access the I/O point
  • Chn# — selects the Modbus I/O point address
  • Timing — specifies the read timing interval for the input channel
  • Conversion — takes the raw analog I/O values and translates them to the values used in the application (configured in the Conversions table view)
  • Additional channel settings are available depending on your specific application

User Interface Component Actions

Each UI component reads and/or updates a channel or initiates a sequence. Click Page 0 in the Workspace; right-click on a UI component and select its Properties.

Image: DAQFactory User Interface Component Actions

The Main tab allows you to set the button text, color, shortcut keys, etc. The Action tab specifies how the channel is affected by a UI button press.

Sequences: Background Scripts for Complex Actions

The first sequence that runs is the Initialize sequence. It carefully initializes the guard variable, output channel values, and user interface state.

The next sequence to run is the Control_Loop, which has two tasks. First, it restricts the speed control voltage between 0-5 V to prevent exceeding the motor’s specifications. Second, it synchronizes the Brake and Release buttons and their colors.

The Change_Direction sequence changes the motor’s direction safely.

Image: DAQFactory Sequences: Background Scripts for Complex Actions

This sequence stops the motor shaft and sets the brake before changing direction. We allow sufficient time to compensate for the load attached to the shaft. The sequence updates the Brake, Release and Reverse button colors while active.

Debugging and Testing

During debugging the application, several issues were resolved. First, we added a lockout to prevent the motor from starting while the direction is changing. Next, we refined the conditions for changing the motor control voltage from zero to 0.5 V. We adjusted the page update and Control_Loop cycle times. Finally, we applied logical variable and channel names.

Debugging and testing often consumes significant development time. DAQFactory’s design and features make this very easy, including the ability to make changes to the application while it is still running. This one feature greatly reduces development time and is the reason we prefer DAQFactory to other HMI software applications.

DAQFactory provides the key functionality for a wide range of applications by including a customizable HMI framework, complex I/O acquisition and analysis, and extensive sequencing functions. Together, these powerful features can eliminate the need to code a custom application from scratch.

For more information on the hardware used, check out the SeaI/O-470M webpage or see all of the different SeaI/O data acquisition modules we offer.