Register writing and safety concerns using modbus over RS232

Started by lrice648, December 19, 2015, 02:01:06 PM

Previous topic - Next topic

lrice648

The first section of the classic register map has always caused me slight concern:

QuoteThere is not a convention on the write-ability of registers. You may write to any register in the system including registers THAT MAY DAMAGE OR
DESTROY your Classic and attached equipment like battery banks. Please make sure that you understand what you are doing before attempting to change
any settings (like battery voltage) using the raw MODBUS interface. MidNite Solar cannot take responsibility for any damage to your Classic or system in
the event of mis-configuration.

I am finishing up an arduino based monitor that uses the RS-232 interface instead of the Ethernet interface. My concerns come from brownout situations or some other unforseen problem where it could be possible (if perhaps statistically highly unlikely) to have the correct junk data go out over the RS232 interface to possibly screw up my classic or cause some dangerous situation.

Am I being completely paranoid here? I have no code that ever writes anything to the classic - my monitor is purely readonly, and I might even strip out the part of the modbus library that writes for good measure (and slightly reduced code footprint), but is there anything else I could do safety wise to prevent any erroneous writes go registers on the classic? Honestly I wish I could disable write altogether since I don't need it, it feels a little bit like having a loaded gun sitting around.

There is the possibility of using the Ethernet interface as well, which might introduce more safety but the serial interface seems more simple and fits my needs perfectly for now.

Ideas or comments? Has anyone else approached this in any of the other open source projects?

dgd

Quote from: lrice648 on December 19, 2015, 02:01:06 PM
... My concerns come from brownout situations or some other unforseen problem where it could be possible (if perhaps statistically highly unlikely) to have the correct junk data go out over the RS232 interface to possibly screw up my classic or cause some dangerous situation.

Highly improbable I would say. So much so that it's not worth any thought since there is nothing could ever be done to prevent such an event.
I have installed fourteen arduino monitoring systems with Classics and there have been brown outs and strange events aplenty, but never a modbus unwanted write that disables or damages a Classic.

Please post your open source in the Arduino section of this forum

Dgd
Classic 250, 150,  20 140w, 6 250w PVs, 2Kw turbine, MN ac Clipper, Epanel/MNdc, Trace SW3024E (1997), Century 1050Ah 24V FLA (1999). Arduino power monitoring and web server.  Off grid since 4/2000
West Auckland, New Zealand

lrice648

Thanks for the reply man, the system is one I built for my mom so I'm always slightly paranoid that somehow I will be the cause of her house burning down or something. I would feel better if I could lock it down but you are right, I'm sure there is no more danger than already with internal shorts or lightning, which it is already protected against as well as it can be.

I will definitely post the system and some schematics once I test it out over christmas and maybe clean it up a little. It seems like a mess compared to some of the other stuff I've seen on here but it seems to be pretty stable in my testing so far.

paul alting

#3
Removing the code section from the Modbus library would not normally offer any further gains, not even code size, as the compiler will only compile code that is actually used.
So, if you don't make use of functions, say Modbus write functions, then the compiler will see no reason to include this code into the actual executable code.

Using Ethernet over RS-232, again, offers no further gains, just added complexity in code and hardware and more power consumed by the Ethernet processor at the Arduino end.
Many people don't realise that Ethernet is still a serial method of communications, like most communication protocols is use today, the data is shifted out bit by bit.
Just that the higher application and transport layers, data rate and electrical parameters can all be different amongst them.
An example of a non-serial form of communications would be the now obsolete parallel printer interface, often called a Centronics interface, where the data is sent byte wise at a time over many wires in the cable.

To hopefully give you some reassurance, Modbus is a highly reliable data protocol, which started its life in the industrial control and process world where there is little to no room for any such errors or failures to occur.
____
Paul
6 x 200W PV into home-brew 6 stage MOSFET charge controller : Microhydro 220Vac 3 phase IMAG
8 x 400Ah LiFeYPO4 Winston : Latronics LS2412 inverter
QuadlogSCADA control and monitoring system : Tasmania, Australia : http://paulalting.com

lrice648

@paul, right on both accounts, and good point about modbus being an industrial control protocol. I was forgetting (maybe not forgetting, not thinking about) the CRC which would be astronomically unlikely to be correct as well as the function code and register address values.