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.


simulate this circuit – Schematic created using CircuitLab

  • 1
    \$\begingroup\$ The power symbol looks like GROUND to me in the picture, but whatever. Have you looked at the actual One Wire protocol (hardware and method of operation) already available in the industry? maximintegrated.com/en/products/comms/one-wire.html \$\endgroup\$ – KyranF Apr 28 '15 at 17:07
  • \$\begingroup\$ Here is an overview of how 1-Wire bus works: maximintegrated.com/en/app-notes/index.mvp/id/1796 \$\endgroup\$ – KyranF Apr 28 '15 at 17:08
  • \$\begingroup\$ There's no VCC in my scheme,I've indicated GND to explain that I've pull-up on GND.VCC should be connected at Ux chips. \$\endgroup\$ – Sir Jo Black Apr 28 '15 at 17:08
  • \$\begingroup\$ You should not have anything between you Ux chips and ground.. that is a bad idea. I think you are getting electrically confused \$\endgroup\$ – KyranF Apr 28 '15 at 17:09
  • 1
    \$\begingroup\$ The DDR changes are obvious requirement to begin sending, but between sending "high" bits (while the bus should be high) it may be advantageous to change the pin back to input to read the level of the bus, and confirm that it's not being held low by something else, before continueing to send another "high" (active low) bit. If the bus is found to be in contention (something other than the device trying to transmit) then you can abort the transmission and try resending soon after the bus has finished being used. \$\endgroup\$ – KyranF Apr 28 '15 at 17:40

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.

  • 1
    \$\begingroup\$ I have done some work on sensor chains using 1-wire protocol by Maxim. I used a 1-wire bus master IC which deals with the hardware protocol and timing nicely, plus I used a high side P-FET pull up for active and powerful supply current to end-devices, also allowing for much higher bus capacitance. Indeed as you say the whole process is slow in general, but for things like a chain of temperature or moisture sensors it was fine. \$\endgroup\$ – KyranF Apr 28 '15 at 17:38
  • \$\begingroup\$ My protocol foreseen that the master sends a packet that contains the address of the slave that has to receive, and then waits the slave reply. But I would to have the slaves are able to send also in an asynchronous way, such as ethernet! \$\endgroup\$ – Sir Jo Black Apr 28 '15 at 17:43
  • 1
    \$\begingroup\$ @SergioFormiggini Ethernet was not always full duplex (allows both way communication), the problem with a single wire used for master-slave communication, AND multi-devices, is you basically cannot allow asynchronous/unchecked bus control by slaves. It must be carefully organized by the master, or as cuddlyable3 mentions above, using time multiplexing schemes. \$\endgroup\$ – KyranF Apr 28 '15 at 17:54
  • \$\begingroup\$ @SergioFormiggini If you had 2-wire (plus ground) you could definitely try some tricky two-way or multi-slave communications in a more asynchronous, event-based method of communications \$\endgroup\$ – KyranF Apr 28 '15 at 17:55
  • \$\begingroup\$ Yes I know, but in this period I'm unemployed and I have time to make some experiments ... :) I want use ATtiny85 using all its pins ... I might use also I2C, but ... \$\endgroup\$ – Sir Jo Black Apr 28 '15 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.