is there a way how to use Modpus TCP to get values on Pi.
I have done many projects using Python and Mobus TCP on Pi for web presentation, but couldn’t find way how to use it here.
Some body have idea how to fix this or it is not possible to read/write to Modbus slave devices over TCP.
Maybe is some way using ramdisc file where will be store periodically readed values from external Python routine and Cayenne can read this file…
Thanks for help and ideas
When the API is released this should be possible. It should also be possible now with Arduino if you have one and can port your code over to it.
OK, I will look in the table to check what Arduino I have available there, maybe I have on Arduino Ethernet (Leonardo) - not sure if there will be enought memory for full multiple registr r/w, but maybe I can find some Mega as well, will try and let you know if is it ok for the moment. A have 5 RPi around my house for remote controll and all run Modbus and other devices also regulators for solar power plant is Modbus devices and I would like to collect all in one controll strategy.
So time to play starts again
So it was a bit dificult to use some code for Modbus TCP integration on Arduino.
I write short direct fixed code to manage data transfer between Arduino and my RPI batt monitoring app, but I found one problem and realy coudn’t find how to fix it.
When I place value from register e.g. 1235 to the float variable divided by 100 = 12.35 and put this in VIRTUAL_PIN value than I can see 12.00 in dashoboard instead of 12.35.
How can be this fixed?
Also is it there a way how get line chart storing received value? When I use this Arduino widget in Project I can see only live data w/o history. But when I look into history of RPI widget this working fine, but eating RAM (looks like eating).
So I fix the sending correct float value to Dashboard. I think that will be good to add this option in some tutorial for Virtual analog pin or in Docs here is the code which fix float decimal transfer:
Cayenne.virtualWrite(VIRTUAL_BAT1_1, reg0 / 100.00F);
It is a bit not underestanding for me why replacing “reg0 / 100.00F” with “val_reg0” before assignet with value “float val_reg0 = 12.35” doesn’t do the same…
History data for Arduino will be released very soon! Also, you should be able to edit the rounding of decimal places in the widget settings. Your idea to have doc or video about virtual analog pin is good idea, we will try to get something out!