EP3 - PLC Networking (How to Connect to the PLC)

Video: https://youtu.be/AQmIWVyjJGo

#PLC #TwinCAT3 #Beckhoff #Industrial_Automation #Redes_Industriales

🔙 Previous Part | Next Part 🔜

↩️ Go Back

Table of Contents:


A) Connecting to the PLC over Ethernet

Welcome back. In this episode we are now on the PC and we're connecting to the PLC over Ethernet, so I'm going to go ahead to my network and sharing, and change adapter settings,

And under Local Area Connection here go to properties,

And open TCP/IPv4,

A.1) Adding a New IP Address to our NIC

So what I've been told is that this PLC is already on a 192.168.1.X network (that's pretty standard for stuff that comes out of the box like any network bound device) so you're gonna have to go in and set it up for your network.

So what you want to do, since my computer actually is on a 192.168.0.55

So my current IP address is the .55 and we're on the .0 subnet.

Now I'm gonna go ahead and use a trick, go to Advanced,

and just add an IP address,

This step is optional, you can set it up where the PLC DHCP off your network and a lot of times I'll do that and look at the DHCP client list and find out where that PLC shows up and what address it gets and that's another super easy way to do this. But just for the sake of since I'll be connecting to this guy quite a bit and I don't want to kill my internet I will just set him up to be 1.254 for something nobody would ever give to PLC , click add,

We can see the IP so click OK,

So now this actual single network card on my network has two different IP addresses.

A.2) Finding the PLC with Angry IP Scanner

So rather than going and trying to ping all that stuff there's a Angry IP scanner I tend to use quite a bit,

Its already set up for the range I want so I'll just do a ping sweep of that,

And this is what it finds,

And the only other thing that is on this network is "us", at the button of the table,

So we're pretty sure that 192.168.1.130 is our PLC that's the only thing that's set up on this local network.

A.3) Connecting to the PLC using MSTSC for RDP

So what I'll do is grab a Microsoft Terminal Services Client (MSTSC)

And it comes set up by default on these machines,

Note: you can see it's actually I've connected to this already but the CX is in the name so you can get that at your DHCP client list and you'll be set right up.

So we'll connect to him,

The normal account is Administrator its password is typically 1 (but you can also go in and change that if you want, and you should in a real deployment),

and we're in so this is the actual PLC,

A.3.1) Walkthrough inside the PLC (Windows Desktop)

It shows us our password and stuff right there,

It's just Windows Embedded 7 you can see we've only got 2.53 GB free,

but that's not a big deal this guy's not gonna really do anything just gonna hang out.

Also, not a whole lot going on here typical Windows these stuff there,

and then there's some Beckoff stuff (USB, also you can talk to a Uninterruptible Power Supply (UPS) and things like that),

So your TwinCAT system service is down here (might be useful to know),

You can come in here and see what version it's running what licenses it has here,

and you know we're in config mode which is blue right there.

so one last thing I'll check, just to show you this,

it's an Intel Atom CPU, 4GB RAM, 64-bit OS,

there's it's computer name if you want to change it and all that good stuff so just like Windows but the key is it's got that Real Time Kernel.

B) Connecting to the PLC over TwinCAT XAE

All right we'll start by connecting up with TwinCAT now,

Go to File --> New --> Project,

B.1) Choose Target (IP and AmsNetId)

Then double click on SYSTEM and go to Choose Target,

so you'll see we have local here (that's only my local machine), but we want to connect to the real PLC, so let's add the PLC over Ethernet,

and do a Broadcast Search,

so you select the network cards that you want to broadcast from,

and hopefully it'll find it.

Note: Issues with our Network Example

So since I set this network card up kind of funny and I just added an extra IP address,

it actually broadcasted out on the wrong subnet and we're not gonna find it.
This actually is my laptop over in the corner of the room on Wi-Fi,

so that doesn't help us at all.

So there is another way to do this you just type it in like so, and Enter Host Name,

So that's basically forcing it and saying hey go ask this computer if it's a TwinCAT computer so it'll pull the AmsNetId, which is like kind of like an IP address only a little bit longer

and more specialized it'll show the version in the OS and so on,

So here's the Host Name and the AmsNetId,

So you're adding sort of like a DNS entry like this IP goes with this host name so that's how we're gonna talk to this PLC.

And then this is where we create the route on the remote side (which actually is my side),

so we will add that route,

and stuff like this happens sometimes,

I'm not sure exactly what all causes those sorts of problems but the gist of it is if you can't ping this by hostname,

I can do a ping here,

We will see if that pings if it doesn't then that's why we got that problem,

yeah so it's it's probably because there's no name server on that because again I kind of did a funny thing to set up this network card.

But anyway you can do it by IP address and force it and it's not a big deal,

Now, this is asking you a login and password and this is the password for the remote system so that's that Administrator and the password is 1 by default, so I'll click OK,

And you should see this X in the connected box here,

and then you can just close out (it's waiting on you to add more routes),

We can see the PLC now,

B.2) Creating a PLC Project

So once you close out you can say hey this is my target now and you should be able to change settings and do all kinds of stuff.

So now we go here and add new item,

Select Standard PLC project,

and when that finishes you should have an actual project,

C) Testing the PLC and running a basic program

So we can just open up a main here and we will type,

save this,

Apply activate configuration,

It's generating the code... it made some code...

it wants us to generate a trial license because we don't have a license so that's as simple as this and you get seven days for free as many times as you want which is really wonderful (this entire IDE is free by the way),

Now we get the PLC in Run Mode (green),

now we try to login,

and we get this message,

And it is saying "hey this Port doesn't exist, do you want to create it?
And we say, yeah sure.

And then we're sitting here,

we're online but we're not running so I'll just click run

and boom this is the actual PLC running this code.

So I can disconnect,

I could reboot my computer come back on reconnect and it'll just keep counting away total rolls over.

Conclusion:
So that's the gist of it, we just got connected. You can save your project

You do need to do a few extra things to get it to automatically boot up like auto start boot project,

but short of that we're connected up, we're ready to do some some I/O configuration and things like that and get on with the rest of the series. So I'll catch you on the next episode


🔙 Previous Part | Next Part 🔜

↩️ Go Back


Z) 🗃️ Glossary

File Definition
Uncreated files Origin Note
AmsNetId EP3 - PLC Networking (How to Connect to the PLC)
AmsNetId EP3 - PLC Networking (How to Connect to the PLC)
Angry IP scanner EP3 - PLC Networking (How to Connect to the PLC)
Microsoft Terminal Services Client (MSTSC) EP3 - PLC Networking (How to Connect to the PLC)
Real Time Kernel EP3 - PLC Networking (How to Connect to the PLC)
Real Time Kernel EP3 - PLC Networking (How to Connect to the PLC)
Uninterruptible Power Supply (UPS) EP3 - PLC Networking (How to Connect to the PLC)
USB EP3 - PLC Networking (How to Connect to the PLC)
Windows Embedded 7 EP3 - PLC Networking (How to Connect to the PLC)