NodeRed implementation #68
Replies: 4 comments 2 replies
-
I missed the early step of the implementation but the blog of thomas really was a good source for understanding the exchange. Maybe the motors compare the counter with the count of message before counter 35. |
Beta Was this translation helpful? Give feedback.
-
The settings of the serial port are indeed set to 57600 8E1. I have added some timing measurements to the Node-Red implementation, and I found out that most of the time the timings between a command coming in and the response going out of the flow, is around 7 to 9ms. However some times the timings go up to 20-something ms and it looks like whenever the timings exceed +/- 12ms, the motor repeats its last message (same counter-value). So I'm suspecting that instead of too fast, the implementation is currently too slow. And I'm not sure if I will be able to guarantee somehow that a response will always be within 12ms as the UniPi device currently running Node-Red manages also other flows, part of my home automation. And it is a full blown linux running on it, which has of-course several system processes consuming cpu time. I'm still not sure if that really is the cause, but it seems like whenever that has happened at least 2 times the motor stops communicating about 22 messages later than the last time it repeated a command. It is still a bit of a wild guess but that is currently the only pattern I can find in the logs of the few times I tried currently. I find it weird however that it doesn't go into error, but just stops communicating. (the total number of messages does vary and is not fixed to 34 like I said in last forum post) Also strange is that even when the motor is then power-cycled, it just sends the bus-scan command to the known slave ID, which I reply correctly to and then nothing more.. (only one time in the beginning of my tests, the motor then started communicating again for a few seconds, but currently I have not seen that happen again and it just doesn't communicate anymore after sending that initial bus-scan command during motor start-up) I have to manually perform a full bus-scan again before the motor communicates again for a few seconds. I'll try to test again tomorrow a number of times and save the logs to share and compare them.. |
Beta Was this translation helpful? Give feedback.
-
I'm afraid I have to give up. I tried many things but NodeJS/NodeRed on a multi-tasking OS is just not responsive enough, it seems. When prioritizing Node-Red with nice -20, and optimizing as much as I can both on OS and in the Node-Red flows.. I had it communicating for almost 10 minutes and the average response time of NodeRed was now around 4-6ms.. but still sometimes it took just a bit longer.. and once or twice it took over 12ms and a few messages back and forth later, the motor stopped communicating again.. Meanwhile there has been a major OS update of the Unipi from Debian 10 to 12 and Node-Red was also updated from v2 to v4 and according to Unipi there where RS485 performance optimizations in this release.. so I retried everything.. I assume this is the reason why in the original code, there is a CPU reserved exclusively to processing the communication. So I'm bailing out here and will soon buy or assemble a dedicated ESP board for it.. |
Beta Was this translation helpful? Give feedback.
-
I did not use the modbus-client node since it did not support the FC23 request, at least not back then and on the NodeRed version I was using (v2.x). So I had to use the default serial-in and serial-out nodes, and manually parse and assemble the modbus messages including the CRC calculations. |
Beta Was this translation helpful? Give feedback.
-
Maybe it will need a bit more exchange so I suggest to discuss it here to avoid the overflow of the homeassistant thread
Beta Was this translation helpful? Give feedback.
All reactions