I'd like my 2 arduinos to chat a little, and I'm looking for a solution as cheap as possible. Everybody seems to focus on wireless, so I didn't find any interesting stuff yet. Here is what I'm looking for :
The "network" should be as simple and cheap as possible (classic components, possibly scavenged from various sources esp. computer parts)
Max. 4 wires between the boards, if possible 2
Both boards will be able to talk when they need (peer-to-peer configuration)
The two boards have different power sources, so galvanic insulation will be needed I think
I tried to send a signal (on/off) on a pin through a self-made transformer (wound thin wire around a stud) but the other side didn't pick up anything. I fear my electronics skills are limited...
Thanks, i believe this is simple enough. But What about the insulation ? Isn’t it dangerous to connect the two grounds of different (switch-mode) power supplies ?
No, not if there both DC power supplies, in fact it's a requirement if the two boards are going to share directly connected signals together. However if you use opto-isolators between the signals of the two boards then there is no need and the grounds should not be wired together.
Many points... if you're willing to consider an Arduino or other serial comms capable device at each end.
Before I start: Don't overlook the software challenge you have set yourself. As long as you know where you are going, you can do a lot of development work with two Arduinos only a few feet apart, with, during development, just wires between them.
a) Wires: You only need 3 for an easy answer, and can get by with 2. Phone wire is cheap because of volume sales... may be worth "throwing away 4th conductor. OR accept the 4th wire as "necessary" as "price" of SEPARATE xmit/receive channels... probably WELL worth the "cost" of the extra wire, which may be small. Consider also the wire used for thermostats. May give less voltage drop... but better to design a "voltage drop tolerant" system.
b) To connect grounds or not. In simple scenarios, you must.... and that gives a way for problems at point A to affect things at point B. For a whole bunch of reasons, I would put opto-isolators at the receiving end of each wire... 2 optoisolators in all, with, probably, some "driving" cirsuitry at the sending ends.
Optoisolators... great little things for all sorts of stuff... Even if you don't use them in THIS project, be sure to make their acquaintance....
c) TWO Arduinos chatting? While you work on this.. a good place to start.. think ahead to the day when you want to extend your system to allow multiple devices on the network. Several possibilities: A "daisy chain" design. One "ring" of wire with lots of devices tapping into it, any one of them able to bring the signal in the ring down from its usual high state. (This is the basis of 1-Wire networks, and, I think, Ethernet hardware. The hardware is simple... the software less so!)
Along with deciding all of the above, you have to consider the software at various levels, not least how the wires of your hardware are going to plug into your Arduinos. I would go with a design based on a serial port other than the "standard" one on D0/D1, using a Mega or using NewSoftSerial....