software serial 1 wire communication

as I have only 1 pin left on attiny85, I need to communicate with 1 wire with other attinys if I want to implement back propagation. Usually serial communication uses 2 pin/wires, one to receive(RX) and one to send(TX). I tried creating software serial object using both TX and RX as same pin (D1) and stop listening the serial (mySerial.stopListening();) and switching the pin to output short time as the writing sequence happens. Then switch the pinmode to input again and start listening (mySerial.listen();)

also I used packetizer library by i-n-g-o ( to separate the package and make sure that it goes through. It was quite tricky as it listen to its own package too. Also, it is a bit noisy, I think due to pinmode switching around. It was great to use packetizer, start and end sequence so I can ignore all the noise that comes in the beginning of the communication. I must say it was not very straight forward to send clean packages around, and I got a lot of help from Ingo. Thanks!!

The result seems promising. Now I can communicate with 3 ATTINY85 with 1 wire on D1 connected to all of them. Each of them has unique sensor Number (ID), and when they receive its sensor Number, it processes the value, turn the LED accordingly and pass on the value to the next ATTINY. I plan to use this communication to pass on the back propagation data between the ATTINY neurons. Now I need to implement small number neuron network and see if the learning works.

“start” is the start of the package. ?5566 is the garbage noise I get that I can not get rid of… ‘a’ ‘b’ ‘c’ ‘d’ is the byte 97, 98, 99, 100 that I am using as the sensorNumber. so, when I send “start” ‘a’ (97) value (i.e. 10) from serial monitor on my computer, then the ATTINY that is set for 97 receives 10, manipulate the value (i.e. +10 in my test code) then send to the next one, 98 (‘b’) with value 20… and so on. it looks a bit messy, but it works!

the arduino code used for this one is here >>