Categories
AdvancedHMI BRX Do-More Communication Do-More Do-More Designer HMI Modbus TCP PLC PLC Learning

BRX Do-More PLC AdvancedHMI – Modbus TCP

Modbus TCP will be used to connect AdvancedHMI to our BRX Do-More controller using Ethernet. Advanced HMI is a powerful, adaptable HMI/SCADA (Supervisory Control and Data Acquisition) development package that takes advantage of Visual Studio. There is no coding required and you can simply drag and drop items onto the page. The best thing is that the software is free. We will look at using AdvancedHMI with the BRX Do-More Series PLC.
BRX Do-More PLC AdvancedHMI Communication – Modbus TCP (Ethernet)
Our sample BRX  Do-More PLC program will display a digital panel meter and a gauge of a value in the PLC. Stop and start momentary pushbuttons on the HMI will allow this number to increase or stop. An indication will turn green when the number is increasing and red when it has stopped. The AdvancedHMI package will communicate Modbus TCP over Ethernet to the BRX Do-More PLC. We will be able to monitor our process via the AdvancedHMI window. Let’s get started. Watch on YouTube…
BRX Do-More PLC AdvancedHMI Communication – Modbus TCP (Ethernet)

Categories
AdvancedHMI Communication HMI Horner XL4 Modbus RTU Modbus TCP PLC

Horner XL4 Modbus TCP AdvancedHMI Communication

We will now look at using the Horner XL4 with AdvancedHMI. Advanced HMI is a powerful, adaptable HMI/SCADA (Supervisory Control and Data Acquisition) development package that takes advantage of Visual Studio. There is no coding required and you can simply drag and drop items onto the page. The best thing is that the software is free. We will look at using AdvancedHMI with the Horner APG XL4 controller. Using the program on the process tank application we created previously, we will be controlling and displaying information to the network. The AdvancedHMI package will communicate Modbus TCP over Ethernet to the PLC. We will be able to start and stop our process tank and monitor the parameters via the AdvancedHMI window.

Categories
AdvancedHMI Click Communication Do-More Do-More Designer HMI Horner XL4 Omron C20K, C28K, C40K, C60K PLC PLC Basics PLC Learning

ACC Automation 2016 Review

Acc Automation

We would like to take a few minutes and reflect on the past, current and future of ACC Automation. You have help us succeed in our best year yet.

Starting off we learned how to:
Create a PLC with HMI Training and Learning Environment Free – Utilized the Do-More Designer Software and the AdvancedHMI Software we communicated Modbus TCP to the Do-More simulator. This was all done on one computer without any need for additional hardware. The best thing about this was that the investment was only time learning the packages.

Categories
AdvancedHMI Articles Communication HMI Visual Studio - VB.Net

Deploying an AdvancedHMI Project – Installation

Deploying an AdvancedHMI project on the industrial floor sounds like an easy task, but there are a few things that you should consider. The HMI (Human Machine Interface) user interface will run on a computer. The industrial environment is one in which temperature, dust, electrical noise, etc. are always present. This can also be combined with workers wanting to play with the new computer. We will look briefly at the hardware and software items that will make your install more reliable and user-friendly in the field.
cloud-37011_640-min


Hardware – Deploying an AdvancedHMI Project

The hardware that you deploy in the field should match the environment that you expect it to work in. Computers come in many shapes, sizes, and price points. Here are a few items that you may want to consider.
thermometer-934646_640-min

  • Fanless Computer – This will keep the dust-out but the temperature may be a problem.
  • Monitor – Location, and type – Do you need a touch screen?
    Keyboard and mouse – Washable?
  • Enclosures – If you are in a wash-down environment then an enclosure is a necessity. Sometimes these enclosures are worth more than the contents in them.
  • UPS – The uninterruptable power supply will usually serve two purposes. It will act when power is removed so the computer will be able to shut down correctly. The UPS will usually also act as a power conditioner. Most power has surges on the line and this can be amplified when in the industrial environment. The surge suppressors in the UPS will protect the computer.
  • Program backup – Have multiple copies of the software saved in different places. You never know when the unexpected will happen. (Fire / Thief etc.) This includes the backup disks for your operating system as well as the programs (versions) that you are running on the computer. (AdvancedHMI, Visual Studio)
  • Documentation of the backup (Hardware / Software) – Ensure that you have documentation of the hardware and software versions that you are using. I would also include where everything was purchased. This way if records are missing we can track this down through the supplier.
Software – Deploying an AdvancedHMI Project

The software that we have on the production floor should be robust. This means that we should know what happens if things go wrong. Backups, as mentioned above, should happen on a regular basis. Memory is inexpensive so backup your files regularly. We usually use a networked computer to automatically back up the production files each day. The following is a list of items that you should pay attention to when deploying a computer on the production environment.

  • Turn off windows update – Windows is great at keeping itself up to date. However, this can cause programs to stop working. When dealing with an AdvancedHMI deployment we set windows to ‘Download updates but let me choose whether to install them’. It can take several minutes for windows to update. You want to be sure that the machine being controlled will not be affected.
    AdvancedHMI Deployment 010-min
  • Security – Set permissions – When setting up your windows computer for the factory floor, do not give the account that boots up and logs on automatically Administrator Privileges. It should be set up as a Standard User. This will prevent unauthorized software from being loaded onto the system.
    Internet Explorer comes standard on any new computer with windows 8.1 or older. No other browser is present out of the box. It is good to set a supervisor password on the internet connection. This will allow you to restrict internet use.
    http://www.thewindowsclub.com/password-protect-the-use-of-internet-explorer
    On the run prompt type: RunDll32.exe msrating.dll,RatingSetupUI
    Go to the General tab to select a supervisor password
    AdvancedHMI Deployment 020-min AdvancedHMI Deployment 025-min
  • AdvancedHMI – There are a few thing that we can do in the AdvancedHMI project. We will look at the AdvancedHMI project that we did for Creating a HMI Login Screen on AdvancedHMI.
    AdvancedHMI Deployment 060-min
    o ControlBox – Remove the ControlBox on the main screen form. This will ensure that the user cannot minimize, maximize or close the application.
    AdvancedHMI Deployment 030-min
    o Maximize for screen size – Make the main screen form maximized so it will fill the entire screen.
    AdvancedHMI Deployment 040-min
    o Form.TopMost = True – This command will ensure that your application will be on top of all other windows forms.
    AdvancedHMI Deployment 050-min
    In this example the calculator has focus, but our windows form will always be on top.
    AdvancedHMI Deployment 055-min
    If you have only one form then you can use the Properties settings for the form you always want on top. Multiple pages will have to include some additional programming to ensure that they are on top and visible.
    Here is the code for returning to the main form of the program.
Private Sub ReturnToMainButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
    Me.TopMost = False
   MainForm.Show()
    MainForm.TopMost = True
    Me.Hide()
End Sub
  • Shortcut on the desktop – Place a shortcut to the AdvancedHMI application on the desktop. This will allow someone to quickly start the application if the application unexpectedly closes.

Following the above recommendations will ensure that your computer will perform and last as expected on the factory floor. Your AdvancedHMI project will work reliably and efficiently.

If you would like a copy of the PLC and AdvancedHMI programs, please contact me and I would be happy to send them to you.

Watch on YouTube: Deploying an AdvancedHMI Project

If you have any questions or need further information please contact me.
Thank you,
Garry

Archie Jacobs from Manufacturing Automation, LLC  has another tip for disabling the windows error recovery on startup.
On the PC that will run AdvancedHMI, click the start button and type CMD to find the Command Prompt. Right Click on the command prompt and select Run As Administrator
Once the Command Prompt opens, type the following:
bcdedit /set {current} bootstatuspolicy ignoreallfailures
This will prevent problematic startup when the PC is not shut down properly as often happens in the industrial environment.



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII, and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.


Categories
AdvancedHMI Articles Communication HMI Modbus RTU

AdvancedHMI to Solo Temperature Controller

Modbus RTU will be the serial (RS485) method in which we will communicate between the AdvancedHMI Screen and the Automation Direct Solo Process Temperature Controller.


We can address up to 247 (Solo 1 to 247) devices on this master-slave protocol. A maximum of 32 devices (Nodes) on the network can communicate to the master. A review of the Modbus RTU protocol can be seen at the following URL.
http://www.rtautomation.com/technologies/modbus-rtu/

AdvancedHMI is a free HMI programming package the runs on Microsoft Visual Studio. It can be downloaded at the following URL.
https://sourceforge.net/projects/advancedhmi/

Connections – AdvancedHMI to Solo Process Temperature Controller

We will be running the AdvancedHMI software on the computer. One of the USB ports will have a USB to RS485 adapter and communicate RS485 to the Solo process temperature controller.
Solo Process Temp Controller 010 Communication Diagram-min
See the following post to install the USB to RS485 adapter.
https://accautomation.ca/usb-to-rs485-pc-adapter-installation/

Solo Controller Settings

In the Initial Setting Mode we will change the online configuration and make the changes to the Modbus settings as follows: 9600 Baud, Even, 7 Data Bits, 1 Stop Bit, Modbus ASCII Format. We will leave the default unit number as 1. See the following post to set the controller:
https://accautomation.ca/solo-process-temperature-controller/

Modbus RTU (Addresses)
The following address will be used in our project:
AdvancedHMI to Solo 050-min

AdvancedHMI to Solo 055-min
AdvancedHMI will use the Modbus Decimal value in the PLCAddressValue to determine the information that you want to get. For a list of all Modbus addresses that can be used in your project, refer to the Solo Manual located a the following URL:
https://www.automationdirect.com/adc/Manuals/Catalog/Process_Control_-a-_Measurement/Temperature_-z-_Process_Controllers

Screen Display: (AdvancedHMI)

Here is what our screen will look like:
Visual Studio vb.net
We have mimicked the look of the solo process temperature controller. Our PV and SV values are DigitalPanelMeters from the AdvancedHMI toolbar.  The eight output indicators are just labels.

Our ModbusRTUCom1 settings are as follows:
Visual Studio vb.net
Settings: 9600, 8, Even, One StopBit and Station 1 should all match the settings in the Solo process temperature controller that we did previously.
PollRateOverride will allow us to determine how often communication will take place to the controller. (250msec)
The PortName will be the same port number that the computer will communicate out of. This will be set when you install the USB to RS485 adapter. It may change if a different USB port is used.

The DataSubsciber1 will be used to determine the status of the controller.
Visual Studio vb.net
PLCAddressValue = 44139

We read the value of the eight status bits and convert this into a string so we can determine the status of each of the individual bits. Here is the code that is used to do this. It is the only code required for this application.

Private Sub DataSubscriber1_DataChanged(sender As Object, e AsDrivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        Dim i As Integer = DataSubscriber1.Value
        Dim Status As String
        Status = Convert.ToString(i, 2).PadLeft(8, "0") '8 bits
        'There are 8 bits that we need to check and account for on our screen. 
        'Modbus Decimal - 44139
        'Bit 0 - ALM3 - Alarm 3
        'Bit 1 - ALM2 - Alarm 2
        'Bit 2 - C degrees
        'Bit 3 - F degrees
        'Bit 4 - ALM1 - Alarm 1
        'Bit 5 - OUT 2 
        'Bit 6 - OUT 1
        'Bit 7 - AT - Auto Tuning

The complete AdvancedHMI code for this application can be downloaded at the end of the post.

The PV and SV indicators are DigitalPanelMeters as mentioned above.
Visual Studio vb.net

AdvancedHMI to Solo 065-min
They both have four digits with a decimal position of 1. This will give us a value between 000.0 and 999.9.
The SV includes a keypad to change the set value. KeypadScaleFactor is set to 0.1 to allow for the decimal place.

Included in our display is a BasicTrendChart from the AdvancedHMI toolbar.
AdvancedHMI to Solo 075-min

AdvancedHMI to Solo 070-min
You want to make sure that the YMaximum and YMinimum settings are set to the values will not go past these settings. If they do then the graph line will disappear from the chart at that point and time.
This will show a running trend for the last 5 minutes.
Polling rate is 250msec x 1200 points in the chart = 300 000msec
300 000msec / 1000 = 300 seconds
300 seconds / 60 (seconds in minute) = 5 minutes

Notes: Displaying Extended ASCII Symbols in Visual Studio (VB.NET)
You can display any symbol in the visual studio environment by holding the ‘Alt’ key down and typing the decimal number of the symbol that you want. In our example, the degrees symbol is Alt 248.
Here are the extended ASCII symbols:
AdvancedHMI to Solo 020-min
http://www.asciitable.com/

Running the Application:
AdvancedHMI to Solo 085-min

You will notice that the response rate is very quick. (250msec) As the PV, SV or indication values change, the screen will get updated.AdvancedHMI to Solo 090-min

The trend chart will show the last 5 minutes of the PV value. AdvancedHMI to Solo 095-min

As you can see, programming the AdvancedHMI to communicate to the Solo process temperature controller is very easily done.

Download the AdvancedHMI code for this project here.

Watch on YouTube: AdvancedHMI to Solo Process Temperature Controller

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII, and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.


Categories
AdvancedHMI Communication Do-More Do-More Designer HMI Modbus TCP PLC PLC Learning

Creating a HMI Login Screen on AdvancedHMI

We will be creating an HMI (human machine interface) login screen for the cylinder program that we developed previously.
BUILDING A PLC PROGRAM THAT YOU CAN BE PROUD OF – PART 6
Our program had a Run, Jog and Teach mode for the cylinders. Our user will login with a user name and password. Based upon the user level that is set we will control what modes each user will be able to operate. We will also write this user level mode into the PLC.


Sequence of Operation – AdvancedHMI Login Database Screen

The following is the sequence of operation:
Watch on YouTube: Creating an HMI Login Screen on AdvancedHMI Sequence of Operation

Note: All of the programs used are provided free of charge and are an excellent way to learn PLC / HMI programming.

AdvancedHMI Software

AdvancedHMI is a free HMI software package that communicates to a number of different PLC manufacturers. This package uses visual studio and vb.net to program, however, you do not need to be an expert on visual basic to implement this software. We will be using an access database (Access 2010) to store our user information. When the operator logs into the system, they will enter a user name and password. The program will compare this to the information in the database and set the appropriate modes on the HMI.

Access Database 020-minThe first thing that we need to do is to create a database to store user information. We will create a table called ‘tbl_user’. The fields in the database will be as follows:
First_Name – Text Field – 50 characters
Last_Name – Text Field – 50 characters
User_Level – Number – Integer
User_Name – Text Field – 50 characters
Password – Text Field – 50 characters

Access Database 010-minThe user level will be as follows:
0 – Stop and reset the machine only (Not logged in)
1 – Run, stop and reset the machine only
2 – Run, stop, reset and jog the machine
3 – Run, stop, reset, jog and teach the machine

Do-More PLC Modbus Addresses – AdvancedHMI Login Database Screen

Here is a list of addresses that we will be using for our login screen between the HMI and PLC.

Device Data Addresses Type Do-More PLC Description
Run/ Jog Selector 00008 Input MC8  MC8 on is jog mode
Jog / Teach Selector 00070 Input MC70  MC70 on is teach mode
User Level 40005 Output MHR5  Current user level

We will add a Login / Logout button on the main page of our control. This will allow the operator to sign in or out of the machine. To ensure that the operator knows that he is logged into the system we will display a message in a label also on the main screen. Here is what our main page now looks like:
User Interface Sign In vb.net

VB.net – AdvancedHMI Login Database Screen

The next thing we need to do is to design the form for our login information. This will contain two text boxes for the password and user name. We will also need two buttons; Login and Cancel. Our new form will be called Page2. Here is what it will look like:
User Interface Sign In vb.net

When the HMI first powers up and no user has logged in we will ensure that the Jog and Teach functions are reset by writing values directly to the PLC. We will also set the user level to 0.
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles Me.Load
ModbusTCPCom1.Write(“00008”, 0) ‘Reset Run / Jog Selector PLC
ModbusTCPCom1.Write(“00070”, 0) ‘Reset Jog / Teach Selector PLC
ModbusTCPCom1.Write(“40005”, 0) ‘Set user level to 0
End Sub

Now let’s look at the logic for the button on the main page. If a person is logged into the machine then this button will log them out. This will also change the user level to 0 and write this to the PLC. In our case, MHR5 (400005) will contain the user level code. If no one is logged in then this button will call up our login form (Page2) so information can be entered.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
     If Button1.Text = “Login” Then
Page2.txtUsername.Text = “”
Page2.txtPassword.Text = “”
Page2.Show()
Else
SelectorSwitch1.Value = False
SelectorSwitch2.Value = False
          MomentaryButton1.Enabled = False ‘Start
          SelectorSwitch1.Enabled = False ‘Run / Jog Selector
          SelectorSwitch2.Enabled = False ‘Jog / Teach Selector
          Button1.Text = “Login”
          Label6.Text = “Please Login To Operate the Machine”
          ModbusTCPCom1.Write(“40005”, 0) ‘Reset user level in PLC
     End If
End Sub

Page2 is our login form. Here is the programming logic for the Login Button.
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
If txtPassword.Text = “” Or txtUsername.Text = “” Then
MessageBox.Show(“Please complete the required fields…”, “Authentication Error”, MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
‘ Connect to DB
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = “Provider=Microsoft.ACE.OLEDB.12.0;Data Source= F:\Users\Shortt\Downloads\Creating a HMI Login Screen in AdvancedHMI\HMI\AdvancedHMIBetaV399a\AccDatabase.accdb”
Try
Dim sql As String = “SELECT * FROM tbl_user WHERE User_Name='” & txtUsername.Text & “‘ AND Password = ‘” & txtPassword.Text & “‘”
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql)
‘Open Database Connection
sqlCom.Connection = conn
conn.Open()
Dim sqlRead As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader()
If sqlRead.Read() Then
Dim FirstName As String
Dim LastName As String
Dim UserLevel As Integer
FirstName = sqlRead(“First_Name”)
LastName = sqlRead(“Last_Name”)
UserLevel = sqlRead(“User_Level”)
MainForm.ModbusTCPCom1.Write(“40005”, UserLevel)
MainForm.Button1.Text = “Logout”
MainForm.Label6.Text = FirstName & ” “ & LastName & ” Level = “ & UserLevel
MainForm.MomentaryButton1.Enabled = True ‘Start
If UserLevel = 3 Then
MainForm.SelectorSwitch1.Enabled = True ‘Run / Jog Selector
MainForm.SelectorSwitch2.Enabled = True ‘Jog / Teach Selector
ElseIf UserLevel = 2 Then
MainForm.SelectorSwitch1.Enabled = True ‘Run / Jog Selector
MainForm.SelectorSwitch2.Enabled = False ‘Jog / Teach Selector
Else
MainForm.SelectorSwitch1.Enabled = False ‘Run / Jog Selector
MainForm.SelectorSwitch2.Enabled = False ‘Jog / Teach Selector
End If
MainForm.Show()
Me.Hide()
Else
‘ If user enter wrong username and password combination show error
MessageBox.Show(“Username and Password do not match..”, “Authentication Failure”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
‘Clear all fields
txtPassword.Text = “”
txtUsername.Text = “”
‘Focus on Username field
txtUsername.Focus()
End If
conn.Close()
          Catch ex As Exception
MessageBox.Show(“Failed to connect to Database.. System Error Message: “ & ex.Message, “Database Connection Error”, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Sub

A further explanation of the code above can be found at the following address.
How to create login form in VB.NET


Connecting to our database – AdvancedHMI Login Database

The ConnectionString will vary from machine to machine. To automatically determine the connection string to our database we can do the following:
1 – Click DataBindings in the Properties window. Click F4 if you cannot see the properties window or add it on View – Properties Window.
AdvancedHMI 030 ConnectionString-min
2 – Under DataBindings, click on Text – Add Project Data Source. This will call up the Data Source Configuration Wizard.
AdvancedHMI 031 ConnectionString-min
3- Choose Database as your Data Source Type and click Next.
AdvancedHMI 032 ConnectionString-min
4- Choose Dataset as your Database Model and click Next.
AdvancedHMI 033 ConnectionString-min
5 – Click on New Connection
AdvancedHMI 034 ConnectionString-min
6 – Click on Microsoft Access Database File as your Data Source and click Continue
AdvancedHMI 035 ConnectionString-min
7- The Add Connection window appears. Beside the ‘Database file name:’ click Browse. Locate the database file that we created above.
8 – Click the Test Connection. You should get the test connection succeeded message.
AdvancedHMI 036 ConnectionString-min
9 – Click OK to close the Add Connection wizard. Expand the “Connection string that you will save in the application”. Copy the connection string given and paste it on conn.ConnectionString.
Note: Copy – Ctrl + C / Paste – Ctrl + V
AdvancedHMI 037 ConnectionString-min

Here is the programming logic for the Cancel Button.
Private Sub ReturnToMainButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
MainForm.Show()
Me.Hide()
End Sub

In this program, we are just writing a user level in PLC memory address MHR05. The control of the PLC can be limited if hardwired selector switches and pushbuttons were in the system. Implementing a login screen is very straightforward and can be part of your overall automation solution.

Download the access database and the Bin directory for the AdvancedHMI login screen.

The cylinder PLC program from Building a PLC Program That You Can Be Proud Of – Part 6 can be downloaded with the following link.
Download the PLC program and the Bin directory for the advanced HMI Screen.

Watch on YouTube: Creating an HMI Login Screen on AdvancedHMI – Explaining the Code

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.