Reader small image

You're reading from  Mastering PLC Programming

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781804612880
Edition1st Edition
Right arrow
Author (1)
Mason White
Mason White
author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White

Right arrow

Industrial Controls — User Inputs and Outputs

HMIs are industrial UIs that are designed to talk to hardware. As such they offer us ways of entering data into a PLC and displaying data that was received from the PLC. HMI development packages can make this process very simple. In short, most HMI development packages will fall into a low-code or no-code category. Even if you use an advanced SCADA package, you’ll find that the actual coding will be minimal. The only time you’ll write copious amounts of code for your HMI is when you use a traditional programming language such as C# or Java.

With that in mind, most HMI development packages, such as the one in CODESYS, will give you a wide variety of input and output controls to choose from. Also, since there is no coding with the CODESYS HMI development tool, attaching the controls to the PLC code is very straightforward.

Now, with that being said, HMIs are very important pieces of software that can make or break...

Technical requirements

The HMI tool that CODESYS offers is built into the system. As such, when you downloaded and installed CODESYS, the HMI tool was also downloaded and installed. The project that will be developed in this chapter can be downloaded at the following URL: https://github.com/PacktPublishing/Mastering-PLC-programming/tree/master/Chapter%2012.

HMI development is as much an artistic endeavor as it is an engineering practice. I strongly recommend you pull down the code and modify it using the principles that have been covered so far to get a good feel for everything.

Exploring common HMI controls

All systems need some way for the operator to send input signals and receive feedback. For purely physical systems, these input devices are things such as switches, buttons, and so on for the inputs while things such as LEDs and gauges are used for the outputs. However, this can be costly and, in the modern computer-driven world, unnecessary as we can simply program in our controls. As such, the remainder of this section will explore software-based controls.

Flip switches

As we all learned in high school, a switch causes a break in a circuit that will essentially cause the flow of electricity to stop when it reaches the switch. In other words, with the switch closed, the electricity is free to flow in the circuit, which will cause the equivalent of a TRUE condition. If the switch is open, the electricity will not be allowed to flow throughout the circuit, which will cause a FALSE condition. In terms of HMIs, a switch can be thought of in a similar...

Final project – creating a simple HMI

For this project, we are going to create a simple HMI that can control a histogram. The HMI we are going to create is going to be straightforward. When a switch is flipped, an LED is going to turn on and a pot will become visible. When the pot appears, we will be able to turn the pot to adjust one of the lines on the histogram. With that in mind, let’s set up some basic requirements.

Requirements for the HMI

The HMI will need the following:

  • Four rocker switches that will control the visibility of four different pots
  • Four LEDs that indicate when the rocker switch is on
  • Four pots that will only be visible when the rocker switch is on
  • Each pot will control exactly one bar on the histogram
  • Both the pots and the histogram will have a range of 0 to 100 (default range)

With these requirements, minimal code is required to make the HMI function as intended. The requirements also dictate that there will...

Summary

In conclusion, we have explored common HMI components such as switches, buttons, LEDs, pots, sliders, spinners, and more. We have also learned how to hook up HMI components and how PLC code can manipulate those components. We also explored how simply using commands in the Properties fields can allow us to manipulate the controls without the need for the PLC.

In all, this chapter has served as the basis for future HMI development exploration. This chapter demonstrated how to use basic controls and how to string them together to form a simple, yet functional, HMI.

As I have stated before, HMI development is as much an art as it is a science. The next chapter will be dedicated to the best practice of laying out an HMI so that your operators can effectively use them. For now, I strongly recommend getting used to the controls and the layout of the Properties menu.

Questions

Answer the following questions based on what you've learned in this chapter. Cross-check your answers with those provided at the end of the book, under Assessments.

  1. What is a button?
  2. What kind of data fields do histograms take?
  3. Can we add keywords to a property field?
  4. Can we manipulate an HMI via PLC code? If so, when should we?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering PLC Programming
Published in: Mar 2023Publisher: PacktISBN-13: 9781804612880
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White