Electronic – Best way to communicate Raspberry Pi and ATTiny13

attinyavri2craspberry pispi

What is best way to connect two or three microcontrollers, ATTiny13 to Raspberry-Pi and get master (Raspberry Pi) communication? Are there any ready libraries for ATTiny13 for SPI or I2C? Maybe some other protocol supported by Raspberry Pi?

It doesn't have to be really fast. 1-wire speed is enough for me. Easiness is priority for me but I also don't want buy too many expensive items.

I found 1-wire slave library but I have issues with it so I'm looking for alternative.

Best Answer

You can use standard I2C or SPI. Master implementations exist for Raspberry Pi, and slave implementations exist for AVR. Using TinyAVR seriously limits usage for a very basic processing, so maybe you should opt for AVR with more memory if that becomes the problem. You can also use RS485 single master multi slaves serial communication over Pi's RS232 if RS485 interface chips are used on Pi and all AVRs. Of course, in this case you must implement some known standard protocol or create your own custom protocol.