Triggering TimeSync to end devices
-
I used that one as well. It does not have a modbus function 6 which is what is sent out from Mango. I hacked a function 6 in the arduino and I can write to it now. It is not pretty and plan on create a class someday to abstract the communication layer.
-
OK, thanks for the tip. I also added function 6 and I can now set points too :) I also made the whole thing into a separated Arduino library (which was something that needed to be done anyway).
I also added code to make it easy to check which registers were changed by the master.
I'll ask jpmzometa if he wants to include the changes.
(Again, sorry for being off topic here)
-
Great. It is nice when progress is made.
I transfer write registers to separate variables. If I need feeback of a write I use seperate read registers. That way I know my embedded code is performing correctly.
I will be hacking a broadcast as well for my nightly time syncs. Slave ID of 0 is not allowed from the ui. I will pick one arduino to respond to an address 1 request while the others are passive and used that as my broadcast address.
-
Hello.
How can I send time and date to all arduino slaves with mango and modbus rtu?
Is it possible?
Thanks
-
You can't set the broadcast address of 0 on the mango UI. If you want to work with the existing code base, select another address say 1 as the "broadcast" address. Not sure what you have for modbus implementation on the arduino side but probably is minimalist and probably does not have broadcast handling capabilities. I am assuming you got what was floating around for free. I had to add modbus functions on the arduino side to do what I want. I did not do broadcast functionality but it should not be too hard to implement.
I would change the code to handle a "broadcast" address and have only one device respond to a request to the master and the others are passive listeners. That way only one entry is required on the Mango side along with a CRON event to trigger write the timestamp.
Otherwise you could probably use Mango events to fire off to write the date/time as a unix epoch timestamp or what ever format you want to send to registers in Modbus and manually configure a date/time point for each device. That would emulate a broadcast.
Not sure if that helps.
-
I'm using this library in arduino.
http://sites.google.com/site/jpmzometa/arduino-mbrt/arduino-modbus-slave
It doesn't implement broadcast messages. I was talking with the writer but he is busy to add that feature.He says that there is no reply from slaves for a broadcast message.
It's very interesting to add broadcasting to the library but my C++ knowledge isn't good enough.
-
That is the one I used and modified on my own for my own consumption last year. Even if you add a broadcast in the arduino code, the UI on the Mango side won't let you add a broadcast address of 0. So elegant changes or a hacks needs to be made, hence my suggestions.
-
The writer of the library told me to make myself the changes and add them to the official release.
If you send the changes he will add them in the web page.About Mango modifications... Is there any answer from Serotonin?
-
@mlohbihler said:
Update: the slave side of Modbus4J supported broadcasts, but there were problems on the master side. The library has been updated to fully support broadcasts now. Changed code has been checked into the CVS repo.
Modbus4J works with broadcast, Mango not. Am I right?
-
There are several options presented in thread. If you don't feel comfortable with the C++ or looking at the Mango code, as stated earlier you ca create an event to write to each of the registers in your arduiono with a UNIX epoch timestamp from Mango.
-
Yes. Send time to every slave is the way I was using in the pass. I was wandering a better way to do it.
-
It gets difficult if you don't feel comfortable changing the modus C++ code on the arduino side. The code is easy to follow and change.
-
have you made the changes in the arduino library?
-
yes but not for those you want. If I get a chance I implement the change I suggested, but don't have much in terms of cycles so can't give a time.
-
Don't worry. Sure you are faster than my C++ skills