Connecting Lorawan to Modbus

I have a Rak7248 which is a lorawan gateway running on a Raspberry pi. I also have running on this pi, mosquitto which is a MQTT broker. I can currently get data from a Lorawan node to a PLC via the MQTT protocol because my PLC supports this. But i use other PLC's and HMIs that do not support the MQTT protocol and will need modbusTCP protocol. If i understand correctly, Node-RED can accept the MQTT packets from chirpstack through the Mosquitto broker. What i also think i understand is that node-RED can write directly to modbus registers that my older PLCs and HMIs can connect to? is this correct? if this is the case, my trouble lies in first my limited knowledge of the linux/ debian command line as well as it seems i can not get node-RED installed on the RAK7248 as it says i am missing dependancies (i think that is what it said) is there anyone else doing what it is that i am trying to do?

Welcome to the Node-Red community! If you already have a MQTT setup going on, you're more than half way there. Congrats on getting this far! But, you'll need to give a little more detail. Are you installing Node-Red onto the RAK7248 itself or onto the Pi that is operating it? If you have Node-Red installed on the Pi, I would question the need to install it on the gateway installed on the Pi. If the installation instructions don't work that are listed on the main Node-Red instruction pages, then it probably means your distro doesn't have the necessary packages to make it completely work. But I would imagine you wouldn't need it anyway since your Pi is already doing it.

You're most of the way there then. All you need to do is install the node-red-contrib-modbus module and you'll have everything you need for MODBUS communications. But, I'll throw out a personal opinion. If you have most of your PLCs running MODBUS, why have a second protocol thrown into the mix? If your MQTT capable PLC also supports MODBUS, just have them all on MODBUS and call it good. That should ease your program a ton because of simple organization and copy/paste functionality between setups. Not knocking on the MQTT protocol at all. Just one of those things where if you have a problem, it helps if you don't have a ton of unique stuff happening in your program to weed through. Again, personal preference, but something to think about. You know your setup much better than me.

Yes. Like I stated above, it's a very simple implementation and has a lot of flexibility. Just make sure you have the MODBUS information for the PLCs you have so you can implement it correctly. I have several control units running on MODBUS over TCP with no issues, so I know it can be done.

That's where I would start. But if you'll provide some more details of your setup and why it is the way it is, we can help you more precisely.

wow. thank you for the fantastic response. MQTT was the easy lift. thats why i am using it currently. Is it possible to omit mqtt (mosquitto) and just go straight to modbus? From what i understand, chirpstack can integrate to many other programs. how do i make the connection between chirpstack and node-RED without mosquitto?

sorry, i remember why i needed mosquitto also. I have some esp32 wifi modules that are sending data this way (mqtt)

Node-Red is handling the data "raw". It's sending/receiving through MQTT now, but all the data flowing through Node-Red is raw. Just tap into the data stream and send it out or pull it in from your MODBUS. Adding MODBUS is easy. Just make Node-Red your fabric that handles the data flow. As long as you know the specs of your units (their communication settings and what registers to poll), you can add MODBUS. It's super easy.

Make sense?

this makes good sense. I am stuck right now on installing node-red om my PI. i cant seem to get it to install even though i have followed directions. Running on Raspberry Pi : Node-RED ( the BASH instruction does nothing other than a little delay of time before a new command line prompt.

If you're installing it as a service, you won't get much more than you've described. And chances are, you got exactly what you were going to get. You have to start and stop the NR service by using the commands node-red-start and node-red-stop. That's about as much interface as you'll see. If you try connecting to the editor on the Pi through a browser by using http://localhost:1880/, you should see the editor pop-up. You should be able to log in to your Pi from another system on the network through http://your.pi.ip.address:1880/ and see the editor page as well. Just make sure you can start and stop NR before you try because if you have it stopped as a service and try to connect, you obviously wouldn't get anything.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.