Hi, I'm developing a home automation system for my home with many Arduino Pro Mini boards connected trough a rs485 bus. I need an application protocol running on top of rs485 that has some kind of addressing, an error correction and it's easy to use (I'm not an expert neither in electronics or communications).

For error detection, I'd be inclined to use a credit allocation flow control mechanism. Basically everything you send has a register/memory location and data to go with it. The first device (sending the data) sends an 'S' for send, the register/memory location, and then the data. The other device responds by sending 'A' for acknowledge, the register/memory address, and the data received. If the received package is different, or if there is no response in a predefined time, resend the package.

However I would like to use something more user-friendly, something ASCII based with possibly automatic addressing (DHCP style). There would be great if there was a xAP or xPL over serial connection, but every implementation I see is for Ethernet. I would like to use a widely used protocol for Home Automation, so I could use a HA software for interfacing with my hardware.

Modbus Ascii was developed for use with Modems and is a standard protocol.

From off the top of my head, you basically have a start character which is always Ascii character ":", then you have the modbus function, modbus address, then the data, number of bytes, LRC error check and then Carriage Return and Line Feed characters.

Its a bit more 'structured' than RTU as it has strict start and end characters, so you can have a bit of a pause in between and it wont effect the outcome, whereas if you have something like 1.5 clocks with no data in RTU then it discards it and waits for the next frame.

This is all off the top of my head so I may have made a bit of a mistake in the order of things, however it is roughtly correct.

Is the Arduino i2c wire library could work on multi-drop rs-485 network?

I need something very simple, but robust. Just an address and data fields in ASCII format is enough. The whole thing about Modbus that reads and writes registers is too complex for me. I come from the world of PHP and web developing and working with registers sounds scary to me...

Just make a protocol up then.If its only going to be used for your own devices, and not interfaced to anything else with a specific protocol, then just make one up.

form a string that you print to the serial port, seperate each variable in the string with a comma or something. This is what I am currently doing for one of my projects.

I have a start character so the PC can easily fix onto the start of the string. My start character is the STX character which is HEX 0x02.

I then have the data I want, seperated with commas. ie DATA1,DATA2,DATA3

I then have two end characters to show its the end of the string, which are Carriage Return and Line Feed. 0x0D and 0x0A in hex.

Start and End characters make it very easy for the PC to lock onto each 'frame', so it gets the entire frame and not the end of one and the start of the next and try to perform some sort of calaculation on the data.

and then on the receving end, assuming it will be an arduino you are talking to also, just have it read in the broadcasted data and if the first field is equal to 10, then that device acts on the data, otherwise it discards it.

I'm still looking for a suitable protocol for HA over RS485. Modbus RTU is too complicated for my needs. I need something simple, but robust and reliable. It would be best if there is an Arduino implementation also.

Maybe you will laugh to me, but how about using the Arduino's Xbee library? As far as I see it uses the hardware Serial port, RS485 too. It has many built in checks and is simple to use. It's a multi master protocol, which is something I like (not like Modbus). Is there something that is specific for the medium (wireless) that will not work on wired serial medium (RS-485)?