Electronic – One wire (+GND) serial communication. How to have a correct coupling

avrcommunicationserial

I'm a firmware developer more than a hardware designer. I've a doubt about an idea of mine.

I want to obtain serial communication between eight ATtiny85 (slaves) and an ATmega168 (master – It might be also an ATtiny85, but for this question is the same) using only one wire (plus GND).

I'm writting my protocol and it begins to run. I've used the INT0 pin (PB2) of the ATtiny85 and the INT0 (PD2) of the ATmega168; these pins act as digital output when transmitting and, after transmission or as normal behaviour, become/are digital input to receive.

All the MCUs have the same power source, then if two MCUs transmit simultaneously there will be line conflicts and short circuits (if one transmits 1 and an other transmits 0). I want to avoid short circuits!

  • Is it the right way to use resistors connected with each single pin
    limiting the current?
  • If I use 9 resistors on the line, one for each pin, do the signal
    will have stronger attenuation?

At now I will avoid to use active chips other than the MCUs to manage the communications!

The MCUs are each one on a separated circuit, not on the same card, as it may seem in the following picture.

I apologize for the bad pattern, but I have not designed it yet. I have only a small breadboard with just two MCUs now.

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

You can connect together any number of pull-down outputs and a pull-up resistor with no danger of short circuit. There needs to be scheme that avoids two outputs pulling down at the same time, but that is harmless if it happens. A possible scheme is for one transmitter to be Master which sends a 0 pulse every 10 seconds. All the other transmitters are Slaves who know their distinct addresses so that Slave #1 may send something 1 second after the Master pulse, Slave #2 may send 2 seconds after,.... and so on. This example is deliberately slow because the data rate will be limited by the capacitance of the signalling wire, which we don't know.

The one-wire protocol device that KyranF mentions is clever because it manages to get its power from the same line that it occasionally pulls down.