Is RS-485 a suitable physical layer for Atmega chips in a home monitoring situation?

The biggest drawback to this system I can see is that if the slaves are all power cycled for some reason they will all collide when trying to join the network in the grace period. This means it may take a very long time until they all rejoin the network.

If you have a limited number of potential addresses (say 256) the master can always poll a currently unconnected slave address to see if it has sprung into action. So if you have 20 actives slaves, then the master polls a 23 rd slave each "round" and numerically increments the unconnected_slave_address for the next "round". It will only take a few seconds to do enough rounds to find a new slave and then the job is done.

No need to have a grace period; just one more slave slot will do the trick and when a new slave (or errant slave) is found it gets listed as "active".

And yes, RS485 is a suitable physical layer for this.

My plan is to use Attiny84 chips to implement this. Each board would be fed with +15 VDC and +7 VDC. I can regulate this with 780x series regulators to +5 VDC and +12 VDC for powering the chips and any other sensors or relays I may wish.

I would use low drop-out regulators and I would give the drop-out voltage a little more headroom - there will be maybe a volt induction from your local home AC wiring and this means the regulators need a bit more space to regulate properly.

I would also consider using Manchester encoding so that you can high pass filter the data received without fear of corruption. 100 kohm biasing after the capacitor should be OK no matter how many slaves you have in place i.e. it won't destroy the impedance matching from end to end of the cable. I don't know what data rate you intend to run at but working at or above 9600 Baud seems sensible to help the high pass filter block any AC pertubations. Yes I know RS485 is a current loop but if you can inject a little bit more hardware security at the design stage it will pay dividends.

Designing for Manchester encoding also gives you a better chance to implement RF links should there be a need for any in the future.

Just a few thoughts on doing this if writing your own protocol.


On the wire level RS-485 is a "party line". RS-485 is easy to implement when there is a single master. If your devices don't require "P2P" connectivity (eg. the current sensor does not care what the humidity is) then Modbus is a proven and simple solution. Don't reinvent the wheel.

I've used FreeMODBUS with many AVRs to implement slaves (it is quite bloated, but memory is cheap). You can buy a USB<->RS485 adapter and run software like qModMaster to test your sensor or use libmodbus to write your own programs.

If you need "multi master" then RS-485 is a very bad choice and your medium access control will be complex (been there, done that). In that case CAN would be the usual choice.

When connecting many devices to a single bus make sure to not exceed the maximum unit load of your transceivers.