Networking and Communications. Group 1.

Week 14 group assignment Networking and Communications

Weeks assignment

Our group work this week was the following: Send a message between two projects. You need to send a message between any combination of boards, computers and/or mobile devices, including commercial board(s). You need to write code that sends and/or receives the message in question.

For this assignment, we decided to use the boards Petra and Essi had made in Electronics Production week.

Our fellow students from group 2 had found a good tutorial for using software serial and we decided to use the same one. You can find it from SeeedStudio here. The tutorial had an example code for Software Serial. The SoftwareSerial library allows serial communication on other digital pins of a board. The library is said to have some limitations; for example it cannot transmit and receive data at the same time.

To use the library, you must include the SoftwareSerial Library to the code with:

Picture1:Exhaust Test setup

Then you define Rx and Tx pins of the device with: SoftwareSerial mySerial(2, 3); // RX, TX When you connect the devices in serial, you must connect the Rx pin of device 1 to Tx pin of device 2 and the other way around. rxPin: the pin on which to receive serial data. txPin: the pin on which to transmit serial data.

With mySerial.begin you set the speed for the serial communication. With the mySerial.available you get the number of bytes (characters) available for reading from a software serial port. This is data that has already arrived and stored in the serial receive buffer. mySerial.read returns a character that was received on the RX pin of the SoftwareSerial object.

Setup

We connected board 1 to computer 1, and board 2 to computer 2 to power them. We connected the two boards with jumper wires, using digital digital pins D2 and D3 and Ground.

Picture1:Exhaust Test setup

Picture1: Test setup

We ran this code in Arduino IDE to each of the boards. When we opened Serial Monitor, we could now send messages between the two projects!

Picture2:Message from Essi to Petra

Picture2: Message from Essi to Petra

Picture3:Message from Petra to Essi

Picture3: Message from Petra to Essi