How to control and coordinate many Arduino boards


There are a lot of controlling softwares for Arduino boards that you can use to connect a computer (linux, windows, android and so on) to your preferred Arduino. But  I know just one controlling software that is able to control and coordinate many Arduino boards at the same time. It is Ardulink. With Ardulink you have at least two very high scalability options to achieve this result.

The first one is to connect several Arduino boards to a single PC, for instance with USB cables. An Ardulink based software (running in the same PC) have just to use several instances of Link class, one for each connected board.

This is a simple code snippet that show you how listen for a pin state change value from an Arduino board A and dispatch this value change event to two different Arduino boards B and C (from/to respectively pins 11,12 and 13).

private Link linkA;
private Link linkB;
private Link linkC;

public void coordinate() {
	linkA = Link.createInstance("linkA");
	linkA.connect("COM19");
	linkB = Link.createInstance("linkB");
	linkB.connect("COM20");
	linkC = Link.createInstance("link3");
	linkC.connect("COM21");

	linkA.addDigitalReadChangeListener(
	  new DigitalReadChangeListener() {

		@Override
		public void stateChanged(DigitalReadChangeEvent e) {

			linkB.sendPowerPinSwitch(12, e.getValue());
			linkC.sendPowerPinSwitch(13, e.getValue());

		}

		@Override
		public int getPinListening() {
			return 11;
		}
	});
}

 

The second one is to connect several Arduino boards to a single PC, for instance with USB cables and install into this PC the Ardulink Network Proxy Server. In this way another PC with an Ardulink based software can communicate with the Ardulink Network Proxy Server and drive it.

The snippet code could be very similar to the above one. You have just to specify a network connection instead of use the implicit default serial connection.

// Hostname=RaspberryHost, Hostport=4478
NetworkProxy connection = new NetworkProxy("RaspberryHost", 4478);
Link networkLinkToRaspberry = 
              Link.createInstance(
                        "networkLinkToRaspberry"
                       ,connection
              );

 

Of course you can mix these two options as you like. Let’s see an example scheme.

control and coordinate many arduino example scheme

PC with an Ardulink based software controls directly three Arduino boards and indirectly other six Arduino boards connected with three Ardulink Network Proxy Server. Note that one of them is installed into an Raspberry PI system. I’ll report you in another article the amazing result for the Ardulink Network Proxy Server working test on a Raspberry PI.

Using a network connection is another very powerful Ardulink feature. You can coordinate many Arduino boards widely distributed into the net (even into a wireless net).

Here you can see another example video where Ardulink coordinates an Ardino UNO and Arduino Micro and a Digispark board.

to download videos source code examples click here: Coordination Examples

4 Risposte a “How to control and coordinate many Arduino boards”

  1. Hello,

    I think that this code is not correct, you have to add a thread.sleep(2000); before the addDigitalReadChangeListener

I commenti sono chiusi.