Networking and Communication

Week's Assignments

Group Assignment:
●   Design, build, and connect wired or wireless node(s) with network or bus addresses.
Individual Assignments:
●   Send a message between two projects.

Network Design

I build a three-node wired network for this week’s assignment. The network consisted of Electronic Design week’s board, Input Devices week’s board and my PC. I used a quite simple network topology, namely serially connected (daisy-chained) nodes.


Figure 1. Network Topology.

The PC acts as the master, and the two board (each with its own specific address) as slaves. The Electronic Design week’s board and Input Devices week’s board are recognized with address 1 and 2, respectively. To connect the nodes to the network, I built a small hub (Fig. 3), The connection between PC and network implemented using FTDI USB cable and board 1 and 2, are directly connected to the network via serial connection, as shown in Fig. 2.
I did not make a PCB hub (for example like the one that Jari suggested), since my network and hub is simple, and I was a bit behind my schedule.


Figure 2. Network’s physical implementation.

Figure 3. Hub.

The network interactions at the master’s side is controlled and viewed in serial monitor. The two microcontroller boards have ATTiny44 microcontrollers. According to the pinout of Fig. 3, on each board an LED is connected to pin PB2. These LEDs will be used as output on each board that will be controlled by the master.


Figure 4. ATTiny44 pinout.

The master can send commands to slave devices and through these commands control the output device of each (i.e. on-board LED).

Communication

The code for the slave board 1 is shown in Fig. 5. The code for the second device is almost the same, just the device ID is different. The first byte of the sent data master contains the device ID of the node to which the command is going to be sent. When receiving data from the network, each slave checks the command for its own address. If the data is addressed to the slave device, it runs the command, which comes in the second transferred byte. The command value determine the number of blink of the LED. Here, since we have a master/slave architecture, the only node of the network that can issue commands is the master (PC). For simplicity, only one command is included in the codes.


Figure 5. board 1 code.

The following video shows the execution of the above-mentioned communication. In this test, the PC first command board 1 to blink its LED five times, and then command board 2 to blink its LED seven times.

Reflection

I implemented a wired network this week. I did not have enough time to try wireless options, or test other network topologies.