Hi everyone, today we're going to be looking at the Do-more PLC Node-RED HTTP request
Now Node-RED HTTP's request will need to read any BRX or DRX Do-more PLC memory area
The HTTP or Hypertext Transfer Protocol communication will only read information from the controller
Detailed information contained in the video can be found at http://www.httpanimation.ca. A link is in the description below
If you have not watched the other videos yet, there will be links in the description below that will show you a video of one
There will be links to the rest of the videos in the series as well. So the BRX Do-more REST API is used to read information using a URL or Uniform Resource Locator or Web Address
We will be using the HTTP request mode in REST Node-RED to read information from our BRX Do-more REST API enabled controller
Writing using Modbus will also be shown. This will be done on a Raspberry Pi 4 single board computer
Now the Do-more REST API is set up. And the REST API really stands for Representational State Transfer and the API stands for Application Programming Interface
This is allowing you to use the URL with some parameters to read data from the BRX controller for the BRX Do-more controller
This is available in version 2.8 or higher of the Do-more Designer software and only applies to the BRX Do-more controllers
So what we will do is call up the System Configuration Menu by using the main menu, ULC, System Configuration
And under the System Configuration, what you will see is that we have down here our web server, HTTP
And right now you have to enable this portion. If you go into the settings themselves, you will see here is my REST API
And so that's what you want to do. You want to ensure that this is actually on here
So since it is, we'll just hit Cancel all. That's the first thing to do
The next thing to do is you can see that for Add Security, you have a server whitelist
And if we enable that and look up the server whitelist, we actually will enable our HTTP and REST API
And then we can add a range or a single address that we are going to be communicating to
So it will allow them to interact. Or we can add our entire location
So again, it's the server whitelist can be set up. So I'm just going to cancel that
And we're not going to be using that for our applications, so anyone on the network can actually read and write or read through this controller using HTTP
So that is that part. And then what we also should do is to look at the IP address
So in this particular case, my Do-more controller actually has an IP address of 192.168.1.11
If you look at the configuration of that, you will see that we have, it uses the following
So we set a static IP address. And this is my subnets, my gateway and DNS
So that is our configuration. And it's important to have a static IP in order to determine exactly where this controller is
when we do our requesting of the information using the REST API
So once we have that done, for example, the only other thing to do is to actually look at our Modbus TTP server as well
Since we're going to be writing to this controller, we have to enable our Modbus TTP server
Now it is enabled by default. And if you look at the settings, you'll see here that we have our matching settings with core
our client activity timeout, I set for 3600. It defaults to 60 seconds
And then our default port is 502, which is the same for all Modbus TTPs
So once we're done with that, we just hit OK. And we transfer that to the PLP
So once we have that all set, you can actually notice that all I have here in my program is an end statement
And because of that, it really doesn't require any program in there to actually do the REST API
So let's test our API. And what we'll do is just pull up our web browser
In our web browser here, we specify address 192.168.1.11 using HTTP colon backlash
And we specify input X, 0, and 7. And once we hit Enter, you will see that there's our input
If we actually look at the hardware that we have here, you will see that here we have our BIRX controller
And we're in running. And we have a sensor here, faster type sensor
Then here we have our Raspberry Pi over here. And it's actually running the node red, grabbing information from our BIRX controller
And this will verify that we actually are communicating with the REST API
If I turn this off, and then we'll try our input again
you'll see my first input is now off. Do that again. We'll refresh this. Again, it turns back on
A very quick and effective use in tuning the CDOM reading my input
If I need to read output at the same time, all I do is add the AND sign
And I can say output. And then we'll equal. And then we'll say from 0, and we'll read 6
Hit Enter. And now, oh, that input, because I forgot to put a Y in here
10, which is the actual address itself. Hit that, and now you see my input and output
So, very easy to just put in a URL request and get the information from your controller
So now let's see how that will interact with node red. So here we have our node red up here in the tree
And you will see that the HTTP request node is installed automatically when we install node red
Information can request from your web browser. So, what you'll see is that we have a timestamp here
We'll read the bits in the PLC. And then we go to a payload
And our message request, if I double click it, you can see that I'm asking for inputs
At 0, I'm asking for 10 of them. I'm also asking for my outputs
Y is 0, and I'm asking for 8 of them. I'm also asking for 2 bits
2 is 0, and I'm asking for 128 of them. Then what you'll see is by return, I'm using a parse JSON object
So, I can read things in different types and get the information back in certain formats
There's a different format, and I chose a JSON object. And that's what the REST API will bring back the information in
So, if we look at... And now, let's take a look at our..
Let's take a look at our debug here, which is looking at payload
And let's just activate my injection mode. Bring it to my HTTP request, and it shows my payload
If I do that, you can see here, it applies payload request, and it's highlighting some of our message inputs
And there's my inputs, the 10, my outputs, the 8, my C bits, and my 128 of them
Again, just like we did before, here's my input. So, if I turn that off, or take that first bit off, and try it again
you will see, again, my inputs. And now it's off. So, that seems to be working well
Next, what you can do is you can read, like I said, any of the memory areas within the bridge controller
So, if we hit this request, this request will actually bring back my B memory and the 128 of them
My B memory, or double memory, and my real memory, or real value
So, let's try that. We'll hit the ingress mode, and again, you can see that we have our arrays coming back in JSON format
And our B memory is right here. Real 10, and there's my parameters for those
So, you can get a lot of information very quickly out of this controller using two HTTP requests
And, by the way, you can also read, unlike ModBot, a lot of the text messages
So, we can read our SF and our SL memory areas within our VMware controller
So, that's it. And you will see down here is my SF memory and my SL memory
And you can see the text messages, or the messages coming in here
And these are text messages, or action codes that represent. Now, just a note of warning, we have to ensure that the message, or the text, does not include any special characters, like carry, return, or line speech within those parameters
Because this will cause an error on the HTTP request node. And then, finally, you'll see that everything that we've done so far has been just a read
And that's what HTTP requests will do. And that's what the Ref API on the Grid-VMWare PLC will do
It's just read information. So, if we want to write information, then we must use our ModBot write
So, here, what we're doing is we're going to read the first 10 B memory areas
And then we're going to bring those back in, again, as a parse JSON object
And once we do that, we're going into a function block here, which will then take that B memory area
And you can see that we just use it as strictly as a JSON value here, in our payload
We're going to be using multiple write using ModBot. User address, user ID is 1, which is our address here
And then we have our address 0, and we write 10 of them. Then we use our ModBot slack writer
And what we're going to do is we're going to use the DoMoreBricks PLC as our server
And that's our IP address again, as we specified before. So, what we're going to do is just hit send
And what you're seeing here is there is my B memory area, and there are my parameters
If I look at back to my DoMore, you can see here that here is my B memory area
And they map directly to my NHR area, or ModBot folder register area, 1 to 10
So we're just copying those to here, and again, with every new program that we have located in our controller
If we start changing a few of these values, let's go 51, 52
And then we'll just write those. And I'll also write 3 of this memory area as well
So I'll go back to our Node-RED. And again, what we'll do is just clear that, and we will hit the transfer again
It shows me here from my payloads what my values are, and they're the same ones that we had before
So 50, 51, 52, that we just changed. Going back to our bricks, you can see here in my data view, you can see again, these have now changed to 50, 51, 52, and the rest of the values
If we want to change them all the time, what we can do is we can do a complete, and have a complete down here
So once we've completed our lab block select right, and what we want to do is go back and refresh again
So we can easily do that, and we'll hit here, and once we have that
then what we can do is go back and refresh this again
And now what this will do, and we'll deploy that. And what this will do then is go through here, request, do the function, to the right, after that's completed, it triggers that again, which starts a request, and that's it
So it continuously updates our values once we've started it. So what we'll do is, we've already deployed that, and so we'll just curse that up, and there we go, there's some fees, and there we go
And again, if we look at our view more, and our values as they change, we'll change in here
So if you enjoyed this video, please hit the like button below
If you have any questions about the video, please leave a comment below and I'll do my best to answer it
If you want more information about us, or you want a free ebook on numbering systems or about data logging, please click on the link in the description below to get it
A new video is uploaded every Monday, so make sure you hit the subscribe button to get more videos like this in the future
Remember to click the bell beside your subscription box to receive those notifications
Thanks so much for watching, I'll see you next time. Stay safe