Networking and Communications


This week, we wanted to prototype a heterogeneous network that can transmit over different channels.

We will only focus on a couple of these examples (serial-wire and MQTT Broker) as the others could not be completed in the allotted time (3h)

Wire communication

This example will show how the Start Board transmitted data to the infrared emitter board via Wire protocol through the SoftwareSerial library.

Since we were restricted to use an Arduino Leonardo, we initially struggled a bit to get the comms working.

After a quick look at the datasheet, we noticed that Leonardo board has some restrictions and the default ports do not work.

After a small change to the config to use one of the compatible ports, the communication started working properly.

The code

The sender

Check out the source code for the sender

The sender board uses Pins 30 and 31 to send and receive (respectively) data with the target board, while simultaneously transmitting status data over Serial to the computer, for monitoring purposes.

In this case, only the sender pin is needed and actually used, but we left the rest of the code for completion in case we ever wanted to make the communication bidirectional.

The receiver

Check out the source code for the sender

The receiver board receives information on pin 7, and could transmit on pin 6 (in the future, if needed).

This information is then, echoed to Serial so it can be inspected.

How this fits into the larger network of interconnected devices.

The method receiveFromDhanuSendToAdai() does most of the core functionality (receiving from board 1, programmed by Dhanu, and sending to board 3, programmed by Adai)

The sending via infrared was not completed properly and can be skipped, as this would be used for another communication link with a different board.