Author Topic: Controlling an entire machine as HMI and PLC.  (Read 5103 times)

timryder

  • Jr. Member
  • **
  • Posts: 83
  • Still trying to figure it out
    • View Profile
Controlling an entire machine as HMI and PLC.
« on: March 02, 2020, 11:58:04 AM »
This is an overview of a project I did later 2019 which showcases the potential power of AdvancedHMI and how nearly limitless it can be due to the fact that it's a .NET application.

The machine is a stand-alone laser marking station with a camera, fume extractor, servo motor for automated door, safety circuit, indicators lights, input sensors and push buttons. And they're all being controlled by AdvancedHMI.

I started with the idea of, do I really need a PLC? The short answer is NO, but I do need something to convert my Discrete 24v I/O into an Ethernet packet of data I can both read and write with. So I did some hunting online and found several resources, but ultimately decided to go with a product by Advantech called the ADAM-6052-D. It is a 16ch I/O 24vdc module which has Ethernet for both read and write capability.  They offer TCP/IP, ModbusTCP and many other protocols as the cheap cost of $235.00 at the time of this post. They also provide free .NET Libraries for their products which make integrating it a breeze! (THIS IS NOT A PLUG FOR THIS COMPANY OR PRODUCT. I AM NOT AFFILIATED) Just note there were several others I could have chosen but this one met all my criteria.

I bought this item and started testing it first in my lab and discovered it did exactly what I wanted, I could both read digital inputs and write digital outputs at my will. I had 2 other devices that I needed to communicate with and control a 2D Barcode Camera and Laser Marking System. This didn't take much effort as my company partners with Keyence this was a quick choice. Keyence allows for ASCII over TCP for controlling their system as well as reading status' any time.

So all the pieces were together and I started production on the machine.  Our customer has some very stringent requirements for the marking data and they would include a Checksum calculated on a marking data string which changes every part because it's serialized and the markings must be unique and cannot be duplicated. No problem. AdvancedHMI Framework being .NET, it' s a piece of cake to write up a Function to read the string from the Laser, manipulate the data, check it against a database with a SQL query for uniqueness and send it back down the Laser to be marked. Then with my custom "Auto Process" Thread which is constantly looping in the background similar to how a PLC does, I could trigger the actions of all the machinery via the Discrete I/O from the ADAM module and after marking, trigger the camera to read the marking over TCP and verify read versus the intending marking.

So all of this was done using the power of .NET and the AdvancedHMI framework was the perfect solution for me. The machine is running in production now with no issues and it has massive amount of tasks and is done with some super simple cost effective components. This was posted just as an encouragement to think outside of the box for this product. It has much more powerful potential than just a simple HMI application. Not that it doesn't do so very well, it does, but it's limitless with what it can do.
Still just trying to figure out this thing called Life.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Controlling an entire machine as HMI and PLC.
« Reply #1 on: March 03, 2020, 09:06:24 PM »
Nice project. The machine looks well built and clean.

larryhts

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #2 on: March 04, 2020, 06:24:19 AM »
Well Done.

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #3 on: March 04, 2020, 12:51:05 PM »
Nice! Are BCR camera and laser head from Keyence? CO2?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #4 on: March 05, 2020, 09:56:28 AM »
Nice work! I've seen those ADAM modules long time before, but always wondered how they work with no real time OS like windows. Are you polling data from it, of so at what rate? Do you use a background worker for this?

Asking because this is something I want to learn to do (multi thread and background workers), there are many applications I could use it.

AHMI has helped me a lot with its already made controls that does not require to write code for these, but now I was looking for do it myself in other drivers like for Siemens.

timryder

  • Jr. Member
  • **
  • Posts: 83
  • Still trying to figure it out
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #5 on: March 06, 2020, 10:42:50 PM »
Nice! Are BCR camera and laser head from Keyence? CO2?

The Camera is an SR1000 from Keyence and the Laser is an MD-X1000 from Keyence also.  Its a Fiber Laser Marker.
Still just trying to figure out this thing called Life.

timryder

  • Jr. Member
  • **
  • Posts: 83
  • Still trying to figure it out
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #6 on: March 06, 2020, 10:51:24 PM »
Nice work! I've seen those ADAM modules long time before, but always wondered how they work with no real time OS like windows. Are you polling data from it, of so at what rate? Do you use a background worker for this?

Asking because this is something I want to learn to do (multi thread and background workers), there are many applications I could use it.

AHMI has helped me a lot with its already made controls that does not require to write code for these, but now I was looking for do it myself in other drivers like for Siemens.

So from my main thread I call an initialization Function and check to make sure the Adam module , Camera and Laser can be reached by Ethernet.  From each check I start a background worker thread for each device where I continuously loop untill the main thread closes the worker threads. 

I'm polling the Adam module at 25ms interval and the Keyence at 100ms. I created a class for an input device which contains name, port, bit, state etc and I loop through and check/set all the inputs on the Adam.  Then I write to the Outputs in a similar fashion.

I also have a Auto Process thread which uses the input values and can also set the output states for the I/O conditionally.  I'd be happy to give you the code if you want.  It can use some improvement but it's a start.

Thanks everyone for your compliments!
Still just trying to figure out this thing called Life.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #7 on: March 09, 2020, 01:14:33 PM »
Nice work! I've seen those ADAM modules long time before, but always wondered how they work with no real time OS like windows. Are you polling data from it, of so at what rate? Do you use a background worker for this?

Asking because this is something I want to learn to do (multi thread and background workers), there are many applications I could use it.

AHMI has helped me a lot with its already made controls that does not require to write code for these, but now I was looking for do it myself in other drivers like for Siemens.

So from my main thread I call an initialization Function and check to make sure the Adam module , Camera and Laser can be reached by Ethernet.  From each check I start a background worker thread for each device where I continuously loop untill the main thread closes the worker threads. 

I'm polling the Adam module at 25ms interval and the Keyence at 100ms. I created a class for an input device which contains name, port, bit, state etc and I loop through and check/set all the inputs on the Adam.  Then I write to the Outputs in a similar fashion.

I also have a Auto Process thread which uses the input values and can also set the output states for the I/O conditionally.  I'd be happy to give you the code if you want.  It can use some improvement but it's a start.

Thanks everyone for your compliments!

Very nice! Sounds like it is exactly what I need to understand background workers. I'll take your word, I just sent you a PM.

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #8 on: March 09, 2020, 05:20:22 PM »
I am a little bit leery with the door switch, since it concern with safety aspect.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

timryder

  • Jr. Member
  • **
  • Posts: 83
  • Still trying to figure it out
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #9 on: March 12, 2020, 01:46:47 PM »
I am a little bit leery with the door switch, since it concern with safety aspect.

Not sure what you mean exactly, but the door is completely interlocked with a redundant safety relay circuit to the laser marker.  The Laser will instantly stop and all output power is removed as well as a physical shutter moves into place in the path of the beam.  It's very safe.  As if that wasn't enough, we actually engage a mechanical lock on the door anytime the Laser output is on.  The customer can't even open the door while it's performing it's function. 
Still just trying to figure out this thing called Life.

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #10 on: March 12, 2020, 08:23:07 PM »
Sorry I thought you wired it to Adam.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

timryder

  • Jr. Member
  • **
  • Posts: 83
  • Still trying to figure it out
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #11 on: March 13, 2020, 08:55:38 AM »
Ahh, gotcha.  No that would be very irresponsible to do. Had I shown a picture of the panel itself I'm sure you would have noticed the safety circuit and deduced it was interlocked appropriately.  But good info for anyone who reads this thread as well.
Still just trying to figure out this thing called Life.

kallileo

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Controlling an entire machine as HMI and PLC.
« Reply #12 on: February 07, 2021, 02:02:00 PM »
Hi timryder

So as far as I understand you created "something" like Soft PLC.
I was thinking about for some time but didn't have the C# skillset to create it.
If possible I would like to take a look at your code and how you handle threads.

Thanks
Leonidas