Connecting your factory to the Cloud VIDEO 1: Node-RED & S7 1200 PLC on the Edge

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone this is the first of five videos on how to connect your factory to the cloud we will go step by step on how to connect this setup using an edge device to the cloud overshow we will use machine learning to detect anomalies before they become a problem and we will use the following technologies we will use cmsdi portal with some logic to control its digital outputs and manage the analog signal coming from the vibration sensor we will use node red installed on a raspberry pi using a snap 7's python library to control the plc from the edge we will even use a human machine interface within node red then we will use capware server.x to connect to siemens s7 1200 plc to azure iit have by mqtt we will also uh use azure stream analytics tool connected to iot hub with a machine learning function built in a transact sql query and last we will use power bi to create a real-time dashboard to see the magic including a python script with python visual within power bi on the hardware side we have this small lab which is going to simulate our own small factory consisting on this small three-phase motor which is moving this wheel to variable speeds we are measuring vibration on this bearing with a talking vibration piezoelectric sensor that is our x device raspberry pi 4 connected by ethernet to this plc s7 1200 which is controlling this variable speed drive so let's start with part one note with and s7 1200 plc on the edge in this case we are using node red not extracting data from the plc but to send instructions and write values on some plc inputs we are going to use uh the three digital inputs to control it because our plc doesn't have analog output we can see a detail of the widen three wires from digital outputs on the plc going to the three digital inputs of the speed drive and we're taking advantage of a nice feature from siemens plc called binary code selection that allow users to set up to eight fixed frequencies using the three digital inputs before going to node red we need some basic ladder logic instructions in the plc we will start opening the tia portal learning the basics of tia portal and plc programming is out of the scope of this video but as you can see here there's really a magic logic i already had my plc and rodeo basic pro and block so what we have here first we have the three digital inputs of the plc those are the ones that we will write we will control from no red and three digital outputs that are physically connected wired to the speed drive as you can see we are using variables like m0.0 m0.1.2 instead of using the regular input addresses like i0.0 we use memory addresses as inputs this is mandatory to be able to command the plc from no red we will see later how to build this hmi let me see but just wanted to show you how the logic in movement works see the rest of the the rest of the networks are for sensor signal processing we will see this on the next video so let's go with no red even thought node red connects different iot hardwares to be able to write and read from siemens s7 1200 we need to use a snap 7 which is a ethernet communication suite for interfacing natively with siemens s7 plc's you can download and installed it following this good tutorial i will leave the link on the video description so what's not red we are here in the home page now red is a programming tool for wiring together hardware devices apis and online services in new and interesting ways well first we need to install no project on raspberry pi here you got the specific instructions they are pretty you know straightforward not much to say just wanted to outline that if you want to use uh no reading regular basis you probably want to make it auto start on boot here you have the commands we can open the editor for that we need to know the ip address of our raspberry pi copy the hostname the url and change this with our ip address and it should work okay so this is how it looks this is a blank flow we can see different nodes on the left for injecting data functions apis communication protocols like mttd the good thing is there are thousands of nodes to use with node-red available to download in a case we're going to use a node to communicate with siemens plc so we need to install it installing the nodes is quite simple you just go to manage plate and let's just search for the specific node in this case this one is the one that we are going to stall we press install [Music] install and it will install i will pause the video now okay it is installed now we have three more nodes as you can see under plc which are this one which is for reading data from the plc that one that writes memory in the plc this is the one that we're going to use and this is for advanced control of the plc we're not going to use this so we need this one we will drag and drop it here what we do have here it is asking for a new endpoint so we we select the new endpoint and then we need to insert our plc ip address in our case this one we leave the port like that we use slot 1 for siemens uh 1200 and 1500 series is slot 1 for 300 series slot 2 and 400 is slot 3 in our case slot 1 and we're going to give it a name let's say plc s7 1200 and we click and we click now on variables we need to add the variables that we are going to use with the plc if we go back to the tia portal we can see m0.0mc.1 and m0.2 are the ones that we're gonna write and now we just have to write it like that mgu.0 name input1 for example i'm gonna add two more okay for a general use in node-red seven node web page you can see the variable addressing whether you are using a memory or database or whatever address you have the names in node red the first column the second column is the tia portal equivalent we click add and then we're done for the first if we clicked on we have this node we need to select the variable each node is going to be one variable okay so the first one is going to be input one we want to be we're gonna call it input one for you know simple use and now we have as we have three three inputs we're gonna copy three notes and we will just change the input for each of them oh input two this is going to be input 3 okay i will create now a quick logic so you can see how it works let's use one injecting node this is for injecting manually injecting data okay so we will choose the boolean because our input they they can be true or false okay and then i will use another one for false call it false so how does it work i connect this to the first input and i connect the false to the first input as well i'm gonna use a debug node so we can read what values are we passing to the plc node okay we can check it in the back tab we can deploy we are online that means that we are connected to the plc for the demo purpose i'm gonna use instead of my face the plc's image so you can see the changes live on the plc okay so now if we press true we should see you see the lead on the the plc lighting the output number one and in the plc we can see the fixed frequency which is seven h if we press false it will go back to zero see through false to control input number two we could go like this we could go copy paste to input 3. if they are or false the system is stopped if the first one is true is the first the first frequency the first one and the third one are true that is that is 35 earth and so on of course this is not too smart if we want to change the frequency in a more convenient way we use a selector from a dashboard this is going to be our note red human machine interface we need to look for dashboard here this is the one you see it's been updated just three weeks ago we install it okay it is installed now we can see there are a lot of new nodes here we're gonna use the slider and also we're gonna use the gauge first of all we select the slider it is asking for a new user interface group we will click here and now we'll set a name for example motor frequency now we need to add ue tab as well let's leave it like that okay we will add and then add again [Music] now the range is going to be from 0 to 49 which is our preset frequency range step is going to be seven and we're going to select only on release so we can see the number of each step we will see this later okay we're not gonna send any message so we'll leave it like that for now then the gate we're gonna select the same group okay [Music] 0249 just like this slider we're going to change the color gradient that one for example and then red okay and done we're going to connect the slider to the frequency gate and we're going to deploy and see what happens now if we go to dashboard and we click here we're gonna see our human machine interface working okay okay so we're gonna get rid of all these manual inputs we're gonna see what is this slider giving us okay so i'm gonna use debug node let's connect it and deploy and we will see what happens if i select 14 21 35 we will see here 14 so we are getting the message payload number of the frequency that we have selected okay this is what we are getting from slider so how we do convert this into inputs which are true and false for each one of the inputs in the plc for this we are going to use a javascript function here this node allows you to write a javascript function and then it will return the thing that you want it to return okay i'm gonna select three outputs okay so i can connect each of the each of the outputs to the inputs in the plc and then i'm gonna write the logic here okay so here we go this is the basic logic very simple we have three declare variables which are input 1 input 2 and input 3 on the plc they are initially set to false then we have this is what we are reading from the from the slider from the slider node okay sorry so we are reading message payload in case the message payload is zero we're gonna set three the three inputs to false in case the payload is seven we will set the first one true second one to false and the third one to false accordingly to the binary code selection we just return the three inputs and send them to the plc nodes okay so we connect it we're gonna call it like javascript function okay and we will deploy we can see what happens if we go to the okay let's see 7 14 so that's it this is our human machine interface dom with no breadth even though we are not using node red to send data to the cloud we will use cap server x and we will see that on the next video i just wanted to show you how easy it would be to to send data from node red to the cloud we will create a new flow we will use the reads data from a plc node we will select the same endpoint and we will just add a new variable we have here the vibration data this is the address db1 dvd 0 we will go back to node red write the equivalent address in node red which is this we will see we will write vibration in meters per square second its acceleration we will update we will select the new variable done we can use a debug node just to see what we are getting we deploy and we start seeing the values of the bible it will be easy as using mqtt broker and publishers message so to connect to a mqtt broker we just connect this we select the this server we we configure it and as simple as that okay we're not to do this as i said before we're going to use capsular x and that is for the next video hope you like it and see you in the next video bye
Info
Channel: Fidel de la Hoya
Views: 11,368
Rating: undefined out of 5
Keywords: Node-RED, Raspberry Pi, TIA portal, Siemens PLC S7 1200, IIoT, KepSErverEX, Azure IoT Hub, Azure Stream Analytics
Id: igoLWV9P6Nw
Channel Id: undefined
Length: 21min 26sec (1286 seconds)
Published: Thu Sep 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.