This week's assignment was to design and build a wired and/or wireless network connecting at least two processors. For that I decided to use two of my boards which I made for input and output devices assignments before.
Asynchronous Serial Communication:
1. I started by learning about the asynchronous and synchronous serial communications from here and decided that due to the way I designed my boards the only network I can build is asynchronous serial using the 2x2 pinheads to connect Rx, Tx and GND on both boards.
2. Asynchronous connection uses data chunks to send information, which can be between 5 to 9 bits. The chunk is packed between the synchronisation bits, the start and stop bits, which indicate the beginning and end of the data. Sometimes also parity bit can be sent with the package which is used for the low-level error checking.
3. Below is the shcematic of my two previously designed boards. The left one has a NTC thermistor as an input device for measuring temperature. The right one uses charlieplexing of led arrays to display the temperature meauserd with the board on the left. In order to connect them I needed to connect Rx of both boards to the Tx of the other board (yellow and green lines), and connect the grounds (blue line).
4. The board with the NTC sensor became the bridge becuase it had a FTDI header for serial connection. The board with the led array functions as a node which receives temperature information from the bridge.
Programming the boards to communicate:
5. Because in the case of asynchronous connection the data is transferred without support from an external clock signal. It uses a number of rules (protocol), such as data bits, synchronisation bits and parity bits, mentioned before, to communicate. But also the baud rate of the devices is important to be sure that the data is transferred at the same rate from both devices. Another important thing is to fine tune the internal clock (OSCCAL) of the microcontroller to ensure a clear data transmittance between the devices. Due to that I ran a code below on my bridge to define the OSCCAL where the communication is clear through the serial monitor.
6. After that I adjusted my code for the input device to measure temperature in celsius to code the bridge for sending temperautre information to the node (led array board). I couldn't test the code yet because I ran out of memory on my ATTiny44 microcontroller. I need to change it to ATTiny84 to run the code.
7. When trying to run the code I got an error saying that there is not enough storage space on my ATTiny 44, so I need to change it wiht ATtiny84.
8. Then I wrote a code for the node (led array board) to read the serial information in the port and display the numbers accordingly. But as I previously tested the communication with simple led blinking codes and couldn't get the boards to communicate I tried to change the position of my flat wire to find a correct position for connecting the 2x2 pinheads. In numerous attempts I managed to overheat my microcontroller on the led array board and the soldering of a wire came loose. Before I can continue with the final code I need to change the ATTiny44 to 84 due to memory problems and resolder the wire back.