Тёмный

Modbus communication done right in Node-Red 

Csongor Varga
Подписаться 36 тыс.
Просмотров 14 тыс.
50% 1

I have been using modbus in Node-Red for a long time, and always had small connection and reliability issues. Until I found out that I was doing it the wrong way. But know I know how to do it the right way, I am sharing my findings with you here.
Example flow: github.com/nygma2004/km/wiki/...
Chapters:
0:00 Intro
1:14 What is the problem?
4:53 Easy solution
7:21 Bespoke queueing
15:40 Simulate how it works
20:36 Review the code
25:09 How you should implement this
29:10 Final thoughts
31:20 Outro

Наука

Опубликовано:

 

20 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@anetosaraxtos8912
@anetosaraxtos8912 Месяц назад
Great Video! Really helped with a complex industrial modbus integration. Many thanks!!
@icservis
@icservis 8 месяцев назад
Well, that's exactly what I need. Thanks a lot, fits perfectly to my needs. Just moving from Homeassistant implementation of Modus, which is actually not working very well, to such a kind modbus2mqtt converter.
@vin12666
@vin12666 Год назад
Great video. Only the delay node of 500mSec is not needed. You can enter, for example, 0.2 (seconds) in the interval field of the inject node. Which gives 200 mSec intervals.
@csongorvarga
@csongorvarga Год назад
Thanks!
@bjarnemoeller5910
@bjarnemoeller5910 Год назад
Genius. Solved a big issue we have had for some time with a an industrial installation with multiple nodes causing the the ModBus to hung. Thanks!
@csongorvarga
@csongorvarga Год назад
I hang similar issue for at least 2 years until I spent the time to dig in and understand this.
@jankokert653
@jankokert653 Год назад
Very good video! Thank you! At 5:30: You can input a faction of a second in the inject node (0,5) and so you can get rid of the quirky 500ms delay.
@csongorvarga
@csongorvarga Год назад
Thanks. I don't know why I did not try that.
@HelloHelloXD
@HelloHelloXD Год назад
Looking at this I just love the simplicity of MQTT ;-)
@csongorvarga
@csongorvarga Год назад
Yes it is, but if you need some (especially industrial) device, it will most probably use modbus or some other protocol than MQTT.
@AxilRod72
@AxilRod72 11 месяцев назад
Thanks very much this is very helpful
@bennguyen1313
@bennguyen1313 Год назад
What hardware do you typically run your Flows on? Would Node-Red work on 8-bit microcontrollers and RS485? I'm ordering a Pi-Zero and EsspressIf boards.. any thoughts on using python to talk to a modbus temperature sensor (RS485)? For example, I see lots of options but not sure the difference: minimalmodbus , stephane/libmodbus , ClassicDIY/ModbusTool, eModbus/eModbus , modbus-esp8266 , QModMaster , rossmann-engineering/EasyModbusTCP_NET , EasyModbusTCP/UDP/RTU _NET? BTW, modbus kinda looks like CanOpen.. is there any connection?
@csongorvarga
@csongorvarga Год назад
I am running my Node-Red on a Dell Optiplex micro PC with Linux. So it is a lot more powerful than a usual raspberry pi setup. Node-Red needs a proper computer to run on, no microcontrollers. Back in the day before Node-Red, I use this python script to read my solar inverter over modbus serial. That should get you started: github.com/SteveNew/GrowattRpi. I have no heard of these libraries, there must be tons of implementation of the protocol. Modbus is a very simple master-slave protocol, where a master manages the communication. On a can network all the nodes can communicate and need to handle collision. So it is quite a different concept.
@BGazzah
@BGazzah Год назад
I have not used MODBUS in a number of decades :( This is certainly simpler than the hoops we had to jump through back in the day..
@csongorvarga
@csongorvarga Год назад
There are still so many products that use modbus on the market, and usually on affordable price. Even this is an ageing protocol, it does not appear to be dying any time soon
@BGazzah
@BGazzah Год назад
@@csongorvarga A good, simple, reliable protocol deserves to last. It was never considered "fast" but more than enough for its target use case. Also the hardware was so simple to install..
@user-fc5dz3dt3w
@user-fc5dz3dt3w Год назад
Hi Csongor. I am currently using node-red for several connections and I have problems with the modbus server that I mount on node-red, after a while it stops working and I have to disable and enable that flow to get the server up. The whole project has OPC-UA, MQTT and Modbus communications, all in different flows. Using the node "ModBus-Server" or "ModBus-Flex-Server" I can raise a Modbus server or Modbus slave and configuring it with local ip address in "bind-addres" and in Port I put 55380, the problem is that it works for a while and then it stops working. I can't find what the problem is and it only crashes if it is working with other flows with OPC and MQTT communications. All other communications are working properly
@csongorvarga
@csongorvarga Год назад
This sounds like a complex problem. I had somewhat similar issues when I was using the modbus getter, but after moving to the flex it was OK. Do you get any exceptions or warnings from any of the modbus nodes? Any information in the logs?
@ThePollution666
@ThePollution666 Год назад
Very nice Video! I have a problem with my setup. I need to read a scalefactor and the corresponding value at the same time but they are pretty far apart so the addresses are over 200 registers apart. How would you read them simultaneously? I am reading a solar inverter with a sunspec model. Just for reference :) Any ideas?
@csongorvarga
@csongorvarga Год назад
Thanks. I have similar cases, I think for one of my energy monitor, that voltages and currents are in a first 10-15 registers, and a final accumulated consumption is around register 343. I read the first 10 registers, and next I read the rest of 3-4 starting from 343. Do them is separete requests
@ThePollution666
@ThePollution666 Год назад
But do you think that the request is fast enough? The scalefactor determines the power of ten for the value, so it needs to be read simultaneously or in very short succession. I'll try to trigger the scalefactor read with the value read. Maybe that works.
@csongorvarga
@csongorvarga Год назад
@@ThePollution666 I think reading two shorter ranges of registers is quicker than reading a very larger range in a single request.
@krzemodam2
@krzemodam2 2 месяца назад
I have an issue, that queue periodically stops. I assume there might be some issue with respond and workflow stops since message with "next" topic is not emitted. Can I add repeat interval on "next" inject node to overcome this?
@csongorvarga
@csongorvarga 2 месяца назад
Yes, you can do that. Next skips to the next request, so worst case scenario you loose a request. But if it is only queries (get functions), it will be retrieved next time.
@szabolcs__
@szabolcs__ Год назад
Something intresting
@hrishikesh2125
@hrishikesh2125 Год назад
Make video on Node red msg queue
@csongorvarga
@csongorvarga Год назад
What do you mean msg queue?
@borjaroca1262
@borjaroca1262 Год назад
In my case worked for a while, i just deployed and says no data.
@csongorvarga
@csongorvarga Год назад
Where does it say no data?
@borjaroca1262
@borjaroca1262 Год назад
@@csongorvarga solved, was a problem of modbus itself, unable to send data then the status of function filled gray and text no data
@stefan-lupo-pelzl
@stefan-lupo-pelzl Год назад
Sadly, I am too unfamiliar to follow the explanations.
@ctlee681231
@ctlee681231 4 месяца назад
How to send Modbus commands using node-red For example 01 03 00 00 00 01 84 0A How to play
@csongorvarga
@csongorvarga 4 месяца назад
Either with the modbus-write or the modbus-write-flex node. But you need to specify modbus parameters like function, start adddress and quantity.
Далее
ModBus, Node-Red and MQTT -Video 1
14:53
Просмотров 29 тыс.
Stray Kids "Chk Chk Boom" M/V
03:26
Просмотров 30 млн
Недооцененный котел в Симс 4
00:37
How to Structure Node-RED for the Industrial IoT
9:49
Easy Modbus Using A Raspberry Pi
16:08
Просмотров 44 тыс.
How does Modbus Communication Protocol Work?
11:53
Просмотров 518 тыс.
Awesome gauges for Node-Red
38:00
Просмотров 24 тыс.
Красиво, но телефон жаль
0:32
Просмотров 1,3 млн