• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connect to PLC without knowing IP
#1
Hello, i'm totally new with this thing.
Got my netPI and a s7-1500 and i'm wondering if there's a way to connect to the S7 without knowing/configuring the accessible ip adress.
I'm working on it with node-red and it works fine, but what to do if i want to get data from multiple PLC's in different networks ?
Not at once but one after the other?

greets,
paul
  Reply
#2
Dear Paul,

welcome to the netPI forum.

You are using Node-RED is what I have understood. And in Node-RED which node are you using to communicate with your S7-1500 PLC? By default a standard Node-RED has no support for S7-PLCs. So you must have post installed additional nodes, right? Please tell me a little bit about your software constellation..
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Thanks.
Yes you're right. I am using Node-RED and installed contrib-s7comm .
First of all the 'fieldbus in node', then 's7comm in' and read out the values per debug.
For testing i have set-up a counter in TIA portal and thats it in general.
At the end it should be something like plug&play, connecting the netPI to the PLC and send the data anywhere..
  Reply
#4
Well now I have understood what your requirements are. Thank you. Let me ask you know if you have programming skills?

I don't know how the contrib-s7comm node is really working, so I don't know if you have to configure the S7-PLC IP address that it shall send data to in a table or if this node can also receive instructions based on node-red input.msg online. In latter case you are a lucky boy cause then you can write a Node-RED flow sending S7 request to multiple S7 at a time if you know the "unknown" S7.

Here is how I would program it: There is a port scanner for node.js here: https://github.com/eviltik/evilscan. This scanner can be instructed before called which IP address range it shall scan and which ports. RFC1006 port is 102. After a scan it returns to you the result of the found devices. Then you have a list of available PLCs. To make function calls available you have to include this node.js library into Node-RED (changing settings.js file) like described here https://nodered.org/docs/writing-functions.html in the chapter "Loading additional modules".

Then Node-RED knowns the evilscan. After that you can use the normal Node-RED function node and write your program and make the library known with the instruction

var evilscan = global.get('evilscan')

Then you can access the function as it is described in the evilscan documentation.

var options = {
target:'127.0.0.1',
port:'21-23',
status:'TROU', // Timeout, Refused, Open, Unreachable
banner:true
};

var scanner = new evilscan(options);

da da da ...

And then you can write your rest of your program
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#5
Well, i just know some basics in js,c# and vb.net but in case of need i can learn fast ..
I dont really know either, but i'll look forward to figure out if i can give in the parameters by msg.. think it should be possible somehow.

That looks like a good way! I'll study a lil bit about this and if it works its a big step foreward.
Thank you!
  Reply
#6
Soo evilscan works as expected in the node-red container console and i was on my way to get the function node working BUT
when i restarted the container i am no longer able to connect to node-red UI.. "ERR_CONNECTION_REFUSED".
This is not the first time i got this error, i used to reinstall node-red but this shouldnt be the only solution..
Do you have any advices for me? Btw evilscan still works in console, but the PLC is now disconnected.
  Reply
#7
(August-22nd-2018, 12:11 PM)paubau Wrote: Soo evilscan works as expected in the node-red container console and i was on my way to get the function node working BUT
when i restarted the container i am no longer able to connect to node-red UI.. "ERR_CONNECTION_REFUSED".
This is not the first time i got this error, i used to reinstall node-red but this shouldnt be the only solution..
Do you have any advices for me? Btw evilscan still works in console, but the PLC is now disconnected.

Great to hear that the scanner works as expected.

I suppose you restart the container using netPI's web GUI? In this case you can watch a log file made by Docker that records all console outputs you usually see as if you are on a raspberry Pi 3 and a shall.

So click on the containers list and then click the container name and then !Log. There you have to see Node-RED outputs any why it was not started properly as the picture shows.

Another possibilty is to install SSH into your container additionally and then jump into the container using putty terminal and then you can start/stop node-red as if you are on a standard raspberry. Since Node-RED gives you many status information during its start, you should see the reason why it is not starting.


Attached Files Thumbnail(s)
   
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#8
Yes, i restarted the container by using the portainer.io platform..
I deleted the added text from settings.js and then it worked again.
//evilscan:require('evilscan') should be the only thing i have to add there right?

The StdErr Log only says
906605936Z /etc/init.d/nodered.sh: 100: kill: No such process

maybe i installed evilscan in the wrong folder or smth?
  Reply
#9
Yes it is important that Node-RED finds the npm package you insert in the settings.js file.

If you start Node-RED then it outputs the "User Directory" to you as far as I know. Go to this folder mentioned and then call "npm install evilscan".

I might also solve your problem installing "evilscan" globally using "npm install -g evilscan", but I don't know.

I don't know evilscan and if its working properly. It was just a proposal from my side to you. I am afraid that I cannot help much at this time ... applications like this are out of scope of this netPI forum. netPI and the container works as expected and the issues now are Node-RED topics rather than netPI topics.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#10
Oh ok i installed in the hidden .node-red folder, i will try it in the other way..

well you already helped me alot, i'm very grateful!

but if you could answer one last question?
is there a fix that the docker console wont crash/freeze/whatever when opening another tab for a minute?
*didnt even need to open another tab, just dont use it about a minute.. like a timeout when i'm afk
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Errormessage when trying to connect to wifi. BFH_SAM2 11 384 September-24th-2018, 12:52 PM
Last Post: Armin@netPI
  Connect without DHCP SebastianSoller 15 400 August-21st-2018, 06:55 AM
Last Post: Armin@netPI
  Node-Red MQTT with SSL/TLS can't connect to broker BFH_SAM2 6 243 May-18th-2018, 08:48 AM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)