Wired communication for home automation

Hi there!

I'm into a home automation project.
What I wantto make is a multi master, multi slave bus system and my problem is that I don't know what communication protocol and/or standard to use.
First I wanted to use I2C but it's not so good for long distances (like a maximum of 50m (~165ft)) ant ICs like the P82B96 are really expensive considering that I want to use it like in every single device (which most likely contains a bare ATMEGA328P).
I considered using some kind of I2C buffer with higher current drive capability but they are relatively expensive and I can not find an alternative to the afromentioned IC and don't know if I could make something similar with different ICs for a lower price
The other option would be an RS485 system but I have no experience with it. I've heard that if you send data from 2 devices at the same time you can effectively short the system (and by looking at the function diagrams makes me believe it's true) and I don't want to cook my ICs because they are not cheap.
I thought of making my own protocol with RS485 but it's not as expansible az I2C and the terminating resistors...
I want it to be wired because simplicity is always a winner when you plan something for decades and I also don't want to use up all my wifi frequency bands. Basically it's future-proof.

Any ideas or advices?

I went with CAN-BUS It takes care of many of those issues for you.

I wanted to use I2C but it's not so good for long distances

I2C was designed for very short distances. However, when I set about building my heating control system I didn't know that. My heating controller has 5 temperature sensors connected over about 30m of cable and works just fine. I did slow the I2C clock down to about 15kHz though. By all means experiment with it and see what it can do, you might be pleasantly surprised.

The earliest incarnation of my controller used a Z80 processor. Z80s don't have hardware I2C controllers so I had to write a software one. I can't remember what speed it ran at, but I think maybe a few 10s of Hz. It worked perfectly.

My problem with CAN bus is that I can not find any good examples.

I'm thinking about designing a voltage booster circuit for I2C with higher current drive capability. That should solve my problem since I want to keep my frequencies in the 50-100kHz range.

A CAN bus is definitely the best solution for home automation (supports long wires (up to 1 Km), not sensitive to EMI (a differential bus), any node can talk to any other node).

Are there any good libraries for CAN?
I's like to send strings (char arrays to be exact) through the bus and I don't want to write like 50 lines just for that part.

I would think that since you are asking about networking, that using the networking forum might be better than a project guidance.

There are more than a few hits on google with arduino can bus and some seem very simple.

I would offer that getting the parts would help you learn.

I would also offer that you can get quite a few RS485 boards (5v) for only a few bucks.

CAN bus must run to each node in a serial fashion. the RS485 can have a connection to the bus with some distance. for wiring, the CAN would require that you plan out with a bit more accuracy.

Also, I believe that on the RS485, you can use the master and just poll each node in sequence. Do that fast enough and you do not need the node to try to dump onto the buss. thus avoiding collisions.